【发布时间】:2016-05-09 13:54:33
【问题描述】:
我正在尝试使用 Highcharts 创建热图,但加载不正确(只是线条而不是热图本身)。
我正在从JSON 文件加载数据:
chart: {
type: 'heatmap',
marginTop: 40,
marginBottom: 80,
plotBorderWidth: 1
},
xAxis: {
categories: $scope.loadDays()
},
yAxis: {
categories: $scope.loadHours(),
title: null,
reversed: true
},
series: [{
name: null,
borderWidth: 1,
data: [],
dataLabels: {
enabled: true,
color: '#000000'
}
}]
$scope.getHeatMapData = function(data) {
var response = [];
$scope.data = data;
if(data && $scope.data.timestamps && $scope.data.info) {
$scope.data.timestamps.forEach(function(element, index) {
if ($scope.data.info[index]) {
response.push([
moment(element).day(),
moment(element).hour(),
$scope.data.info[index]
]);
}
});
}
return response;
};
数据已正确记录到控制台,但由于某种原因,热图未加载。
我还创建了一个Plunker,您可以在其中查看其行为。
有什么想法吗?
【问题讨论】:
标签: javascript angularjs highcharts heatmap