Stacked Chart order of the legend

39 views
Skip to first unread message

Bram Patelski

unread,
Nov 12, 2015, 9:20:02 AM11/12/15
to Google Visualization API
Hi,

I've implemented a stacked chart like this:

 google.load('visualization', '1', {packages: ['corechart', 'line']});
 google
.setOnLoadCallback(drawBackgroundColor);


 
function drawBackgroundColor() {
     
var data = new google.visualization.DataTable();
      data
.addColumn('date', 'Date');
      data
.addColumn('number', 'A');
      data
.addColumn('number', 'B');
      data
.addColumn('number', 'C');
     
// etc.
     
      data
.addRows([
 
[new Date(2010, 1, 1),0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],
 
[new Date(2010, 2, 1),0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],
 
[new Date(2010, 3, 1),0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],
 
// etc

However, the columns are in reversed order in the legend.
It shows "C, B, A" from top to bottom.
Can I somehow reverse the order of the legend?

Thanks

Sergey Grabkovsky

unread,
Nov 12, 2015, 10:04:09 AM11/12/15
to Google Visualization API
Hi Bram,

The series are listed in the order that they appear in the chart. Since this is a stacked chart, the 'C' series will be at the top (first), the 'B' series will be in the middle (second), and the 'A' series will be the lowest (last). You can reverse the items in the legend by reversing the order of the actual series, but there's no option to do this.

--
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-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/d0c6ba0b-bb53-47b1-92c5-58a6ddc378f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
unnamed.gif 
Sergey Grabkovsky | SWE  | gra...@google.com

Bram Patelski

unread,
Nov 12, 2015, 10:12:07 AM11/12/15
to google-visua...@googlegroups.com
Okay, it sorta makes sense. I understand there's no way to diverge from the stacked-order?

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/GMWSNVezUds/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.

Sergey Grabkovsky

unread,
Nov 12, 2015, 10:16:38 AM11/12/15
to google-visua...@googlegroups.com
That's correct, we don't offer any options to change the order in the legend.


For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages