一、先说在原生里怎么使用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. 概率+后效性处理——cf930B好题

    之前题目看错了.. 先用双倍字符串处理后效性 首先要确定一个结论:如果原串s中相距为d的ch1和ch2只有一对,那么如果第一个翻开ch1,第二个翻开ch2,就能确定k 现在要求的是当我们第一次翻开的是 ...

  2. Unable to find explicit activity class报错问题解决方法

    转:http://hi.baidu.com/mz_mz/item/f5672ad814e1ce30e2108f69 1.首先查看是否在已经在AndroidMainfest.xml中添加了你的Activ ...

  3. System.Web.Mvc.ControllerBase.cs

    ylbtech-System.Web.Mvc.ControllerBase.cs 1.程序集 System.Web.Mvc, Version=5.2.3.0, Culture=neutral, Pub ...

  4. POJ 1873 /// 状压+凸包

    题目大意: 国王有一片森林,巫师需要从所有树中选出一些做成围栏把其他树围起来, 每棵树都有其对应的价值 v 和能作为围栏的长度 l 要求最小价值,若存在多种最小价值的方案则选择余下长度更少的 树木较少 ...

  5. 面试系列10 es生产集群的部署架构

    如果你确实干过es,那你肯定了解你们生产es集群的实际情况,部署了几台机器?有多少个索引?每个索引有多大数据量?每个索引给了多少个分片?你肯定知道! 但是如果你确实没干过,也别虚,我给你说一个基本的版 ...

  6. Linux安装Java与Eclipse

    Linux安装Java和Eclipse 一.准备工作 1.下载jdk  https://www.oracle.com/technetwork/java/javase/downloads/jdk8-do ...

  7. win10下aria2和BaiduExporter的配置和安装

    一.aria2的配置 下载 aria2下载地址: https://github.com/aria2/aria2/releases 链接:https://pan.baidu.com/s/1olJyZkX ...

  8. Codeforces 388D Fox and Perfect Sets

    链接:CF388D 题目大意 给定一个数\(n\),求选择\(0 \sim n\)中任意个数的数字组成的集合\(S\)中,有多少满足若\(a\in S,b\in S\),则\(a \bigoplus ...

  9. [转]关于 MVVMLight 设计模式系列

    关于 MVVMLight 设计模式系列 http://www.wxzzz.com/958.html MvvmLight框架使用入门 http://www.cnblogs.com/manupstairs ...

  10. codevs1222 信与信封的问题

    二分图匹配. 先匹配一次,一定是完美匹配.然后枚举每条边,去掉它,若是不能完美匹配,这条边就必须. #include<cstdio> #include<cstring> #in ...