javascript - Google Charts API: more than one label rows on x axis? -
i have chart bar chart showing multiple data. data divided year (2014, 2015) , quarter (q1,q2,q3,q4). can show either quarters on x-axis or year, not both. made screenshot , put years in there show i'd achieve.
<html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> </head> <body> <script type="text/javascript"> google.load('visualization', '1.1', {packages: ['bar']}); google.setonloadcallback(drawbasic); function drawbasic() { //create data table object var data = google.visualization.arraytodatatable([ ['','sales', 'expenses'], ['q1',1000, 400], ['q2',1000, 400], ['q3',1170, 460], ['q4',900, 500], ['q1',1400, 420], ['q2',1240, 750], ['q3',1001, 360], ['q4',788, 800] ]); var options = { width: 800, height: 600, is3d: false, title: 'company earnings' }; var chart = new google.charts.bar( document.getelementbyid('chart_div')); chart.draw(data, google.charts.bar.convertoptions(options)); } </script> <div id="chart_div"></div> </body> </html>
here result (i added years in paint):
any ideas how this?
i remembered seeing following post sometime lets add multiple x-axis details. perhaps help:
http://www.lornajane.net/posts/2011/adding-multiple-axis-labels-to-a-google-chart
Comments
Post a Comment