大约有20%的时间我用这个ZingChart加载一个页面,当我鼠标悬停或点击我的馅饼ZingChart上的一个节点时,我收到以下错误:
VM57:1 Uncaught TypeError: Cannot read property 'FA' of undefined
at HTMLAreaElement.m.YS (eval at <anonymous> (http://cdn.zingchart.com/zingchart.min.js:8:1), <anonymous>:1:439813)
at HTMLDocument.d (eval at <anonymous> (http://cdn.zingchart.com/zingchart.min.js:8:1), <anonymous>:1:89798)
在缩小的js chrome调试器中突出显示以下行:
t(p[0]-v,p[1]-u);if(r&&m.E["node-target-id"]&&m.E["node-target-id"]!==r.id){return}}if(ZC.N.R2(q.target).indexOf("zc-node-area")===-1){return}if(m.L1!=="ready"){return}if(ZC.mobile){m.A.N6(q)}var n=b(q);var o=m.AY.A
其他时候它会表现得像预期的那样。刷新页面通常(但不是每次)看到问题消失。我希望这是我实施的一个问题。
图表:
$scope.SalesChartData = {
type: "pie",
id: 'chart_1',
title: {
textAlign: 'center',
text: "Loading..."
},
"legend":{
"border-width":1,
"border-color":"gray",
"border-radius":"5px",
"marker":{
"type":"circle"
},
"toggle-action":"remove",
"icon":{
"line-color":"#9999ff"
}
},
"plot": {
"animation":{
"on-legend-toggle": true,
"effect": 5,
"method": 1,
"sequence": 1,
"speed": 0.7
},
"value-box": {
"text": "$%v",
"negation": "currency",
"thousands-separator": ",",
"font-color": "black",
"placement":"in",
"offset-r":"50%",
"font-size":"12"
},
"tooltip":{
"text":"%t: $%v (%npv%)",
"thousands-separator":","
},
"decimals": "0",
"detach": false
},
series: [],
shapes: [{
type: 'triangle',
backgroundColor: '#66ccff',
size: 10,
angle: -90,
x: 20,
y: 20,
cursor: 'hand',
id: 'backwards'
}]
};
初始化数据并显示:
dataService.getRevenueByRegion($scope.yr,$scope.mnth).success(function(data) {
for (var i = 0; i < data.length; i++) {
$scope.SalesData.push({Revenue: [data[i].Revenue], Region: [data[i].Region], GP: [data[i].GP], Picks: [data[i].Picks], LocalBuyin: [data[i].LocalBuyin], detail: []});
}
displayRevenueByRegion();
});
displayRevenueByRegion:
function displayRevenueByRegion(){
$scope.SalesChartData.title.text="Revenue by Branch";
$scope.SalesChartData.series=[];
for (var i = 0; i < $scope.SalesData.length; i++) {
$scope.SalesChartData.series.push({values: $scope.SalesData[i].Revenue, text: $scope.SalesData[i].Region, GP: $scope.SalesData[i].GP, Picks: $scope.SalesData[i].Picks, LocalBuyin: $scope.SalesData[i].LocalBuyin});
}
zingchart.exec('chart_1', 'destroy');
zingchart.render({
id : 'chart_1',
data : $scope.SalesChartData
});
zingchart.exec('chart_1', 'update');
}