<https://lh4.googleusercontent.com/-id8abOyHQ2Y/U2pPNzQSEaI/AAAAAAAAAQc/LABeonEm4nQ/s1600/april_duplicate_date.png>

This is what my current output looks like with the current code above.  Can 
someone please, provide any guide into how can i change the distribution of 
the data points on the x-axis. 

Many thanks. 

On Wednesday, May 7, 2014 4:04:02 PM UTC+1, Missy wrote:
>
> I am using data points which all have the same date for the column [1] and 
> I would like the line chart to spread out the points for the duplicate 
> dates instead of showing one straight line on the line chart.  
>
> I have also added a dateFormatter which converts the date to string and 
> then aims to show them on the x-axis as discretely.  However, I am little 
> unsure, why is this not impacting the result. 
>
> Here is my current code:
>
>        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]);
>
>             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]);
>             }
>
>             var line = new google.visualization.ChartWrapper({
>                 'chartType': 'LineChart',
>                 'containerId': 'PieChartContainer',
>                 'options': {
>                     'width': 950,
>                     'height': 450,
>                     'legend': 'right',
>                     'hAxis': {
>                         'format': "dd-MM-yyyy",
>                         'hAxis.maxValue': 'viewWindow.max',
>                         'maxValue': new Date(2014, 05, 30), 'minValue': 
> new Date(2014, 04, 05),
>                         'viewWindow': { 'max': new Date(2014, 05, 30) },
>                     },
>                     '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) {
>                     var date = new Date(parseInt(dt.getValue(row, 3)));
>                     return dateFormatter.formatValue(date);
>                 }
>             }, 1]);
>
>             new 
> google.visualization.Dashboard(document.getElementById('LineChartExample')).bind([categoryPicker],
>  
> [line]).draw(data);
>         }
>
> Please advice, Many thanks for your time and help. 
>

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