用于highcharts热图的php绘图系列
以上是我的php mysql响应 对于highchart,热图月份在x轴上绘制,状态在y轴上绘制 我有一个问题,如何映射热图系列的值。 参见热图系列绘图,如[[0,0,10],[0,1,29]]等。。。。 请参阅下面的链接用于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绘制序列。尝试以下示例代码:
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);