Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于highcharts热图的php绘图系列_Php_Mysql - Fatal编程技术网

用于highcharts热图的php绘图系列

用于highcharts热图的php绘图系列,php,mysql,Php,Mysql,以上是我的php mysql响应 对于highchart,热图月份在x轴上绘制,状态在y轴上绘制 我有一个问题,如何映射热图系列的值。 参见热图系列绘图,如[[0,0,10],[0,1,29]]等。。。。 请参阅下面的链接 我必须使用php绘制序列。尝试以下示例代码: Array ( [0] => Array ( [month] => oct [value] => 10 [stat

以上是我的php mysql响应

对于highchart,热图月份在x轴上绘制,状态在y轴上绘制

我有一个问题,如何映射热图系列的值。 参见热图系列绘图,如[[0,0,10],[0,1,29]]等。。。。 请参阅下面的链接


我必须使用php绘制序列。

尝试以下示例代码:

Array
(
    [0] => Array
        (
            [month] => oct
            [value] => 10
            [state] => MU
        )

    [1] => Array
        (
            [month] => nov
            [value] => 29
            [state] => MU
        )

    [2] => Array
        (
            [month] => oct
            [value] => 88
            [state] => DL
        )

    [3] => Array
        (
            [month] => nov
            [value] => 67
            [state] => DL
        )

    )

<?php
$states = ['DL','BL','MU','OU'];
$data_array = [['month' => 'oct', 'value' => 10, 'state' => 'MU'],['month' => 'jan', 'value' => 12, 'state' => 'OU']];

$graph_array = [];
foreach ($data_array as $data){
    $state = array_search($data['state'], $states);
    $month = date('n',strtotime($data['month']));
    $graph_array[] = [$state,$month,$data['value']];
}

print_r($graph_array);