Echars-折线图

匿名 (未验证) 提交于 2019-12-03 00:03:02
<!-- 图表 --> <div class="chartdiv bg-white border">     <div v-if="currentData.length===0" class="no-data" style="height:300px;">         暂无数据     </div>     <div v-show="currentData.length>0" ref="netValueChart" style="height:300px;"></div> </div>  
//初始化图表         chartInit() {             if (!this.lineArt) this.lineArt = echarts.init(this.$refs["netValueChart"]);             const option = {                 xAxis: {                     type: "category",                     boundaryGap: false,                     data: this.fundNavChartDate                 },                 yAxis: {                     type: "value"                 },                 tooltip: {                     trigger: "axis",                     axisPointer: {                         type: "cross",                         label: {                             backgroundColor: "#6a7985"                         }                     }                 },                 legend: {                     data: [第一组数据,第二组数据]                 },                 series: [{                     data: this.dataOne,                     name: "第一组数据",                     type: "line",                     smooth: true,                     symbol: "none",                     lineStyle: { normal: { width: 2 } },                     itemStyle: {                         normal: {                             color: "#e99400",                             lineStyle: {                                 color: "#e99400"                             }                         }                     },                     areaStyle: {                         normal: {                             color: new echarts.graphic.LinearGradient(                                 0, 0, 0, 0,                                 [                                     { offset: 0, color: "#e99400" },                                     { offset: 0.7, color: "#FFE2C6" },                                     { offset: 1, color: "#ffffff" }                                 ]                             )                         }                     }                 },{                     data: this.dataTwo,                     name: "第二组数据",                     type: "line",                     smooth: true,                     symbol: "none",                     lineStyle: { normal: { width: 2 } },                     itemStyle: {                         normal: {                             color: "#409EFF",                             lineStyle: {                                 color: "#409EFF"                             }                         }                     },                     areaStyle: {                         normal: {                             color: new echarts.graphic.LinearGradient(                                 0, 0, 0, 0,                                 [                                     { offset: 0, color: "#409EFF" },                                     { offset: 0.1, color: "#409EFF" },                                     { offset: 1, color: "#ffffff" }                                 ]                             )                         }                     }                 }]             };             this.lineArt.setOption(option);         }

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!