一、先说在原生里怎么使用echarts

<!-- 1.引入echarts文件 -->
  <script src="echarts.min.js"></script>
<!-- 准备容器 -->
  <div style="width: 600px;height:400px;" id="main"></div>
//基于dom,初始化echarts实例
  var myChart = echarts.init(document.getElementById('main'))
//制定图表的配置项和数据
  var option = { }
//使用配置项显示图表
  myChart.setOption(option)
 
二、在vue中使用vue-echarts
// 引入vue-echarts
  import ECharts from 'vue-echarts/components/ECharts.vue'
  import 'echarts/lib/chart/line'
  import 'echarts/lib/component/tooltip'
  Vue.component('chart', ECharts)
//在build/webpack.base.conf.js中修改成如下东西 {
        test: /\.js$/,
loader: 'babel-loader',
+ include: [
+ resolve('src'),
+ resolve('test'),
+ resolve('node_modules/vue-echarts'),
+ resolve('node_modules/resize-detector')
+ ]
}
//在.vue文件中使用
  <div class="left-bottom">
    <div class="title">系统访问量</div>
    <chart style="width: 100%;height: 13rem;position: absolute;top: -2%;" :options="line"></chart>
  </div>
  //配置
  line: {
        legend: { // 图例组件颜色配置
          data: [
            {name: '一二三四五六 ', icon: 'circle', textStyle: {color: '#fff'}},
            {name: '一二三四五六  ', icon: 'circle', textStyle: {color: '#fff'}},
            {name: '一二三四五六   ', icon: 'circle', textStyle: {color: '#fff'}},
            {name: '一二三四五六    ', icon: 'circle', textStyle: {color: '#fff'}}
          ]
        },
        grid: { // 网格
          left: '-2.3%',
          right: '1.6%',
          bottom: '10%',
          containLabel: true
        },
        toolbox: {
          feature: {
            saveAsImage: {}
          }
        },
        xAxis: {
          splitLine: { // 保留网格线
            show: true,
            lineStyle: {
              color: '#666'
            }
          },
          splitArea: { // 去除网格区域
            show: false,
            lineStyle: {
              color: '#666'
            }
          },
          type: 'category',
          boundaryGap: false,
          axisLine: { // 坐标轴
            lineStyle: {
              color: '#ccc'
            }
          },
          axisTick: { // 坐标轴刻度设置
            inside: true,
            interval: 0
          },
          axisLabel: {
            interval: 0,
            fontSize: 8
          },
          data: ['12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00',  '20:00', '21:00', '22:00', '23:00', '24:00', '01:00', '02:00', '03:00', '04:00', '05:00', '']
 
        },
        yAxis: {
          min: 1000,
          splitLine: { // 保留网格线
            show: true,
            lineStyle: {
              color: '#666'
            }
          },
          splitArea: { // 去除网格区域
            show: false,
            lineStyle: {
              color: '#666'
            }
          },
          type: 'value',
          axisLabel: {
            interval: '0',
            fontSize: 8.5
          },
          axisLine: {
            lineStyle: {
              color: '#ccc'
            }
          },
          axisTick: {
            inside: true
          },
          data: [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000]
        },
        series: [
          {
            name: '一二三四五六 ',
            type: 'line',
            stack: '总量',
            symbol: 'circle',
            symbolSize: 7,
            itemStyle: {
              normal: {
                color: '#00ff7e',
                lineStyle: {
                  color: '#00ff7e'
                }
              }
            },
            data: [1700, 1720, 1010, 1340, 900, 2300, 2100, 1500]
          },
          {
            name: '一二三四五六  ',
            type: 'line',
            stack: '总量',
            symbol: 'circle',
            symbolSize: 7,
            itemStyle: {
              normal: {
                color: '#0060ff',
                lineStyle: {
                  color: '#0060ff'
                }
              }
            },
            data: [1200, 1820, 1910, 2304, 2090, 3040, 3010, 3000]
          },
          {
            name: '一二三四五六   ',
            type: 'line',
            stack: '总量',
            symbol: 'circle',
            symbolSize: 7,
            itemStyle: {
              normal: {
                color: '#00ccff',
                lineStyle: {
                  color: '#00ccff'
                }
              }
            },
            data: [1500, 2320, 2010, 1054, 1900, 3300, 3100, 3500]
          },
          {
            name: '一二三四五六    ',
            type: 'line',
            stack: '总量',
            symbol: 'circle',
            symbolSize: 7,
            itemStyle: {
              normal: {
                color: '#ffae00',
                lineStyle: {
                  color: '#ffae00'
                }
              }
            },
            data: [1200, 3320, 301, 3304, 3900, 330, 3200, 3050]
          }
        ]
      }
 
 
 
line2: {
legend: { // 图例组件颜色配置
data: [
{name: '一二三四五六 ', icon: 'circle', textStyle: {color: '#fff'}},
{name: '一二三四五六 ', icon: 'circle', textStyle: {color: '#fff'}},
{name: '一二三四五六 ', icon: 'circle', textStyle: {color: '#fff'}},
{name: '一二三四五六 ', icon: 'circle', textStyle: {color: '#fff'}}
]
},
grid: { // 网格
left: '-2.3%',
right: '1.6%',
bottom: '10%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
splitLine: { // 保留网格线
show: true,
lineStyle: {
color: '#666'
}
},
splitArea: { // 去除网格区域
show: false,
lineStyle: {
color: '#666'
}
},
type: 'category',
boundaryGap: false,
axisLine: { // 坐标轴
lineStyle: {
color: '#ccc'
}
},
axisTick: { // 坐标轴刻度设置
inside: true,
interval:
},
axisLabel: {
interval: ,
fontSize:
},
data: ['12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00', '24:00', '01:00', '02:00', '03:00', '04:00', '05:00', '']
},
yAxis: {
min: ,
splitLine: { // 保留网格线
show: true,
lineStyle: {
color: '#666'
}
},
splitArea: { // 去除网格区域
show: false,
lineStyle: {
color: '#666'
}
},
type: 'value',
axisLabel: {
interval: '0',
fontSize: 8.5
},
axisLine: {
lineStyle: {
color: '#ccc'
}
},
axisTick: {
inside: true
},
data: [, , , , , , , , ]
},
series: [
{
name: '一二三四五六 ',
type: 'line',
stack: '总量',
symbol: 'none',
itemStyle: {
normal: {
color: 'rgba(0, 254, 116, 0.3)',
lineStyle: {
color: '#00ff7e'
}
}
},
areaStyle: {normal: {}},
data: [, , , , , , , , ]
},
{
name: '一二三四五六 ',
type: 'line',
stack: '总量',
symbol: 'none',
itemStyle: {
normal: {
color: 'rgba(0, 109, 255, 0.3)',
lineStyle: {
color: '#0060ff'
}
}
},
areaStyle: {normal: {}},
data: [, , , , , , , , ]
},
{
name: '一二三四五六 ',
type: 'line',
stack: '总量',
symbol: 'none',
itemStyle: {
normal: {
color: 'rgba(0, 204, 255, 0.3)',
lineStyle: {
color: '#00ccff'
}
}
},
areaStyle: {normal: {}},
data: [, , , , , , , , ]
},
{
name: '一二三四五六 ',
type: 'line',
stack: '总量',
symbol: 'none',
itemStyle: {
normal: {
color: 'rgba(255, 174, 0, 0.3)',
lineStyle: {
color: '#ffae00'
}
}
},
areaStyle: {normal: {}},
data: [, , , , , , , , ]
}
]
}

vue中使用vue-echarts的更多相关文章

  1. Vue中通过Vue.extend动态创建实例

    Vue中通过Vue.extend动态创建实例 在Vue中,如果我们想要动态地来控制一个组件的显示和隐藏,比如通过点击按钮显示一个对话框或者弹出一条信息.我们通常会提前写好这个组件,然后通过v-if = ...

  2. vue中如何使用echarts

    在vue中使用echarts主要是注意如何与vue生命周期相结合,从而做到数据驱动视图刷新 主要是以下几步: echarts的option配置项放在在data(){}或者computed(){}中 在 ...

  3. Vue 中的Vue Router一级路由,二级路由,三级路由以及跳转

    今天编写了一下Vue中的路由 先用命令行新建一个空的项目,并且我知道要用路由,就下载了路由的相关依赖 vue init webpack demo5 完毕之后进入所在的项目 cd demo5 之后用vs ...

  4. 在vue中使用的Echarts的步骤

    1.首先在项目中安装Echarts npm install echarts -g --save //安装 2.在项目中引入Echarts(在main.js中引入) import echarts fro ...

  5. 关于vue中如何配置echarts以及使用方法

    ECharts,一个使用 JavaScript 实现的开源可视化库,可以流畅的运行在 PC 和移动设备上,兼容当前绝大部分浏览器(IE8/9/10/11,Chrome,Firefox,Safari等) ...

  6. vue中如何使用echarts,使用axios获取数据

    1==>首先准备一个容器 <div id="echartContainer" style="width:400px; height:400px"&g ...

  7. vue中动态设置echarts画布大小

    document.getElementById('news-shopPagechart').style.height = this.heightpx2+'px'; //heightpx2定义在data ...

  8. vue中,基于echarts 地图实现一个人才回流的大数据展示效果

    0.引入echarts组件,和中国地图js import eCharts from 'echarts' import 'echarts/map/js/china.js'// 引入中国地图 1. 设置地 ...

  9. Vue中使用Vue.component定义两个全局组件,用单标签应用组件时,只显示一个组件的问题和 $emit的使用。

    解决方法: 定义了两个 Vue.component 在 el 中使用的时候要用 双标签, 用单表标签的时候,只会显示第个 组件间 这样写只显示 welcome-button 组件 <welcom ...

  10. vue中使用定时器时this指向问题

    在写一个很小的demo时,用的普通函数写法,没有用es6箭头函数,发现this变化了,后来查找到了问题所在: 箭头函数中的this指向是固定不变(定义函数时的指向),在vue中指向vue 普通函数中的 ...

随机推荐

  1. BZOJ 1087(SCOI 2005) 互不侵犯

    1087: [SCOI2005]互不侵犯King Time Limit: 10 Sec Memory Limit: 162 MB Submit: 5333 Solved: 3101 [Submit][ ...

  2. 尚学linux课程---8、rpm软件包安装

    尚学linux课程---8.rpm软件包安装 一.总结 一句话总结: rpm安装软件包的话要解决依赖问题,推荐使用yum安装软件包 1.比如cd /home中的斜线表示什么意思? 表示根目录,linu ...

  3. centos7 创建桌面快捷方式(chrome,eclipse)

    在将eclipse-SDK-3.7.2-Linux-gtk.tar.gz解压到某个目录下之后,命令行进行如下编辑 vi /usr/share/applications/eclipse.desktop ...

  4. /encrypt和/decrypt端点来进行加密和解密的功能

  5. 01_MyBatis入门

    一.MyBaits介绍 1.MyBatis 本是apache的一个开源项目iBatis, 2010年这个项目由apache software foundation 迁移到了google code,并且 ...

  6. mac nginx php php-fpm

    #the php-fpm config and cammand... cp /private/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf ...

  7. (转)常用的三种修改mysql最大连接数的方法

    MYSQL数据库安装完成后,默认最大连接数是100,一般流量稍微大一点的论坛或网站这个连接数是远远不够的,增加默认MYSQL连接数的方法有两个 方法一:进入MYSQL安装目录 打开MYSQL配置文件 ...

  8. 自定义Jquery:ajax,get,post方法

    var myAjax = { request: function(url, type, data, callback) { $.ajax(url, { type: type, data: data, ...

  9. Apache服务器中运行CGI程序的方法,文中以Perl脚本作为示例

    关于apache与CGI在这里就不解释了. 1.apache下面以2.0.63为例介绍运行CGI程序的配置.(http://www.nklsyy.com) 2.下载Windows下的Perl解释器Ac ...

  10. Python面向对象学习

    以下面例子作为面向对象基础介绍,类比java里的面向对象既可以,大同小异 class Employee(): raiseAmount=1.04 employeeNum= def __init__(se ...