1

This is simplified version of my chart:

<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 jsonData = '{"cols":[{"id":"","label":"date","type":"string"},{"id":"","label":"a","type":"number"},{"id":"","label":"b","type":"number"}],"rows":[{"c":[{"v":"2012-05-01"},{"v":"1"},{"v":"8"}]},{"c":[{"v":"2012-05-02"},{"v":"1"},{"v":"7"}]},{"c":[{"v":"2012-05-03"},{"v":"1"},{"v":"38"}]}]}';

                    var data = new google.visualization.DataTable(jsonData);    
                    var options = {
                        title       : 'Company Performance',
                        pointSize   : 5,
                        chartArea: {width: 800, height: 800},
                        width: 800+300, height: 800+600,
                        legend:{position: 'bottom',maxLines: 3},
                        vAxis:  {direction:-1, minValue: 1, viewWindowMode: 'explicit', viewWindow:{min:1}},
                        colors      : ['#0E9DFF','#9616F3']
                    };

                var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
                chart.draw(data, options);
              }
        </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

My aim is to set minimum value of vAxis to 0.
It works, but how to make it to be shown?
And how to move the horizontal axis to the bottom?

lvil
  • 4,326
  • 9
  • 48
  • 76
  • 1
    I'm probably missing what you want your chart to look like, but if I change the vAxis to `vAxis: {direction:-1, minValue: 0, viewWindowMode: 'explicit', viewWindow:{min:0}}` it will show the 0 tick and line. In your case you're telling Google Charts that the minimum value is 1, so the chart doesn't contain a 0 (and hence it doesn't show that label). – Frank van Puffelen Dec 09 '12 at 13:07
  • @Frank van Puffelen: I want the vAxis to begin with 1, not with 0. I mean, I want "1" tick and line to be shown, and 0 hidden as it is below my minimum value – lvil Dec 09 '12 at 13:08
  • Hope this can help you. [http://stackoverflow.com/questions/6359935/setting-a-hard-minimum-axis-value-in-google-charts-api][1] [1]: http://stackoverflow.com/questions/6359935/setting-a-hard-minimum-axis-value-in-google-charts-api – Dade Jan 28 '15 at 15:31

0 Answers0