在aspx页面做一个饼状图,用到的是amCharts,该如何实现?
1个回答
展开全部
<body scroll="no"> <div id="chartdiv" style="width: 100%; height: 362px;"></div>
<script type='text/javascript'>//<![CDATA[
var chart;var legend;
var chartData = [ { "country": "Czech Republic", "litres": 301.9 }, { "country": "Ireland", "litres": 201.1 }, { "country": "Germany", "litres": 165.8 }, { "country": "Australia", "litres": 139.9 }, { "country": "Austria", "litres": 128.3 }, { "country": "UK", "litres": 99 }, { "country": "Belgium", "litres": 60 }];
AmCharts.ready(function () { // PIE CHART chart = new AmCharts.AmPieChart(); chart.dataProvider = chartData; chart.titleField = "country"; chart.valueField = "litres"; chart.outlineColor = "#FFFFFF"; chart.outlineAlpha = 0.8; chart.outlineThickness = 2; chart.balloonText = "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>"; // WRITE chart.write("chartdiv");});//]]>
</script>
<script type='text/javascript'>//<![CDATA[
var chart;var legend;
var chartData = [ { "country": "Czech Republic", "litres": 301.9 }, { "country": "Ireland", "litres": 201.1 }, { "country": "Germany", "litres": 165.8 }, { "country": "Australia", "litres": 139.9 }, { "country": "Austria", "litres": 128.3 }, { "country": "UK", "litres": 99 }, { "country": "Belgium", "litres": 60 }];
AmCharts.ready(function () { // PIE CHART chart = new AmCharts.AmPieChart(); chart.dataProvider = chartData; chart.titleField = "country"; chart.valueField = "litres"; chart.outlineColor = "#FFFFFF"; chart.outlineAlpha = 0.8; chart.outlineThickness = 2; chart.balloonText = "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>"; // WRITE chart.write("chartdiv");});//]]>
</script>
更多追问追答
追问
这个还需要什么东西么?我复制过去没效果啊。
追答
你引用了js 吗
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询