Using google area chart: http://code.google.com/apis/chart/interactive/docs/gallery/areachart.html
Does anyone know how I can freelly manipulate the legends?
Maybe something like this (it's depends on the font that you use, you need fetch the proportion of your font)
var my_legend = "this is my legend x";
var len_legend = my_legend.length;
var width_graph = 400;
var chars_per_line = width_graph / [REPLACE_BY_PROPORTION]
if (len_legend > chars_per_line) {
my_legend = wordwrap(my_legend, 20, '
\n');
}
AND THE WRAP WORD FUNCTION (or anything like this)
function wordwrap( str, width, brk, cut ) {
brk = brk || '\n';
width = width || 75;
cut = cut || false;
if (!str) { return str; }
var regex = '.{1,' +width+ '}(\\s|$)' + (cut ? '|.{' +width+ '}|.+$' : '|\\S+?(\\s|$)');
return str.match( RegExp(regex, 'g') ).join( brk );
}
SO FOR your code...
replace values at
var chart = new google.visualization.AreaChart(document....
etc
by your vars.
not use width = 400, use width, and so on... and your string.