echarts数据可视化插件,就是用来统计数据的图
1.首先,下载并引入插件,文件结构如下所示
<script type="text/javascript" src="js/echarts/build/dist/echarts.js"></script>
<div class="index1_6" id="statisTypeStats">
<div class="index1_6_1">
<div style="height: 400px" id="typeStats"></div>
</div>
</div>
2.js处理
/**
* 问题类型比例分析
*/
function typeStats(){
var legendData = [], seriesData = [];
$.ajax({
type : 'post',
url: '/epsp/mvc/questionstatistics/typeStats.json',
dataType: 'json',
success: function(data){
if (data) {
$.each(data, function(k, v){
legendData.push(k);
seriesData.push({value: v.questionTotal, name: v.questionTypeName});
});
// 路径配置
require.config({
paths: {
echarts: '/epsp/resources/echarts/build/dist'
}
});
// 使用
require(
[
'echarts',
'echarts/chart/pie' // 使用柱状图就加载bar模块,按需加载
],
function (