5
这是主要部分了,直接复制就可以了
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
var option = {
tooltip: {
show: true
},
legend: {
data: ['销量']
},
xAxis: [
{
type: 'category',
data: (function(){
var arr=[];
$.ajax({
type : "post",
async : false, //同步执行
url : "/test_ssh/app/getAllecharts",
data : {},
dataType : "json", //返回数据形式为json
success : function(json) {
if (json) {
for(var i=0;i
console.log(json[i].context);
arr.push(json[i].user.app_name);
}
}
},
error : function(errorMsg) {
alert("不好意思,图表请求数据失败啦