javascript - Google Combo Chart + multiple legend for != data -
a short explenantion.
i'm using google combo chart display graph below :https://google-developers.appspot.com/chart/interactive/docs/gallery/combochart#configuration_options
but, can see, it's not easy read blue values, long red line accumulate of blue values, can go high. there way put second legend on right of picture? in order red line stay @ reasonable high, , make thing readable easely? read doc legend, didn't found:
how tu put second legend ? how make red line folow second legend? in case. have snippet ?
thinqs.
you can use multiple vaxes , specify series plotted on axis. like:
function drawvisualization() { // data, use own var data = google.visualization.arraytodatatable([ ['date', 'value', 'cumulate'], ['2014/01/01', 5, 5], ['2014/01/02', 20, 25], ['2014/01/03', 7, 32], ['2014/01/04', 15, 47], ['2014/01/05', 3, 50], ['2014/01/06', 5, 55], ['2014/01/07', 0, 55], ['2014/01/08', 0, 55], ['2014/01/09', 10, 65], ['2014/01/10', 5, 70], ['2014/01/11', 10, 80], ['2014/01/12', 0, 80], ['2014/01/13', 7, 87], ['2014/01/14', 13, 90], ['2014/01/15', 10, 100] ]); var options = { title : 'pluviometre', // multiple axis (you can have different labels, colors, etc.) vaxes: [ {title: "mm/h"}, {title: "mm/h",textstyle:{color: "red"}} ], haxis: {title: "date"}, seriestype: "bars", // 1st series on axis 0 (by default), 2nd series on axis 1 series: {1: {type: "line", targetaxisindex:1}} }; var chart = new google.visualization.combochart(document.getelementbyid('chart_div')); chart.draw(data, options); }
Comments
Post a Comment