以下是我的javascript文件:
<script src="Js/JqStuff/jquery-1.11.0.min.js"></script>
<script src="MetroJs.Full.0.9.75a/MetroJs.js"></script>
<script src="Js/JqStuff/jquery.jqGrid.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.11/jquery.mousewheel.min.js"></script>
<script src="Js/JqStuff/jquery-ui.js"></script>
<script src="Js/JqStuff/jquery.jqChart.min.js"></script>
<script src="Js/JqStuff/jquery.jqRangeSlider.min.js"></script>
<script src="testjs.js"></script>
在我的 test.js 中,我创建了一个创建图表的函数,但它会出错。
$(document).ready(function () {
var background = {
type: 'linearGradient',
x0: 0,
y0: 0,
x1: 0,
y1: 1,
colorStops: [{ offset: 0, color: '#d2e6c9' },
{ offset: 1, color: 'white' }]
};
$('#jqChart').jqChart({
title: { text: 'Pie Chart Labels' },
legend: { title: 'Countries' },
border: { strokeStyle: '#6ba851' },
background: background,
animation: { duration: 1 },
shadows: {
enabled: true
},
series: [
{
type: 'pie',
fillStyles: ['#418CF0', '#FCB441', '#E0400A', '#056492', '#BFBFBF', '#1A3B69', '#FFE382'],
labels: {
stringFormat: '%.1f%%',
valueType: 'percentage',
font: '15px sans-serif',
fillStyle: 'black'
},
explodedRadius: 10,
explodedSlices: [5],
data: [['United States', 65], ['United Kingdom', 58], ['Germany', 30],
['India', 60], ['Russia', 65], ['China', 75]],
labelsPosition: 'outside', // inside, outside
labelsAlign: 'circle', // circle, column
labelsExtend: 20,
leaderLineWidth: 1,
leaderLineStrokeStyle: 'black'
}
]
});
});
这是我的 HTML :
<div id="jqChart" style="width: 500px; height: 300px;"></div>
请指导我做错的事。我已经检查过所有 .js 文件都包含一次。
以下是错误: