首页 > 其他 > 详细

vue使用ECharts的折线图

时间:2020-09-19 15:03:51      阅读:147      评论:0      收藏:0      [点我收藏+]

1.下载

npm install echarts --save

2.在main.js中引入

import echarts from echarts
Vue.prototype.$echarts = echarts

3.使用

<div id="map" style="width: 100%;height:326px;"></div>
 getMap() {
      var myChart = this.$echarts.init(document.getElementById(map))
      let option = {
        xAxis: {
          type: category,
          // data: this.dataX,
          data: [Mon, Tue, Wed, Thu, Fri, Sat, Sun],
          boundaryGap: false, //控制日期是否在中间显示
          axisLabel: {
            show: true, //是否显示日期
            interval: 0, //强制显示全部 // rotate: 40,//倾斜的角度
            textStyle: {
              color: #000, //日期的颜色
              fontSize: 12 //字体的大小
            }
          },
          axisLine: {
            lineStyle: {
              color: #ccc // x轴的颜色
            }
          }
        },
        yAxis: {
          type: value,
          axisLabel: {
            formatter: {value},
            textStyle: {
              color: #000 //数字的颜色
            },
            inside: false //控制数据是否在内侧还是外侧显示
          },
          axisLine: {
            lineStyle: {
              color: #ccc // 折线的颜色
            }
          }
        },
        series: [
          {
            // data: this.dataY,
            data: [820, 932, 901, 934, 1290, 1330, 1320],
            type: line,
            symbol: circle, //是否显示实心的折线圆点
            smooth: true, //让折线有弧度
            symbolSize: 7, //折线圆点的大小
            itemStyle: {
              normal: {
                color: #efc883, //折线点的颜色
                lineStyle: {
                  color: #efc883 //折线的颜色
                },
                label: { show: true } //是否在折线点上显示数字
              }
            }
          }
        ]
      }
      myChart.setOption(option)
    }

4.效果图

技术分享图片

vue使用ECharts的折线图

原文:https://www.cnblogs.com/wu-hen/p/13696042.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!