Bootstrap

ajax echart mysql饼图_Echarts通过Ajax动态获取后端数据(饼状图,柱状图)

ajax动态赋值echarts饼图

Document

.html {

width: 100%;

height: 100%;

overflow: hidden;

}

.box {

width: 100%;

height: 100%;

}

#main1 {

width: 600px;

height: 500px;

float: left;

}

#main2 {

width: 50%;

height: 50%;

float: left;

}

var main1 = echarts.init(document.getElementById('main1'));

var names = [];

var mydate = [];

$.ajax({

method: 'get',

url: './list.json',

dataType: 'json',

success: function (result) {

for (var i = 0; i < result.date.length; i++) {

// console.log(result.date.length)

// console.log(result.date[i].name)

names.push(result.date[i].name);

console.

;