gpt4 book ai didi

javascript - HighCharts 没有显示任何内容

转载 作者:行者123 更新时间:2023-11-28 08:30:05 25 4
gpt4 key购买 nike

我按照给出的示例进行操作,但是每当我添加新的数据标签时,它都不会显示为切片。现在,我添加了想要显示的所有值和数据,但浏览器上没有显示任何内容。

有人可以推荐什么吗?

http://jsfiddle.net/LLExL/2466/

<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
$(function () {

// Radialize the colors
Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function(color) {
return {
radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
stops: [
[0, color],
[1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
]
};
});

// Build the chart
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Risk Mitigation'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
}
}
}
},
series: [{
type: 'pie',
name: 'Industry Distribution',
data: [
['Retail', 8.8],
['Construction', 8.4],
{
name: 'Technology',
y: 9.7,
sliced: true,
selected: true
},
['Finance', 8.4],
['Automotive', 8.3],
['Restaurant', 8.3]
['Energy', 7.8]
['Medical', 7.0]
['Marketing', 7.0]
['Manufacturing', 6.9]
['Food Distribution', 6.5]
['Gym / Salons', 4.6]
['Home Services', 4.4]
['Travel', 2.5]
['Other Industries', 1.4]
]
}]
});
});


</script>
</head>
<body>
<script src="../../js/highcharts.js"></script>
<script src="../../js/modules/exporting.js"></script>

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

</body>
</html>

最佳答案

一开始我建议熟悉控制台错误(开发人员工具),然后你会注意到你的语法不正确。您错过了系列->数据对象中行尾的逗号。正确的形式

series: [{
type: 'pie',
name: 'Industry Distribution',
data: [
['Retail', 8.8],
['Construction', 8.4],
{
name: 'Technology',
y: 9.7,
sliced: true,
selected: true
},
['Finance', 8.4],
['Automotive', 8.3],
['Restaurant', 8.3],
['Energy', 7.8],
['Medical', 7.0],
['Marketing', 7.0],
['Manufacturing', 6.9],
['Food Distribution', 6.5],
['Gym / Salons', 4.6],
['Home Services', 4.4],
['Travel', 2.5],
['Other Industries', 1.4]
]
}]

http://jsfiddle.net/LLExL/2468/

关于javascript - HighCharts 没有显示任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21978370/

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