Legend position on the right is not displayed

66 views
Skip to first unread message

amirmiller

unread,
Nov 23, 2011, 7:15:17 AM11/23/11
to Google Visualization API
Hi,

I am trying to create a chart with dual v series and for some reason
it won't allow putting the legend on the right (all legend positions
work).
Is this a bug (see code below)?

Amir

<!--
You are free to copy and use this sample in accordance with the terms
of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/
>
<script type="text/javascript" src="http://www.google.com/jsapi"></
script>
<script type="text/javascript">
google.load('visualization', '1.1', {packages: ['corechart']});
</script>
<script type="text/javascript">
function drawVisualization() {
// Some raw data (not necessarily accurate)
var rowData = [
['Month','S1', 'S2', 'S3', 'S4,S5', 'Defect Density'],
['22-Aug-2011', 0, 0, 5, 2, 0.00001589063],
['29-Aug-2011', 0, 0, 5, 2, 0.00001605478],
['05-Sep-2011', 0, 0, 5, 2, 0.00001589063],
['12-Sep-2011', 0, 0, 8, 3, 0.00002492076],
['19-Sep-2011', 0, 1, 19, 12, 0.00009866068],
['26-Sep-2011', 1, 5, 36, 61, 0.00031356769],
['03-Oct-2011', 1, 4, 39, 68, 0.0003370529],
['10-Oct-2011', 1, 4, 44, 80, 0.0003809130],
['17-Oct-2011', 2, 4, 42, 84, 0.0003899222],
['24-Oct-2011', 3, 6, 42, 82, 0.0003838217],
['31-Oct-2011', 1, 7, 35, 74, 0.0003302118],
['07-Nov-2011', 1, 7, 42, 80, 0.0003693244],
['14-Nov-2011', 3, 6, 51, 99, 0.0004335567],
['21-Nov-2011', 3, 12, 56, 103, 0]
];

// Create and populate the data table.
var data = google.visualization.arrayToDataTable(rowData);

// Create and draw the visualization.
var ac = new
google.visualization.ComboChart(document.getElementById('visualization'));
ac.draw(data, {
width: 470,
height: 250,
colors:
['#3266CC','#DC3910','#DB8E1C','#109619','#990099','#0099C5','#DD4578','#66AA00'],
seriesType: "bars",
isStacked: true,
legend: 'right',
series: {0:{targetAxisIndex:0},1:{targetAxisIndex:0},2:
{targetAxisIndex:0},3:{targetAxisIndex:0},4:{targetAxisIndex:
1,type:'line'}},
vAxes:[{title:'Bug Count',maxValue: 50},{title:'Defect
Density'}]
});
}

google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body>
<div id="visualization"></div>
</body>
</html>

asgallant

unread,
Nov 23, 2011, 11:22:41 AM11/23/11
to google-visua...@googlegroups.com
That seems to be a bug.

amirmiller

unread,
Nov 24, 2011, 3:16:17 AM11/24/11
to Google Visualization API
Should I file it somewhere?

chatchai sudto

unread,
Nov 24, 2011, 8:24:16 PM11/24/11
to google-visua...@googlegroups.com
<--------------------------------------------------------------------------------------------------------------------------------------------------------------->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
<head>
    <title></title>
         width: 800,
         height: 450,
         colors:
['#3266CC','#DC3910','#DB8E1C','#109619','#990099','#0099C5','#DD4578','#66AA00'],
         seriesType: "bars",
         isStacked: true,
         legend: 'right',
         series: {0:{targetAxisIndex:0},1:{targetAxisIndex:0},2:
{targetAxisIndex:0},3:{targetAxisIndex:0},4:{targetAxisIndex:
1,type:'line'}},
         vAxes:[{title:'Bug Count',maxValue: 50},{title:'DefectDensity'}]
       });
     }

     google.setOnLoadCallback(drawVisualization);
    </script>
</head>
<body>
    <div id="visualization">
    </div>
</body>
</html>


<--------------------------------------------------------------------------------------------------------------------------------------------------------------->

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


visigoth

unread,
Nov 29, 2011, 11:06:57 AM11/29/11
to google-visua...@googlegroups.com
When using dual Y axes, placing the legend on the right is not supported (the space is kept for the title of the vertical axis on the right). The only options are 'top', 'bottom' and 'in'.
I will fix the misleading documentation.
Reply all
Reply to author
Forward
0 new messages