简介
该使用框架echarts
类似于这种的炫酷的大屏幕设计
这个是参考教程 较详细
可以参考
https://www.makeapie.com/explore.html#sort=ranktimeframe=allauthor=all
VueCli使用echarts
npm安装ECharts
//一般根据官网进行安装的话会出现
//版本问题报错
npm install echarts@4.8.0 --save
//如果呢 安装错误
npm uninstall echarts//这个是卸载命令
在main.js中全局引入ECharts
// 引入ECharts
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
在eCharts.vue使用
<div ref="chart"
:style="{ width: '500px', height: '500px' }"></div>
<script>
export default {
name: "eCharts",
data() {
return {};
},
mounted() {
//模板挂载完成后调用
this.drawEcharts();
},
methods: {
drawEcharts() {
// 基于准备好的dom,初始化echarts实例
let myChart = this.$echarts.init(this.$refs.chart);
// 绘制图表
myChart.setOption({
title: {
text: 'ECharts 入门示例'
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
})
}
}
}
</script>
下面的链接是使用document.getElementById(id)获取 报错 —解决方案
https://www.jianshu.com/p/1916a4effb8e
出现以下效果
echarts基础配置
这边按折线图的这个api为例子:
https://echarts.apache.org/examples/zh/editor.html?c=line-stack
title && tooltip
这里面的东西具体看官网里面的 文档--配置项---
//option里面的
title//对应设置图标的标题
tooltip: {//图标的提示框组件(JS点击放上去显示对应的提示这个东西)
trigger: 'axis'// //触发方式:触发的类型
},
legend
===============================
//图例组件(代表的是以下案例)
legend: {
data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎']
},
===============================
toolbox
toolbox: {//工具箱组件(可以另存为图片等功能)
feature: {
saveAsImage: {}
}
},
grid
grid: {//网格配置 可以控制线性 柱状 图标大小
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true//是否显示刻度标签 true显示 否则不显示
},
xAxis
xAxis: {//x轴的类型
type: 'category',//类型 类目
boundaryGap: false,//是否让线条与坐标有缝隙
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
},
yAxis
yAxis: {//y轴
type: 'value'//类型 值
},
series
series: [//系列图标配置显示那种类型的图表
//series里面有name值 legend的data可以删掉不显示
{
name: '邮件营销',
type: 'line',//类型line 线性
stack: '总量',//不要stack 就不会显示误差
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '联盟广告',
type: 'line',
stack: '总量',
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: '视频广告',
type: 'line',
stack: '总量',
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: '直接访问',
type: 'line',
stack: '总量',
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: '搜索引擎',
type: 'line',
stack: '总量',
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
color
color:['red','black',...]//可以设置多个颜色
分割线=======================================分割线
基于echarts使用的项目案例
https://blog.csdn.net/daoke_li/article/details/93065550
echarts社区案例
https://www.makeapie.com/explore.html
流程图
一般基于流程图来写的antv x6插件
数字滚动效果
https://juejin.cn/post/6844903901355835406#heading-8