Hello all,

I'm brand new to google charts so forgive me if I'm approaching this all 
wrong.

I've got some data that I'm trying to plot, which is in Day and Time format 
(for example: 'Thursday', '12:42:00'). I've converted the time format to a 
timeofday array, but I'm leaving the day in string format.

What I'm trying to do is collect and display all points on a scatter plot 
for the time of day associated with the day. Something like this:

<https://lh3.googleusercontent.com/-On7c0mwlq74/WpNxPkyPCII/AAAAAAAAGEU/x6YPTp-zfosPOi0EvrZu0RG_30FmvU5_ACLcBGAs/s1600/good-bins.png>


However, I can only get this result if I use a number for Day. If I try to 
plot with strings, I get this:

<https://lh3.googleusercontent.com/-8nLEhd8U6eo/WpNxhOnzCOI/AAAAAAAAGEY/ZPPI5--rTSEVw--QNITp5kbllZYrdRBgwCLcBGAs/s1600/bad-bins.png>


As you can see, the x labels are not aggregated. Here is my code - any help 
is appreciated. Thanks!


google.charts.load('current', {'packages':['scatter']});
google.charts.setOnLoadCallback(drawChart);


function drawChart () {
    var data = new google.visualization.DataTable();
    data.addColumn('number', 'Day');
    data.addColumn('timeofday', 'Time of Day');

    // S=1, M=2, T=3, W=4, T=5, F=6, S=7
    // This works, but no labels...
    /*
    data.addRows([
          [3, [0, 45, 0]],
          [3, [11, 45, 0]],
          [6, [21, 45, 0]],
          [3, [12, 40, 0]],
          [6, [11, 25, 0]],
          [6, [10, 25, 0]],
          [2, [11, 15, 0]]
        ]);
    */

    // This doesn't work
    data.addRows([
          ['Tuesday', [0, 45, 0]],
          ['Tuesday', [11, 45, 0]],
          ['Friday', [21, 45, 0]],
          ['Tuesday', [12, 40, 0]],
          ['Friday', [11, 25, 0]],
          ['Friday', [10, 25, 0]],
          ['Monday', [11, 15, 0]]
        ]);

    var options = {
       width: 800,
       height: 500,
       selectionMode: 'multiple',
       aggregationTarget: 'category',
       chart: {title: 'Timeline'},
       axes: {x: {0: {side: 'bottom'}}}
    };

    var chart = new google.charts.Scatter(document.getElementById(
'scatter_top_x'));
    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 https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/7f9f32a1-73ed-4c54-8e28-c782b292f7ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to