2 lines
1.9 KiB
JavaScript
2 lines
1.9 KiB
JavaScript
|
/* 2020-9-24 14:48:24 | 版权所有 军懋国兴 */
|
||
|
var thisWidget,myChart1;function initWidgetView(e){(thisWidget=e).config&&thisWidget.config.style&&$("body").addClass(thisWidget.config.style),myChart1=echarts.init(document.getElementById("echartsView1"),"dark"),setEchartsData(thisWidget.data),setInterval(function(){updateFlyOk(thisWidget.data)},800)}function updateFlyOk(e){for(var t=e.thislen||0,a=[],r=0;r<e.arrFxgd.length&&e.arrLength[r]<=t;r++)a.push(e.arrFxgd[r]);myChart1.setOption({series:[{name:"已漫游",data:a}]})}function setEchartsData(n){var e;null!=n&&null!=myChart1&&(e={legend:{data:["地面海拔","漫游海拔","已漫游"]},grid:{left:10,right:10,bottom:10,containLabel:!0},dataZoom:[{type:"inside",throttle:50}],tooltip:{trigger:"axis",formatter:function(e){var t="";if(e.length<2)return t;var a=e[0].value,r=e[1].value,o=n.arrPoint[e[0].dataIndex];return t+="所在位置 "+o.x+","+o.y+"<br />"+e[1].seriesName+" <label style='color:"+e[1].color+";'>"+e[1].value+"</label> 米<br />",0!=a&&(t+=e[0].seriesName+" <label style='color:"+e[0].color+";'>"+e[0].value+"</label> 米<br />",t+="距离地面 <label>"+(r-a).toFixed(1)+"</label> 米"),t}},xAxis:[{name:"行程",type:"category",boundaryGap:!1,axisLine:{show:!1},axisLabel:{show:!1},data:n.arrLength}],yAxis:[{type:"value",axisLabel:{rotate:60,formatter:"{value} 米"}}],series:[{name:"地面海拔",type:"line",smooth:!0,symbol:"none",sampling:"average",itemStyle:{normal:{color:"rgb(255, 70, 131)"}},areaStyle:{normal:{color:new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:"rgb(255, 158, 68)"},{offset:1,color:"rgb(255, 70, 131)"}])}},data:n.arrHbgd},{name:"漫游海拔",type:"line",smooth:!1,symbol:"none",data:n.arrFxgd},{name:"已漫游",type:"line",areaStyle:{normal:{color:new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:"rgb(255, 255, 0)"},{offset:1,color:"rgb(255, 255, 131)"}])}},data:[]}]},myChart1.setOption(e))}
|