You are missing the "new" keyword:

var dateformatter = new google.visualization.DateFormat({ pattern: 
"MMM,yyyy" });

Also, this will only format the data in your tooltips.  If you want your 
axis values formatted this way as well, you will need to use the 
hAxis.format option:

hAxis: {
    format: 'MMM,yyyy'
}

On Tuesday, September 23, 2014 3:44:51 AM UTC-4, Shivani Kanakhara wrote:
>
> I am generating column chart passing the following data.
> I want the dates to be formatted as MMM,yyyy i.e. i do not want day to be 
> displayed.
> I tried using dateformatter but it does not work. I get an error like 
> undefined function.
> google.setOnLoadCallback(drawChart);
> function drawChart() {
>
>   var data = google.visualization.arrayToDataTable([
>     ['Year', 'Sales', 'Expenses'],
>     [new Date(2314, 2, 15),  1000,      400],
>     [new Date(2314, 3, 16),  1170,      460],
>     [new Date(2314, 4, 17),  660,       1120],
>     [new Date(2314, 5, 18),  1030,      540]
>   ]);
>
>                var dateformatter = google.visualization.DateFormat({ 
> pattern: "MMM d, ''yy" });
>                 formatter.format(data, 0);
>     
>      var chart = new google.visualization.ChartWrapper({
>                 chartType: 'ColumnChart',
>                 containerId: 'chart_div',
>                 dataTable: data,
>                 options: {
>                     'title': 'CustomerSalesData',
>                     'chartOptions': {
>                         'hAxis': { 'title': 'Year', 'titleTextStyle': { 
> color: 'red' }, 'slantedText': true },
>                         'vAxis': { gridlines: { 'color': 'gray', 'count': 
> 20} },
>                         'chartArea': {
>                             'top': 70,
>                             'left': '5%',
>                             'height': 550,
>                             'width': '65%'
>                         }
>                     }
>                 }
>             });
>  
>     
>    
>   chart.draw();
>
> }
>
>
>
>
>
>
>
>
>

-- 
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