我需要这张热图图表的帮助
$(document).ready(function(){
var grf_heatmap = {
chart: {
type: 'heatmap',
renderTo:'map',
height: 600,
marginTop: 40,
marginBottom: 40
},
title: {
text: 'heatmap'
},
xAxis: {
categories: []
},
yAxis: {
categories: []
},
colorAxis: {
min: 0,
minColor: '#FFFFFF',
maxColor: '#990041'
},
legend: {
align: 'right',
layout: 'vertical',
margin: 0,
verticalAlign: 'top',
y: 25,
symbolHeight: 320
},
series: [{
turboThreshold:0,
borderWidth: 1,
point: {
events: {
click: function(e) {
//this.slice();
//console.log(e);
location.href = e.point.options.url;
e.preventDefault();
}
}
},
data:[],
dataLabels: {
enabled: true,
color: 'black',
style: {
textShadow: 'none',
HcTextStroke: null
}
}
}]}
$.getJSON("data.php", function(json) {
grf_heatmap.yAxis.categories = json[0]['data'];
grf_heatmap.xAxis.categories = json[2]['data'];
grf_heatmap.series[0].data = json[1]['data'];
chart = new Highcharts.Chart(grf_heatmap);
});
})
data.php像这样重新调整json
[{"name":"EjeY",
"data":["NameA"]},
{"name":"datos",
"data":["{x:0,y:0,value:1,url:'test.php'}",
"{x:1,y:0,value:3,url:'test.php'}"]},
{"name":"EjeX",
"data":["1","2"]}
]
但结果是空白图表。
我做错了什么?, 如果我只使用json用于xAxis和yAxis类别并使用此数据完成图表data[{x:0,y:0,value:1,url:'test.php'},{x:1,y:0,value:3,url:'test.php'}],
它有效
坦克,