The reason you see repeating months in the x-axis is because the axis is 
actually displaying multiple days per month, formatted as "yyyy-MM".  You 
can change the locations of tick marks by specifying the hAxis.ticks 
option, eg:

hAxis: {
    title: "X",
    titleTextStyle: {color: "green"},
    format: 'yyyy-MM',
    ticks: [new Date(2014, 5, 1), new Date(2014, 6, 1)]
}

On Tuesday, June 24, 2014 10:44:59 AM UTC-4, min ji wrote:
>
> hello everyone,
> I want to create a scatter chat . I have a set of monthly data. In the 
> hAxis, I just want to show the date with the format yyyy-mm. I write the 
> code below but i get chart strange (in the hAxis, one month will be shown 
> several times. I just want one month to be shown once ).
> Who knows how to do it?
> Thank you in advance.
>
> function drawVisualization() {
>     // Create and populate the data table.
>     var data = new google.visualization.DataTable();
>   
>      var data = google.visualization.arrayToDataTable([
>           ['Age', 'Weight'],
>           [ new Date("2014","05","02"),      12],
>          [ new Date("2014","06","02"),      12]
>         ]);
>    
>   
>     // Create and draw the visualization.
>     var chart = new google.visualization.ScatterChart(
>         document.getElementById('visualization'));
>     chart.draw(data, {title: 'Cool shapes',
>                       width: 600, height: 400,
>                       vAxis: {title: "Y", titleTextStyle: {color: "green"}
> },
>                       hAxis: {title: "X", titleTextStyle: {color: "green"}
> , format: 'yyyy-MM'}}
>               );
> }
> ​
>

-- 
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/d/optout.

Reply via email to