Legend Bottom and Vertical

2,939 views
Skip to first unread message

Ira

unread,
Nov 7, 2011, 1:46:57 PM11/7/11
to Google Visualization API
Is it possible to have the legend appear below the chart and be
vertical?

This is my current code:

draw(data, {curveType: "function",
width: 600, height: 400,
vAxis: {maxValue: 10},
legend: 'bottom', pointSize: 5}
);

asgallant

unread,
Nov 7, 2011, 2:17:39 PM11/7/11
to google-visua...@googlegroups.com
No, the legend is always horizontal when placed on the bottom.

Ira

unread,
Nov 7, 2011, 2:53:28 PM11/7/11
to Google Visualization API
Thanks for the quick reply.

That really kind of stinks...because the values get abbreviated and
are difficult to read.

asgallant

unread,
Nov 7, 2011, 3:05:34 PM11/7/11
to google-visua...@googlegroups.com
There is an undocumented feature of the legend option that allows you to have multiple rows, but last I heard it wasn't implemented for legends placed on the bottom (and, as it is unfinished and undocumented, it may change or disappear at a moments notice).  Use the 'legend' option as an object with 'position' and 'maxLines' properties (position accepts the same strings as the string version of the legend option, maxLines takes an integer representing the maximum number of lines for the legend).  ie: legend: {position: 'top', maxLines: 3}

As an alternative, you can remove the legend and build your own outside the chart (using the column labels and colors you pass to the chart), which gives you more freedom.
Reply all
Reply to author
Forward
0 new messages