keys and values are Dynamic Data Note if the data is {value:335, Name: ' Direct access '} This format needs to use eval (' + Strtojson + ') ') to turn
Load chart Start $ (function () {$.ajax ({//submit data type Post get type: "POST",//Submitted URL URL: "Http://localhost:8080/lightmanger/filemanager/fileDownload/fileDownloadPie", url: "<%=re
Quest.getcontextpath ()%>/filemanager/filedownload/filedownloadpie ",//Submit data data:{},
Returns the format of the data datatype: "HTML",//"XML", "HTML", "script", "JSON", "Jsonp", "text".
The function called before the request Beforesend:function () {$ ("#msg"). HTML ("Lodding");},//function called after successful return
Success:function (Result) {result = $.parsejson (result); var keys=[]; Class Array (actually used to hold the x-axis coordinate value) var values=[];
Sales array (actually used to hold the y-coordinate value var keysarray= new Array (); Keysarray=result.key.split ("#");
Character segmentation for (var i=0;i<keysarray.length; i++) {Keys.push (keysarray[i)); var valuesarray= new Array (); Valuesarray=result.value.split ("#");
Character segmentation for (var i=0;i<valuesarray.length; i++) {Values.push (eval (' + valuesarray[i] + '));
var MyChart = echarts.init (document.getElementById (' Mainpie '));
option = {title: {text: ' Download volume from upgraded users ', subtext: ' Apk downloads ', X: ' Center '}, tooltip: {trigger: ' item ', formatter: ' {a} &L T;br/>{b}: {C} ({d}%) "}, Legend: {Orient: ' vertical ', le
FT: ' left ',//data:[' direct access ', ' mail marketing ', ' affiliate ads ', ' video ads ', ' search engine '] Data:keys},
Series: [{name: ' Download Times ', type: ' Pie ',
Radius: ' 55% ', center: [' 50% ', ' 60% '], Data:values,/* [{value:335, Name: ' Direct Access '},   ; {value:310, Name: ' Mail Marketing '}, {value:234, Name: ' affiliate AD '}, {value:135, Name: ' Video ads '}, &nbs
p; {value:1548, Name: ' Search Engine '}], * *
ItemStyle: {emphasis: {shadowblur:10,
shadowoffsetx:0, Shadowcolor: ' Rgba (0, 0, 0, 0.5) '}
}
} ]
};
mychart.setoption (option); },//Call function Complete:function (XMLHttpRequest, textstatus) {//alert after execution (XMLHT
Tprequest.responsetext);
alert (textstatus); },//Call function Error:function () {//Request error handling}})
;
}); Load Chart End