You can do this in one of two ways. Either you can set the number of
gridlines to be what you want, like so:
var options = {
  title: 'Income Of This Month',
  hAxis: {
    title: 'Days',
    gridlines: {
      count: 30
    }
  },
  vAxis: {title: 'Income'},
};

Or, you could use the explicit ticks option, and tell the chart exactly
where you want the ticks, like so:
var options = {
  title: 'Income Of This Month',
  hAxis: {
    title: 'Days',
    ticks: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
  },
  vAxis: {title: 'Income'},
};

Keep in mind that if your chart width isn't large enough, you won't see all
your tick labels simply because there isn't enough room to render them all.

- Sergey


On Sat, Jan 25, 2014 at 6:43 AM, Huzaifa Arain <[email protected]>wrote:

>
>
> Q : i want to show every day of month on h-axis but currently it showing 2
> , 6 , 9 so on till 30. Please check the code.
>
>
>
>  <!--Load the AJAX API-->
>     <script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
>     <script type="text/javascript">
>      var data;
>      var chart;
>
>       // Load the Visualization API and the piechart package.
>       google.load('visualization', '1', {'packages':['corechart']});
>
>       // Set a callback to run when the Google Visualization API is loaded.
>       google.setOnLoadCallback(drawChart);
>
>       // Callback that creates and populates a data table,
>       // instantiates the pie chart, passes in the data and
>       // draws it.
>       function drawChart() {
>
>        //  Create our data table.
>         data = new google.visualization.DataTable();
>         data.addColumn('number', 'Date');
>         data.addColumn('number', 'Income');
>         // console.log(Math.random(10000));
>
>         for(var a = 1 ; a <= 30 ; a++)
>         {
>            data.addRow([a,Math.floor((Math.random()*50000))]);
>         }
>
>
>         // Set chart options
>        var options = {
>           title: 'Income Of This Month',
>           hAxis: {title: 'Days' },
>           vAxis: {title: 'Income'},
>
>         };
>
>
>         // Instantiate and draw our chart, passing in some options.
>         chart = new
> google.visualization.AreaChart(document.getElementById('chart_div'));
>         // google.visualization.events.addListener(chart, 'select',
> selectHandler);
>         chart.draw(data, options);
>       }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to