一、先说在原生里怎么使用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. thinkphp 三元运算

    模板可以支持三元运算符,例如: {$status?'正常':'错误'} {$info['status']?$info['msg']:$info['error']} 注意:三元运算符中暂时不支持点语法. ...

  2. csps模拟85表达式密码,电压机制,括号密码题解

    题面:https://www.cnblogs.com/Juve/articles/11733280.html 表达式密码: 是个水题... #include<iostream> #incl ...

  3. csp-s模拟测试87

    csp-s模拟测试87 考场状态还可以$T1$我当时以为我秒切,$T2$确认自己思路不对后毅然决然码上,$T3$暴力挂了太可惜了. 03:01:28 03:16:07 03:11:38 140 03: ...

  4. 左神算法进阶班1_1添加最少字符得到原字符N次

    Problem: 给定一个字符串str1,只能往str1的后面添加字符变成str2. 要求1:str2必须包含两个str1,两个str1可以有重合,但是不能以同一个位置开头. 要求2:str2尽量短最 ...

  5. Postman提取返回值

    json响应结果 Postman是做接口测试的,但是很多接口并不是直接就能测试的,需要一些预处理.比如登录的时候,需要传递一个token.如果是网页测试,一般打开登录页面的时候就会自动生成一个toke ...

  6. IIR滤波器数字频带转换

    <DSP using MATLAB>(Ingle & John Proakis)3ed,书中表8.2似乎不对. <Discrete Time signal processin ...

  7. Java中关于注释、标识符、变量、常量、数据类型、类型转换、转移字符以及数值型的表现形式的详解

    Java文件的注意事项 在同一个Java文件中,可以定义多个类,但是被public修饰的类只能够有一个,并且此类名要与文件名一致. 在同一个类中,可以定义多个方法,但是名字叫做main的方法只能有一个 ...

  8. <Python基础>字符串的基本操作

    s = 'abCDeFg aBcDea' print(s.find('b')) #通过元素查找索引,找不到返回-1 print(s.index('b')) #通过元素查找索引,找不到报错(会报错,基本 ...

  9. ABP Linq 扩展的 WhereIf 查询内部实现

    public static class QueryableExtensions { public static IQueryable<T> WhereIf<T>(this IQ ...

  10. springcloud系列15 bus的使用

    可以结合wekbbok进行通知: 将更新的代码进行点击就好: