javascript - How to set legend labels in Google Chart Candlestick -
How do I set series labels for the chart legend in the Candlestick Google chart?
code:
var chart_options = {Legend: {status: 'bottom'}}; Var chart data = [[New date (2014, 3, 1), 95,100,98,110, blank, blank, empty, null], [New date (2014, 3, 2), 98,98,102,103, Blank, Null, Empty, Null ], New Date (2014, 3, 3), 90,102, 9 5,105, 91103, 96106], New Date (2014, 3, 4), 93, 9, 510, 103, 94 9 6, 103, 103], [New Date (2014, 3 , 5), 94,103,104,105, 95,104,105,106],]; Chart1 = New google.visualization.CandlestickChart (document.getElementById ('chart')); Chart1.draw (google.visualization.arrayToDataTable (chartdata, true), chart_popathy); Source:
I have found the solution To use syntax with google.visualization.DataTable : // This is the correct var chartdata = new google.visualization.DataTable (); Chartdata.addColumn (...); Chartdata.addRows (...); Chart1.draw (chartdata, chart_options);
// This is incorrect Var chart, instead of google.visualization.arrayToDataTable (..., true) [...]; Chart1 = New google.visualization.CandlestickChart (document.getElementById ('chart')); Chart1.draw (google.visualization.arrayToDataTable (chartdata, true), chart_popathy); Full function js:
var chart_options = {legend: {status: 'below'}, hxis: {// format: "h: Mm "}}; Var chartdata = new google.visualization.DataTable (); Chartdata.addColumn ('datetime', 'data'); Chartdata.addColumn ('number', 'label1'); Chartdata.addColumn ('number', ''); Chartdata.addColumn ('number', ''); Chartdata.addColumn ('number', ''); Chartdata.addColumn ('number', 'label2'); Chartdata.addColumn ('number', ''); Chartdata.addColumn ('number', ''); Chartdata.addColumn ('number', ''); Chartdata.addRows ([[New date (2014, 3, 1), 95,100,98,110, blank, blank, empty, null], [New date (2014, 3, 2), 98,98,102,103, Blank, Null], [New date (2014, 3, 3), 90,102, 9, 5, 5, 91, 103, 9, 6, 6, 10, [New date (2014, 3, 4), 93, 9, 5, 103, 103, 94, 9, 10, 4, 104 ], [New date (2014, 3, 5), 94,103,104,105, 95,104,105,106],]); Chart1 = New google.visualization.CandlestickChart (document.getElementById ('chart')); Chart1.draw (chartdata, chart_options); JSField:
Comments
Post a Comment