Home > front end >  Questions about rendering echarts charts in vue
Questions about rendering echarts charts in vue

Time:09-22

About rendering echarts charts in vue: I would like to request access to data from the data again after to render () with data but the chart is empty
Excuse me: render the chart function drowEchart () for the on which or the request data initialization function getData () for the in where?


I render every chart data is empty



CodePudding user response:

To get the data function is the delay, you put the rendering echat function in access to data in the callback function

This, getData (). Then (res=& gt; Enclosing drowEchart ())

CodePudding user response:

Why no error and no data chart didn't render out

CodePudding user response:

Your getData is network request, the request data in the getData successfully and for the corresponding variable assignment, call drowEchart again

CodePudding user response:

Is the network request you mean in the getData call drowEchart?

CodePudding user response:

The getData method request callback calls drowEchart success

CodePudding user response:

 
$. Ajax ({
Url: 'http://www.',
Type: "post",
DataType: 'json,
ContentType: 'application/json,
Async: true,
Data: JSON. Stringify ({
}),
Success: the function (data) {
The console. The log (data)
Var data1=[]
Var data2=[]
for(var i=0; iData1 [I]=data. The list [I] name
Data2 [I]=data. The list [I] weight
}
MyChart. SetOption ({
XAxis: {
Data: data1
},
Series: [{
//according to the name corresponding to the corresponding series
Name: 'recycled'
Data: data2
}]
});
}

});

CodePudding user response:

My idea is just a request to get behind several graphing data sources are from the data () to get it without a request a render every chart
But because I have a different chart rendering data is that a request to the inside can't don't know this

CodePudding user response:

refer to 7th floor DX wang ni... play altman reply:
my idea is just a request to get behind multiple graphing data sources are from the data () to get it without a request a render every chart
But because I have a different chart rendering data is that a request to come in don't know this can

B: yes, you can
After you look at the code, but is requests the refresh data only

CodePudding user response:

Hello I want to use you then render other chart data in data1 and data2 how to operate
  • Related