"> "> "> "> -6ren">
gpt4 book ai didi

jquery - Highcharts 给我黑色图像

转载 作者:行者123 更新时间:2023-12-01 06:32:52 25 4
gpt4 key购买 nike

我使用 Highcharts 库开发图表,一开始工作得很好,但当我回来运行应用程序时,我发现所有图表都是黑色图像,我不知道为什么?

我的jsp:

<html>
<head>
<script src="<c:url value='/assets/js/jquery.js' />"></script>
<script src="<c:url value='/assets/js/highstock.js' />"></script>
<script src="<c:url value='/assets/js/highcharts.js' />"></script>
<script src="<c:url value='/assets/js/highmaps.js' />"></script>
<script src="<c:url value='/assets/js/exporting.js' />"></script>
<script src="http://highcharts.github.io/export-csv/export-csv.js">
</head>
<body>
<div id="impressionChart" style="height: 400px"></div>

<script type="text/javascript">
var campaignId = $('#campaignId').val();
var processed_json = [];
var parsedJson;
var myArray = [];
var url = "/ADVoice/advertiser/campaign/performance/campaignImpression/"
+ campaignId;
$
.ajax({
url : url,
datatype : "json",
type : "GET",
async : false,
success : function(data) {
// alert(data);
parsedJson = JSON.stringify(data);
alert(parsedJson);
var jsonArray = JSON.parse(parsedJson);
// alert(jsonArray['campaign_data'].length);
for (i = 0; i < jsonArray['campaign_data'].length; i++) {
myArray[i] = [];
myArray[i][0] = Date
.parse(jsonArray['campaign_data'][i].key);
myArray[i][1] = parseInt(jsonArray['campaign_data'][i].value);

}
// alert(myArray);
},
error : function() {
alert("error");
}
});
// draw chart
Highcharts.setOptions({
global : {
useUTC : false
}
});
$('#impressionChart').highcharts({
chart : {
type : "column"
},
title : {
text : "Campaign Impression"
},
xAxis : {
type : 'datetime',
labels : {
formatter : function() {
return Highcharts.dateFormat('%a %d %b', this.value);
}
}
},
yAxis : {
title : {
text : "Number of impressions"
}
},
series : [ {
name : "No.Impressions:",
data : myArray,
pointStart : Date.parse(myArray[0][0])
// pointInterval: 24 * 3600 * 1000 // one day
} ],
exporting : {
csv : {
dateFormat : '%Y-%m-%d'
}
}
});
</script>
</body>
</html>

最佳答案

我在使用 Highcharts-6.1.0 时遇到了这个问题。

解决方案:-

  1. 而不是从导入js

    src="Scripts/Highcharts-6.1.0/code/js/highcharts-3d.js"

    导入自

    src="Scripts/Highcharts-6.1.0/code/highcharts-3d.js"**
  2. 对于模块(exporting-js 和export-data.js)来说

    src="Scripts/Highcharts-6.1.0/code/modules/highcharts-3d.js"

关于jquery - Highcharts 给我黑色图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40567298/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com