Hi, 

I am trying to get the line chart to plot duplicate dates along the x-axis 
but all the 11 April points are plotted in one line, instead of spread 
frequency on the x-axis.  I have added dateFormatter but I am not sure 
where I may be going wrong.  

This is what I currently have:
    function drawVisualization(dataValues, chartTitle, columnNames, 
categoryCaption) {
        if (dataValues.length < 1)
            return;

        var data = new google.visualization.DataTable();
        data.addColumn('string', columnNames.split(',')[0]);
        data.addColumn('number', columnNames.split(',')[1]);
        data.addColumn('string', columnNames.split(',')[2]);
        data.addColumn('datetime', columnNames.split(',')[3]);
        data.addColumn('number', columnNames.split(',')[4]);

        for (var i = 0; i < dataValues.length; i++) {
            var date = new Date(parseInt(dataValues[i].Date.substr(6), 10));

            data.addRow([dataValues[i].ColumnName, dataValues[i].Value, 
dataValues[i].Type, date, dataValues[i].ID]);
        }

        // Define a Pie chart
        var pie = new google.visualization.ChartWrapper({
            'chartType': 'LineChart',
            'containerId': 'PieChartContainer',
            'options': {
                'width': 950,
                'height': 450,
                'legend': 'right',
                'hAxis': {
                 'format': "dd-MMM-yyyy",
   'hAxis.maxValue' : 'viewWindow.max',
                 'maxValue': new Date (2014, 04, 17), 'minValue': new Date 
(2014, 03, 20), 
                 'viewWindow':{'max': new Date (2014, 04, 17)},
                },
                'title': chartTitle,
                'chartArea': { 'left': 100, 'top': 100, 'right': 0, 
'bottom': 100 },
                'tooltip': { isHtml: true }
            },
            'view': {
                'columns': [3, 1, {
                    type: 'string',
                    role: 'tooltip',
                    calc: function (dt, row) {
                        return 'Name: ' + dt.getValue(row, 0) + ', Decimal 
Price: ' + +dt.getValue(row, 1) + ', Date: ' + +dt.getFormattedValue(row, 
3);
                    }
                }]
            }
        });

        var dateFormatter = new google.visualization.DateFormat({pattern: 
'dd MM yyyy'});
        var view = new google.visualization.DataView(data);
        view.setColumns([{
        type: 'string',
        label: data.getColumnLabel(3),
        calc: function (dt, row) {
         return dateFormatter.formatValue(dt.getValue(row, 3));
    }
}, 1]);

        new 
google.visualization.Dashboard(document.getElementById('PieChartExample')).bind([categoryPicker,
 
stringFilter], [pie]).draw(data);
    }

And this the output I am getting:

<https://lh5.googleusercontent.com/-1qK8hNE1rns/U0v6ptzPqKI/AAAAAAAAAQA/UyibP9vFnwA/s1600/april_duplicate_date.png>


Could anyone please advice any feedback.  Many thanks. 

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