Discussion:
[visualization-api] Stacked Column Chart- Displaying a line if count is zero
virendra chaudhary
2016-08-09 09:12:57 UTC
Permalink
I want to create Stacked Column Chart which should not display anything
related to a entity whose count is zero.

I am using below html code. It is displaying a red line on top of green bar
even if count is zero for the entity related to red(Failed). I want to
remove this line.

Please help me.

<html>
<head>
<script type="text/javascript"
src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawStacked);

function drawStacked() {
var data = google.visualization.arrayToDataTable([
['Genre','Passed', 'Failed', { role: 'annotation' } ],
['DashBoard', 10, 0, ''],

]);

var options = {
width: 600,
height: 400,
legend: { position: 'top', maxLines: 3 },
bar: { groupWidth: '75%' },
colors:["green","red","black"],
isStacked: true
};

var chart = new
google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div"></div>
</body>
</html>



Many Thanks!
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+***@googlegroups.com.
To post to this group, send email to google-visualization-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/098b753c-adbd-4caf-a30f-d6b5e5b38b51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Daniel LaLiberte' via Google Visualization API
2016-08-09 14:04:17 UTC
Permalink
Have you tried using a null value instead of 0?

On Tue, Aug 9, 2016 at 5:12 AM, virendra chaudhary <
Post by virendra chaudhary
I want to create Stacked Column Chart which should not display anything
related to a entity whose count is zero.
I am using below html code. It is displaying a red line on top of green
bar even if count is zero for the entity related to red(Failed). I want to
remove this line.
Please help me.
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/
charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawStacked);
function drawStacked() {
var data = google.visualization.arrayToDataTable([
['Genre','Passed', 'Failed', { role: 'annotation' } ],
['DashBoard', 10, 0, ''],
]);
var options = {
width: 600,
height: 400,
legend: { position: 'top', maxLines: 3 },
bar: { groupWidth: '75%' },
colors:["green","red","black"],
isStacked: true
};
var chart = new google.visualization.ColumnChart(document.
getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div"></div>
</body>
</html>
Many Thanks!
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an
googlegroups.com.
Visit this group at https://groups.google.com/
group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/
msgid/google-visualization-api/098b753c-adbd-4caf-a30f-
d6b5e5b38b51%40googlegroups.com
<https://groups.google.com/d/msgid/google-visualization-api/098b753c-adbd-4caf-a30f-d6b5e5b38b51%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
***@Google.com <***@google.com> 5CC, Cambridge MA
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+***@googlegroups.com.
To post to this group, send email to google-visualization-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJO5%2BLsQs9MGrh2%2BNZ5XPqVhHdvrJLcPXnWKDBPD576_tw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
virendra chaudhary
2016-08-09 14:28:43 UTC
Permalink
Yes. I have tried null and blank but It is giving me error "All series on a
given axis must be of the same data type"
Post by 'Daniel LaLiberte' via Google Visualization API
Have you tried using a null value instead of 0?
Post by virendra chaudhary
I want to create Stacked Column Chart which should not display anything
related to a entity whose count is zero.
I am using below html code. It is displaying a red line on top of green
bar even if count is zero for the entity related to red(Failed). I want to
remove this line.
Please help me.
<html>
<head>
<script type="text/javascript" src="
https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawStacked);
function drawStacked() {
var data = google.visualization.arrayToDataTable([
['Genre','Passed', 'Failed', { role: 'annotation' } ],
['DashBoard', 10, 0, ''],
]);
var options = {
width: 600,
height: 400,
legend: { position: 'top', maxLines: 3 },
bar: { groupWidth: '75%' },
colors:["green","red","black"],
isStacked: true
};
var chart = new
google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div"></div>
</body>
</html>
Many Thanks!
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
<javascript:>.
Visit this group at
https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/098b753c-adbd-4caf-a30f-d6b5e5b38b51%40googlegroups.com
<https://groups.google.com/d/msgid/google-visualization-api/098b753c-adbd-4caf-a30f-d6b5e5b38b51%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+***@googlegroups.com.
To post to this group, send email to google-visualization-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/c673dfaf-b8a6-4e06-bec4-0c28dac47b5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Daniel LaLiberte' via Google Visualization API
2016-08-09 15:48:05 UTC
Permalink
The type inferencing might have a problem if you use arrayToDataTable and
the first rows contain nulls. Not sure about that. Try setting up your
DataTable by explicitly typing the columns instead, by calling addColumn()
for each column followed by addRows(). Hope that helps.



On Tue, Aug 9, 2016 at 10:28 AM, virendra chaudhary <
Post by virendra chaudhary
Yes. I have tried null and blank but It is giving me error "All series on
a given axis must be of the same data type"
Post by 'Daniel LaLiberte' via Google Visualization API
Have you tried using a null value instead of 0?
On Tue, Aug 9, 2016 at 5:12 AM, virendra chaudhary <
Post by virendra chaudhary
I want to create Stacked Column Chart which should not display anything
related to a entity whose count is zero.
I am using below html code. It is displaying a red line on top of green
bar even if count is zero for the entity related to red(Failed). I want to
remove this line.
Please help me.
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/c
harts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawStacked);
function drawStacked() {
var data = google.visualization.arrayToDataTable([
['Genre','Passed', 'Failed', { role: 'annotation' } ],
['DashBoard', 10, 0, ''],
]);
var options = {
width: 600,
height: 400,
legend: { position: 'top', maxLines: 3 },
bar: { groupWidth: '75%' },
colors:["green","red","black"],
isStacked: true
};
var chart = new google.visualization.ColumnCha
rt(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div"></div>
</body>
</html>
Many Thanks!
--
You received this message because you are subscribed to the Google
Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/grou
p/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/ms
gid/google-visualization-api/098b753c-adbd-4caf-a30f-d6b5e5
b38b51%40googlegroups.com
<https://groups.google.com/d/msgid/google-visualization-api/098b753c-adbd-4caf-a30f-d6b5e5b38b51%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an
googlegroups.com.
Visit this group at https://groups.google.com/
group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/
msgid/google-visualization-api/c673dfaf-b8a6-4e06-bec4-
0c28dac47b5c%40googlegroups.com
<https://groups.google.com/d/msgid/google-visualization-api/c673dfaf-b8a6-4e06-bec4-0c28dac47b5c%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
***@Google.com <***@google.com> 5CC, Cambridge MA
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+***@googlegroups.com.
To post to this group, send email to google-visualization-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJPn%2B3hk%3DqqeLzMLwh7f70y7z_6sXF%3Dp7M-0r-QrCPNvOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
virendra chaudhary
2016-08-10 09:31:54 UTC
Permalink
Thank You. It worked.
Post by 'Daniel LaLiberte' via Google Visualization API
The type inferencing might have a problem if you use arrayToDataTable and
the first rows contain nulls. Not sure about that. Try setting up your
DataTable by explicitly typing the columns instead, by calling addColumn()
for each column followed by addRows(). Hope that helps.
On Tue, Aug 9, 2016 at 10:28 AM, virendra chaudhary <
Post by virendra chaudhary
Yes. I have tried null and blank but It is giving me error "All series
on a given axis must be of the same data type"
Post by 'Daniel LaLiberte' via Google Visualization API
Have you tried using a null value instead of 0?
On Tue, Aug 9, 2016 at 5:12 AM, virendra chaudhary <
Post by virendra chaudhary
I want to create Stacked Column Chart which should not display anything
related to a entity whose count is zero.
I am using below html code. It is displaying a red line on top of green
bar even if count is zero for the entity related to red(Failed). I want to
remove this line.
Please help me.
<html>
<head>
<script type="text/javascript" src="
https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawStacked);
function drawStacked() {
var data = google.visualization.arrayToDataTable([
['Genre','Passed', 'Failed', { role: 'annotation' } ],
['DashBoard', 10, 0, ''],
]);
var options = {
width: 600,
height: 400,
legend: { position: 'top', maxLines: 3 },
bar: { groupWidth: '75%' },
colors:["green","red","black"],
isStacked: true
};
var chart = new
google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div"></div>
</body>
</html>
Many Thanks!
--
You received this message because you are subscribed to the Google
Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at
https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/098b753c-adbd-4caf-a30f-d6b5e5b38b51%40googlegroups.com
<https://groups.google.com/d/msgid/google-visualization-api/098b753c-adbd-4caf-a30f-d6b5e5b38b51%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
<javascript:>.
Visit this group at
https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/c673dfaf-b8a6-4e06-bec4-0c28dac47b5c%40googlegroups.com
<https://groups.google.com/d/msgid/google-visualization-api/c673dfaf-b8a6-4e06-bec4-0c28dac47b5c%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+***@googlegroups.com.
To post to this group, send email to google-visualization-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/3a5d4c19-2b72-447b-87c4-802655c37752%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...