知识点4: 配置echarts折线图和饼图
- 折线图
效果图

html
<template>
<div id="v11-charts3"></div>
</template>
js
export default {
methods: {
// 初始化
init(){
this.chart3 = echarts.init(document.getElementById('v11-charts3'));
this.chart3.setOption(option3);
}
},
option3: {
// 直角坐标系内绘制表格
grid: {
show: true,
left: 23,
top: 25,
right: 24,
bottom: 14,
borderColor: '#0a2549',
containLabel: true,
borderWidth: 4
},
// 图例组件
legend: {
left: 'right',
textStyle: {
color: '#fff'
},
// 图例的数据数组
data:[
{
name: '日常'
},
{name: '当前'}
]
},
// 图例的 tooltip 配置
tooltip: {
show: true,
trigger: 'axis',
axisPointer: {
type: 'line'
}
},
// 直角坐标系 grid 中的 x 轴
xAxis: {
type: 'category',
// name: '(TB)',
nameLocation: 'start',
nameGap: 30,
boundaryGap: false,
// 坐标轴轴线相关设置
axisLine: {
show: true,
lineStyle: {
color: '#6a9bcc',
width: 2
}
},
// 坐标轴刻度标签的相关设置
axisLabel: {
show: true,
fontSize: 14,
margin: 12,
fontFamily: 'Microsoft YaHei',
color: '#ffffff'
},
// 坐标轴刻度相关设置
axisTick: {
show: false
},
data: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
},
// 直角坐标系 grid 中的 y 轴
yAxis: {
type: 'value',
show: true,
splitNumber: 4,
//y轴颜色
axisLine: {
show: true,
lineStyle: {
color: '#99c2ff',
width: 2
}
},
axisLabel: {
show: true,
fontSize: 14,
margin: 15,
fontFamily: 'Microsoft YaHei',
color: '#ffffff'
},
// 坐标轴在 grid 区域中的分隔线
splitLine: {
show: true,
lineStyle: {
color: '#294277',
width: 1,
type: 'solid'
}
},
axisTick: {
show: false
}
},
// 系列列表
series: [
{
type: 'line',
name: '当前',
symbolSize: 2,
smooth: true,
itemStyle: {
normal: {
color: '#00ffaa',
// lineStyle: {
// color: "#2ec7c9"
// }
borderColor:'#00ffaa',
borderWidth:'4',
// 线条样式
lineStyle: {
normal: {
color: '#00ffaa',
width: 2
}
},
}
},
// 区域填充样式
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
// color: 'rgba(101, 84, 170, 0.3)' // 0% 处的颜色
color: '#276d85'
}, {
offset: 1,
// color: 'rgba(16, 27, 77, 0)' // 100% 处的颜色
color: '#011441'
}], false)
}
},
data: [820, 932, 901, 934, 1290, 1330, 1320, 820, 932, 901, 934, 1290, 1330, 1320, 820, 932, 901, 934, 1290, 1330,]
},
{
type: 'line',
name: '日常',
symbolSize: 2,
smooth: true,
//拐点样式
itemStyle: {
normal: {
//本应该是拐点颜色,此处成了线条颜色,不知道啥原因
color: '#ad85ff',
//拐点边框颜色
borderColor:'#ad85ff',
borderWidth:'4',
// 线条样式
lineStyle: {
normal: {
// color: '#ac84fe',
width: 2
}
},
}
},
//区域样式
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
// color: 'rgba(12, 42, 82, 0.8)' // 0% 处的颜色
color: '#836bcd'
}, {
offset: 1,
// color: 'rgba(3, 243, 167, 0)' // 100% 处的颜色
color: '#00123b'
}], false)
}
},
data: [520, 632, 601, 444, 990, 830, 520, 632, 601, 444, 990, 830, 520, 632, 601, 444, 990, 830]
}
]
},
- 饼图(option配置不同)
效果图

option1: {
series: [
{
type: 'pie',
silent: true,
radius: ['30%', '60%'],
startAngle: 0,
label: {
normal: {
show: true,
position: 'outside',
fontSize: 20,
align: 'center',
fontFamily: 'MF_LangQian',
// formatter: '{b}',
formatter: function(params) {
if (params.name === '') {
return 0 + '%'
}
}
}
},
labelLine: {
normal: {
show: true,
length: 40,
lineStyle: {
width: 2
}
}
},
itemStyle: {
normal: {
borderWidth: 3,
borderColor: 'rgba(1,9,22,0.9)'
},
emphasis: {
borderWidth: 0,
shadowBlur: 5,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.2)'
}
},
data: [
{
value: 55,
name: '0',
itemStyle: {
normal: {
// 图形的颜色
color: '#faef6f'
// color: 'yellow'
}
}
},
{
value: 55,
name: '59',
itemStyle: {
normal: {
color: '#00d5ff'
}
}
},
{
value: 55,
name: '51',
itemStyle: {
normal: {
color: '#26bd59'
}
}
},
{
value: 55,
name: '14',
itemStyle: {
normal: {
color: '#d6c956'
}
}
}
]
}
]
}
知识点4: 配置echarts折线图和饼图的更多相关文章
- 数据可视化(Echart) :柱状图、折线图、饼图等六种基本图表的特点及适用场合
数据可视化(Echart) 柱状图.折线图.饼图等六种基本图表的特点及适用场合 参考网址 效果图 源码 <!DOCTYPE html> <html> <head> ...
- vue使用axios读取本地json文件来显示echarts折线图
编辑器:HBuilderx axios文档:http://www.axios-js.com/zh-cn/docs/ echarts实例:https://echarts.apache.org/examp ...
- 安卓图表引擎AChartEngine(三) - 示例源码折线图、饼图和柱状图
折线图: package org.achartengine.chartdemo.demo.chart; import java.util.ArrayList; import java.util.Lis ...
- 实现Echarts折线图的虚实转换
需求:医院的体温单,在统计体温时,对于正常情况下统计的体温数据,需要显示实线:对于进行物理降温后统计的体温数据,需要显示虚线. 现有的体温单是运用 Echarts 折线图,统一用实线显示.因此在这基础 ...
- HighCharts之2D柱状图、折线图和饼图的组合图
HighCharts之2D柱状图.折线图和饼图的组合图 1.实例源码 ColumnLinePie.html: <!DOCTYPE html> <html> <head&g ...
- echarts折线图动态改变数据时的一个bug
echarts折线图中当增加dataZoom,修改start大于0的时候,会出现折线混乱,变成竖直的线,绘制有问题. 解决方法,在dataZoom中增加filterMode: 'empty' http ...
- d3.js 教程 模仿echarts折线图
今天我们来仿echarts折线图,这个图在echarts是折线图堆叠,但是我用d3改造成了普通的折线图,只为了大家学习(其实在简单的写一个布局就可以).废话不多说商行代码. 1 制作 Line 类 c ...
- ECharts折线图堆叠设置为不堆叠的方法
下图是ECharts折线图堆叠的官方源码,设置折线图不堆叠只需要将每一个stack的值设置为不一样的名称或者将stack属性删除即可. option = { title: { text: '折线图堆叠 ...
- 利用pandas读取Excel表格,用matplotlib.pyplot绘制直方图、折线图、饼图
利用pandas读取Excel表格,用matplotlib.pyplot绘制直方图.折线图.饼图 数据: 折线图代码: import pandas as pdimport matplotlib. ...
随机推荐
- 《Exploring in UE4》多线程机制详解[原理分析]
转自:https://zhuanlan.zhihu.com/c_164452593 目录一.概述二."标准"多线程三.AsyncTask系统3.1 FQueuedThreadPoo ...
- Hive UDF作业
说到这次作业,看似简单的几个步骤,对于我这样的菜鸟来说可真是一波三折啊.下面来说说这次的步骤和我遇到的问题. 首先准备工作,搭建好hive环境,保证hadoop集群是启动的.这个就不多说了. 第一步: ...
- CSS便捷开发小工具汇总
1.Prefix free 可以帮助开发者省去编写各种CSS3属性前缀的工作,只需要在页面中引入prefixfree.js即可. 2. Normalize 是一个CSS Reset工具, 相比传统的R ...
- CS229 7.2 应用机器学习方法的技巧,准确率,召回率与 F值
建立模型 当使用机器学习的方法来解决问题时,比如垃圾邮件分类等,一般的步骤是这样的: 1)从一个简单的算法入手这样可以很快的实现这个算法,并且可以在交叉验证集上进行测试: 2)画学习曲线以决定是否更多 ...
- fatal error C1083: Cannot open include file: 'openssl/opensslv.h'
在安装针对ELK系统的警告工具elastalert时,报错: fatal error C1083: Cannot open include file: 'openssl/opensslv.h',如下图 ...
- 1-hadoop安装、ssh、节点退役与服役
1.准备 四台虚拟机 ①卸载openjdk ②安装jdk 2. 配置静态ip: ip : 每个机器在internet上的唯一标识 子网掩码: 必须结合IP地址一起使用,将某个IP地址划分成网络地址和主 ...
- 第十届蓝桥杯JavaB组总结
去年参加了第九届蓝桥杯C/C++B组,很捞,做了大概5道题,就好像就做对了2道结果填空题,编程题只做了一个(只通过了部分测试数据),最后拿了个省三,但是班上那些平时没有认真准备的都拿了省二 今年想好好 ...
- git 使用教程(二)
MyEclipse下使用GitHub方法(Eclipse同理) 原创 2016年01月04日 20:30:25 标签: myeclipse / 软件 / git / github / eclipse ...
- 使用jQuery编辑删除页面内容,两种方式
第一种,比较少的编辑用这种,直接在那块内容上编辑,失去焦点即完成 前几天做编辑框的时候,需要只修改一个状态 //编辑角色 function editTr($this){ thatTd=$($this) ...
- 44.scrapy爬取链家网站二手房信息-2
全面采集二手房数据: 网站二手房总数据量为27650条,但有的参数字段会出现一些问题,因为只给返回100页数据,具体查看就需要去细分请求url参数去请求网站数据.我这里大概的获取了一下筛选条件参数,一 ...