标签:code ado average 数据 art 平均值 async height nbsp
<body> <div id="main" style="height:300px;width:800px"></div> <script src="~/assets/js/echarts.js"></script> <script> $(function () { var rootid = $.Query("rootid"); var xdrift = []; var ypull = []; var charts = echarts.init(document.getElementById("main")); Option = { title: { text: ‘钢绞线数据‘, subtext: ‘‘ }, tooltip: { trigger: ‘axis‘, axisPointer: { type: ‘shadow‘ } }, toolbox: { show: true }, legend: { show: true, orient: ‘horizontal‘, x: ‘center‘, y: ‘top‘, data:[‘位移‘,‘力值‘] }, toolbox: { itemGap: 5 }, grid: { left: ‘3%‘, right: ‘10%‘, bottom: ‘3%‘, containLabel: true }, xAxis: { data: [],//X轴参数 show: true, name: ‘位移(MM)‘, boundaryGap: false, axisLabel: { interval: 0, textStyle: { color: ‘#FF0000‘ } }, axisLine: { color: ‘#FF0000‘, width: 2 }, splitLine: { show: true } }, yAxis: { show: true, name: ‘力值(KN)‘, axisLabel: { textStyle: { color: ‘#FF0000‘ } }, axisLine: { lineStyle: { color: ‘#FF0000‘, width: 2 } }, splitLine: { show: true } }, series: []//数据 } $.ajax({ url: "/api/Tension/GetRootData", type: ‘GET‘, data: { "RootId": rootid }, async: true, dataType: ‘JSON‘, success: function (args) { if (args == "" || args == null) { layer.msg(‘没有数据‘); }else{ var data = JSON.parse(args.RootData); for (var item in data) { xdrift.push(data[item].drift); ypull.push(data[item].pull); } charts.setOption({ xAxis: { data: xdrift.sort(), axisTick: { length: 10 }, axisLabel: { formatter: function (val) { return val; } } }, series: [{ name: ‘力值‘, type: ‘line‘, data: ypull, markPoint: { data: [ { type: ‘max‘, name: ‘最大值‘ } ] }, markLine: { data: [ { type: ‘average‘, name: ‘平均值‘ } ] } }] }) } } }) charts.setOption(Option); }) </script> </body>
标签:code ado average 数据 art 平均值 async height nbsp
原文地址:https://www.cnblogs.com/yelvin/p/9115470.html