Data structures Google图表具有非均匀x轴值的折线图

Data structures Google图表具有非均匀x轴值的折线图,data-structures,charts,google-visualization,linechart,Data Structures,Charts,Google Visualization,Linechart,我需要制作一个谷歌折线图,让学生回答最多五个问题,值从1到100 折线图的y轴上应该有答案,x轴上应该有答案的时间和日期 学生同时回答所有问题 每个学生的答案应该有一行 同一个问题的行应该有相同的颜色-即,如果有三个学生,每种颜色应该有三行,每个学生一行 在PHP中,我的数据在解析为json字符串并加载到Google图表之前是这样的: $testtable = array( 'cols' => array( array('label' => 'Date', 'ty

我需要制作一个谷歌折线图,让学生回答最多五个问题,值从1到100

折线图的y轴上应该有答案,x轴上应该有答案的时间和日期

学生同时回答所有问题

每个学生的答案应该有一行

同一个问题的行应该有相同的颜色-即,如果有三个学生,每种颜色应该有三行,每个学生一行

在PHP中,我的数据在解析为json字符串并加载到Google图表之前是这样的:

$testtable = array(
   'cols' => array(
       array('label' => 'Date', 'type' => 'datetime'),
       array('label' => 'Student', 'type' => 'string', 'role' => 'tooltip'),
       array('label' => 'Answer1', 'type' => 'number'),
       array('label' => 'Answer2', 'type' => 'number'),
       array('label' => 'Answer3', 'type' => 'number'),
       array('label' => 'Answer4', 'type' => 'number'),
       array('label' => 'Answer5', 'type' => 'number')
   ),
    'rows' => array(
        array('c' => array(
            array('v' => 'Date(2014,3,4,17,3,17)'),
            array('v' => 'elev1'),
            array('v' => 15),
            array('v' => 36),
            array('v' => 87),
            array('v' => 10),
            array('v' => 22)
        )),
        array('c' => array(
            array('v' => 'Date(2014,3,4,13,56,22)'),
            array('v' => 'elev2'),
            array('v' => 11),
            array('v' => 66),
            array('v' => 87),
            array('v' => 23),
            array('v' => 27)
        )),
        array('c' => array(
            array('v' => 'Date(2014,3,5,10,27,31)'),
            array('v' => 'elev1'),
            array('v' => 43),
            array('v' => 11),
            array('v' => 33),
            array('v' => 64),
            array('v' => 88)
        )),
        array('c' => array(
            array('v' => 'Date(2014,3,5,12,22,53)'),
            array('v' => 'elev2'),
            array('v' => 22),
            array('v' => 34),
            array('v' => 62),
            array('v' => 32),
            array('v' => 5)
        )),
    )
);
以下是我的想法:

以下是我的图表当前的样子:


我很确定我的数据结构是错误的,但我无法找到正确的方法。如果有人能帮忙,我会非常高兴。

折线图每行需要一个数据系列,因此,如果您希望每个学生每个问题有一行,那么每个学生每个问题需要一个数据系列DataTable列。因此,如果您有3个学生和5个问题,则需要15个数据系列。使用颜色或系列..颜色选项为线条着色

'cols' => array(
    array('label' => 'Date', 'type' => 'datetime'),
    array('label' => 'Student1 Answer1', 'type' => 'number'),
    array('label' => 'Student1 Answer2', 'type' => 'number'),
    array('label' => 'Student1 Answer3', 'type' => 'number'),
    array('label' => 'Student1 Answer4', 'type' => 'number'),
    array('label' => 'Student1 Answer5', 'type' => 'number'),
    array('label' => 'Student2 Answer1', 'type' => 'number'),
    array('label' => 'Student2 Answer2', 'type' => 'number'),
    array('label' => 'Student2 Answer3', 'type' => 'number'),
    array('label' => 'Student2 Answer4', 'type' => 'number'),
    array('label' => 'Student2 Answer5', 'type' => 'number'),
    array('label' => 'Student3 Answer1', 'type' => 'number'),
    array('label' => 'Student3 Answer2', 'type' => 'number'),
    array('label' => 'Student3 Answer3', 'type' => 'number'),
    array('label' => 'Student3 Answer4', 'type' => 'number'),
    array('label' => 'Student3 Answer5', 'type' => 'number')
    // etc...
)