Multiple Line Graph

Skip to first unread message

André Esterhuizen

Mar 22, 2023, 12:05:46 PM3/22/23
Hi  Im using the Line chart and had look at this example

what I need to do is to make the x-axis the current year

Y axis 0-300

I want to display current year with dates and marks in blue
Then the previous year date and mark in red

The dates from current and previous year is about the same month but the actual date is diffrent

Attached is a image i created in PAINt what i want to accomplish
Hope it helps


André Esterhuizen

Mar 22, 2023, 12:16:05 PM3/22/23
This is what i tried but dont work

var data = new google.visualization.DataTable();
      data.addColumn('date', 'Month');
      data.addColumn('number', "Score -<?php echo $cyear;?>");
      data.addColumn('date', 'Month');
      data.addColumn('number', "Score -<?php echo $pyear;?>");
     // data.addColumn('number', "Average Hours of Daylight");

     // data.addRows([<?php echo $admin->get_score_graph($data['data']['id']);?>]);

[new Date(2014, 0),  -.5,new Date(2015, 0),  5.7],
        [new Date(2014, 1),   .4,new Date(2015, 0),  8.7],
        [new Date(2014, 2),   .5,new Date(2015, 0),   12],
        [new Date(2014, 3),  2.9,new Date(2015, 0), 15.3],
        [new Date(2014, 4),  6.3,new Date(2015, 0), 18.6],
        [new Date(2014, 5),    9,new Date(2015, 0), 20.9],
        [new Date(2014, 6), 10.6,new Date(2015, 0), 19.8],
        [new Date(2014, 7), 10.3,new Date(2015, 0), 16.6],
        [new Date(2014, 8),  7.4,new Date(2015, 0), 13.3],
        [new Date(2014, 9),  4.4,new Date(2015, 0),  9.9],
        [new Date(2014, 10), 1.1,new Date(2015, 0),  6.6],
        [new Date(2014, 11), -.2,new Date(2015, 0),  4.5]

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
To view this discussion on the web visit

Arthur Hebert

Apr 22, 2023, 9:06:04 PM4/22/23
to Google Visualization API
You didn't make it clear if you looked at the 'Code it yourself on JSFiddle' link in the help file. 

Your rows aren't going in the data table because addRows is commented out. Studying the complete code given in the JSFiddle link should help. 

Reply all
Reply to author
0 new messages