0

我正在为我的网页绘制一个图表,我从这个视频中学到了 https://youtu.be/qYkkyOzR9jc 我正在尝试为我的图表添加标签,但它不起作用并且使我的图表错误这是我的 HTML代码

<html>
<head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>

<script src="JS/dx.chartjs.js"> </script>

<script type="text/javascript"  src="http://cdn3.devexpress.com/jslib/13.1.7/js/dx.chartjs.js"> </script>


<script type="text/javascript" src="JS/PieChart.js"></script>


</head>
<body>

    <div id="chartContainer" style="border: 1px solid red; "></div>

</body>
</html>

这是我的 JavaScript 代码

$(document).ready(function(){

    var dataSource = [
        { country: "Russia", area: 1707540},
        { country: "Canada", area: 998467},
        { country: "USA", area: 937261},
        { country: "China", area: 959696},
        { country: "Brazil", area: 854700},
        { country: "Australia", area: 768685},
        { country: "India", area: 328759},
        { country: "Others", area: 554545}
    ];

    $("#chartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: "country",
            valueField: "area",
            label: {
                visible: true,
                connector: {visible: true}
            }

        }
    });

})

这是我没有标签的图表 在此处输入图像描述

这是我添加标签元素后的错误图表 在此处输入图像描述

4

1 回答 1

0

正如 lispHK01 所注意到的,您错过了对 globalize 库的引用。您的 html 文件应如下所示。

<html>
<head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>

<script src="http://ajax.aspnetcdn.com/ajax/globalize/0.1.1/globalize.min.js"></script>

<script type="text/javascript"  src="http://cdn3.devexpress.com/jslib/13.1.7/js/dx.chartjs.js"> </script>


<script type="text/javascript" src="JS/PieChart.js"></script>


</head>
<body>

    <div id="chartContainer" style="border: 1px solid red; "></div>

</body>
</html>
于 2015-05-28T15:03:57.363 回答