2

这是我的 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文件都包含一次。

这是错误:

在此处输入图像描述

4

0 回答 0