Highcharts,如何使用额外数据将序列数组转换为哈希?

Highcharts,如何使用额外数据将序列数组转换为哈希?,highcharts,Highcharts,我继承了别人已经写过的图表。现在,我想向要在工具提示中显示的序列添加额外数据 原始代码使用数组或数组进行设置,以构建系列数据,如下所示: $data['series'][$nextindex]['data'][] = array(strtotime($date) * 1000, $budgetSum); 当我转储阵列时,输出如下: [ { "name": "Adjusted Budget", "color": "#7570B3", "da

我继承了别人已经写过的图表。现在,我想向要在工具提示中显示的序列添加额外数据

原始代码使用数组或数组进行设置,以构建系列数据,如下所示:

$data['series'][$nextindex]['data'][] = array(strtotime($date) * 1000, $budgetSum);
当我转储阵列时,输出如下:

[
    {
        "name": "Adjusted Budget",
        "color": "#7570B3",
        "data": [
            [
                1486454400000,
                0
            ],
            [
                1493622000000,
                2200
            ],
            [
                1494226800000,
                3700
            ],
....
我知道要添加额外数据,需要将其格式化为哈希/对象:

[
  {x: 1486454400000, y: 0, myData: test1},
  {x: 1493622000000, y: 2200, myData: test2},
  {x: 1494226800000, y: 3700, myData: test3},
  .....
]
我只是不知道如何转换。。。 我试过这样的方法(但没有成功):


没关系,我想得太多了。 我用它工作:

$myArr = array('x' => strtotime($date) * 1000, 'y' => $budgetSum, 'myData' => 'test1');
$data['series'][$nextindex]['data'][] = $myArr;
无需使用json_encode()

$myArr = array('x' => strtotime($date) * 1000, 'y' => $budgetSum, 'myData' => 'test1');
$data['series'][$nextindex]['data'][] = $myArr;