Google Chart - date & gridlines -
this strange thing seeme let me see 4 gridlines on horizontal line. can help?
<html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setonloadcallback(drawchart); function drawchart() { var data = new google.visualization.datatable(); data.addcolumn('date', 'date'); data.addcolumn('number', 'now'); data.addcolumn('number', 'comparison'); data.addrows([ [new date(2008, 1 ,1), 1264, 1477], [new date(2008, 1 ,2), 1499, 1406], [new date(2008, 1 ,3), 1322, 1105], [new date(2008, 1 ,4), 1147, 1154], [new date(2008, 1 ,5), 1309, 1227], [new date(2008, 1 ,6), 1251, 1298], [new date(2008, 1 ,7), 1238, 1264], [new date(2008, 1 ,8), 1264, 1477], [new date(2008, 1 ,9), 1499, 1406], [new date(2008, 1 ,10), 1322, 1105], [new date(2008, 1 ,11), 1147, 1154], [new date(2008, 1 ,12), 1309, 1227], [new date(2008, 1 ,13), 1251, 1298], [new date(2008, 1 ,14), 1238, 1264], [new date(2008, 1 ,15), 1789, 1256], [new date(2008, 1 ,16), 1789, 1078], [new date(2008, 1 ,17), 1965, 975], [new date(2008, 1 ,18), 1654, 896], [new date(2008, 1 ,19), 1478, 789], [new date(2008, 1 ,20), 1278, 989], [new date(2008, 1 ,21), 1078, 1009], [new date(2008, 1 ,22), 1698, 1109], [new date(2008, 1 ,23), 1398, 1209], [new date(2008, 1 ,24), 1298, 1509], [new date(2008, 1 ,25), 1298, 1009], [new date(2008, 1 ,26), 1198, 1209], ]); var chart = new google.visualization.linechart(document.getelementbyid('chart_div')); chart.draw(data); } </script> </head> <body> <div id="chart_div" style="width: 2000px; height: 1000px;"></div> </body> </html>
the default behavior charts use 5 gridlines. see the documentation under haxis.gridlines.count.
if want increase number of gridlines, set options in chart. instance:
chart.draw(data, {vaxis: {gridlines: {count: 100}}}) here sample whole mess of gridlines (from google playground above option added):
function drawvisualization() { // create , populate data table. var data = google.visualization.arraytodatatable([ ['x', 'cats', 'blanket 1', 'blanket 2'], ['a', 1, 1, 0.5], ['b', 2, 0.5, 1], ['c', 4, 1, 0.5], ['d', 8, 0.5, 1], ['e', 7, 1, 0.5], ['f', 7, 0.5, 1], ['g', 8, 1, 0.5], ['h', 4, 0.5, 1], ['i', 2, 1, 0.5], ['j', 3.5, 0.5, 1], ['k', 3, 1, 0.5], ['l', 3.5, 0.5, 1], ['m', 1, 1, 0.5], ['n', 1, 0.5, 1] ]); // create , draw visualization. new google.visualization.linechart(document.getelementbyid('visualization')). draw(data, {curvetype: "function", width: 500, height: 400, vaxis: {maxvalue: 10, gridlines: {count: 100}} } ); } as aren't specifying how many gridlines expect, please edit above suit needs.
Comments
Post a Comment