echarts官网: https://echarts.apache.org/zh/index.html
更多配置可在配置项中查看
在vue中使用echarts:
安装echarts: **npm install echarts --save**
使用:
.vue页面
<template><div><el-col id="main" :span="24" style="height: 250px;"></el-col></div></template><script>// 这里之所以使用 require 而不是 import,是因为 require 可以直接从 node_modules 中查找,而 import 必须把路径写全。// 引入基本模板let echarts = require('echarts/lib/echarts');// 引入柱状图组件require('echarts/lib/chart/bar');// 引入饼图组件require("echarts/lib/chart/pie");// 引入提示框和title组件require('echarts/lib/component/tooltip');require('echarts/lib/component/title');require("echarts/lib/chart/line");// 引入legend组件require("echarts/lib/component/legend");require("echarts/lib/component/dataZoom");export default {created (){// 基于准备好的dom,初始化echarts实例var myChart = echarts.init(document.getElementById('main'));// 绘制图表myChart.setOption({title: {text: 'ECharts 入门示例'},tooltip: {},xAxis: {data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']},yAxis: {},series: [{name: '销量',type: 'bar',data: [5, 20, 36, 10, 10, 20]}]});}}</script>
