<! DOCTYPE Html>"Utf-8"><title>Echarts</title>"Main"style="width:600px; height:400px;"></div> <!--Introducing Echarts.js--<script src="Echarts.common.min.js"></script> <script type="Text/javascript">varMyChart = Echarts.init (document.getElementById ('Main')); //Specify the configuration items and data for the chart varDatas = [ { "name":"Shirts", " Number": -, " Price": the, " Tax": + }, { "name":"Sweater", " Number": the, " Price":369, " Tax": $ }, { "name":"Chiffon Sweater", " Number": -, " Price":129, " Tax":9 }, { "name":"Trousers", " Number": $, " Price": the, " Tax": - }, { "name":"High Heels", " Number": -, " Price": -, " Tax": - }, { "name":"Socks", " Number": $, " Price": +, " Tax": - } ]; varDT = []; varDT2 = []; varDT3 = []; varLen =datas.length; varoption ={title: {text:'Echarts Getting Started example'}, tooltip: {}, Legend: {data: ['Quantity','Unit Price','Tax'], selected: {'Unit Price':false, 'Tax':false}, Selectedmode:' Single'}, YAxis: [{}], Xaxis: [{type:'category', Splitline: {show:false}, Data:dt}], series: [{name:'Quantity', type:'Bar', Data: (function () {vardata = []; Datas.sort (function (A, b) {if(A.number >b.number)return-1;//Descending Else return 1; }); Datas.foreach (function (item) {Console.log (1); Data.push (Item.number); Dt.push (Item.name); }); returndata; }) ()}, {name:'Unit Price', type:'Bar', Data: (function () {vardata = []; Datas.sort (function (A, b) {if(A.price >B.price)return-1;//Descending Else return 1; }); Datas.foreach (function (item) {Console.log (3); Data.push (Item.price); Dt2.push (Item.name); }) returndata; }) ()}, {name:'Tax', type:'Bar', Data: (function () {vardata = []; Datas.sort (function (A, b) {if(A.tax >b.tax)return-1;//Descending Else return 1; }); Datas.foreach (function (item) {Console.log (1); Data.push (Item.tax); Dt3.push (Item.name); }); returndata; })() } ] }; Mychart.on ('legendselectchanged', Function (params) { varName =params. Name; if(Name = ='Unit Price') { varopt =mychart.getoption (); opt.xaxis[0]["Data"] =DT2; Mychart.setoption (opt); } if(Name = ='Quantity') { varopt =mychart.getoption (); opt.xaxis[0]["Data"] =DT; Mychart.setoption (opt); } if(Name = ='Tax') { varopt =mychart.getoption (); opt.xaxis[0]["Data"] =DT3; Mychart.setoption (opt); } console.log (name); }); mychart.setoption (option); </script></body>Echart Radio legend and sorting