echarts相关属性设置(1)折线图篇
option =
{
tooltip: {
trigger: 'axis',
// axisPointer: {
// type: 'cross',
// label: {
// backgroundColor: '#6a7985',
// },
// },
position(pos: any, params: any, dom: any, rect: any, size: any) { // 鼠标移入时显示的框子的定位
// 鼠标在左侧时 tooltip 显示到右侧,鼠标在右侧时 tooltip 显示到左侧。
return {
top: -10,
[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]]: 10,
};
},
},
dataZoom: [ //x轴是否可以滑动
{
type: 'inside',
start: 50, //从50%开始显示
end: 100, //到100%的位置
filterMode: 'empty',
},
],
color: ['#d77b09', '#54f0fd', '#296f04'], //想要设置折线图的文字颜色(还是图小图标一起改动?),必须要在这里写
legend: {
data: ['名称1', '名城2', { //这里可以单独设置图例的配置
name: '名城3',
textStyle: {
fontSize: 8,
fontWeight: 'bolder',
color: '#296f04',
},
}],
itemWidth: 6, //图例小图标的宽度,宽度和高度都为0时,小图标不显示
itemHeight: 6, //图例小图标的高度
textStyle: {
fontSize: 8, // 设置图例中文字大小
color: ['#d77b09', '#54f0fd', '#296f04'], //设置图例文字的颜色,如果是有折线图,必须再在外面写个color,如果这里和外面写了都没效果,就单独设置图标中的data设置
},
itemGap: 0,
top: -6,
},
// toolbox: {
// feature: {
// saveAsImage: {},
// },
// },
grid: { //这个是用来设置echarts图标的位置和其他设置
left: '-5%',
// right: '4%',
bottom: '11%',
width: '110%',
top: '20%',
containLabel: true, //一般都带上这个,否则x,y轴的刻度值会被截取掉
},
xAxis: [ //x轴的设置
{
type: 'category',
boundaryGap: true, //是否将x轴的刻度显示在中间位置,false表示从0这个位置开始(最边上)
data: data, //x轴的数据
axisTick: { //是否显示刻度线
show: false,
},
axisLabel: { //相关轴上的刻度值的设置,show:false,表示不显示轴上的刻度值
textStyle: { //刻度值的字体样式设置
color: '#e9ecee',
},
fontSize: 8,
margin: 2, //刻度值离轴线多远的距离
},
},
],
yAxis: [
{
type: 'value',
// min: 0,
// max: 300, //设置轴的最大值和最小值,一般不规定,可自适应
show: false, //设置Y轴不显示(轴线不显示)
splitNumber: 4, // 控制刻度标签的数量
axisTick: { //轴线的小刻度线
show: false, // y轴的小刻度线。这里是不显示
},
axisLabel: { //设置刻度值
show: false, //不显示刻度值,如果不显示,下面的刻度值设置就可以不用写了
textStyle: {
// color: '#e9ecee',
},
fontSize: 8,
margin: 5,
},
axisLine: { //设置轴线的配置
show: false,
lineStyle: { //轴线的线条颜色
color: '#9999ae',
},
},
splitLine: { //设置网格线,写在哪个轴就是哪个轴的网格线
show: false,
lineStyle: {
type: 'dotted',
// color: ['#aaa', 'red'], //设置网格线的颜色,可单独设置
color: '#4c4a74',
},
},
},
],
series: [
{
name: '名称1',
type: 'line',
stack: '总量',
symbol: 'none', //取消折线上的小圆点
smooth: true, //使线条顺滑
itemStyle: { //折线的样式设置
normal: {
lineStyle: { //折线线条的设置
color: '#d77b09',
},
},
},
areaStyle: { //折线的区域样式设置
normal: {
color: new LinearGradient( //区域颜色设置
0, 0, 0, 1,
[
{ offset: 0, color: '#00c9ff' },
{ offset: 1, color: '#0065ff' },
],
),
},
},
data: data,
},
{
name: '名称2',
type: 'line',
stack: '总量',
smooth: true,
symbol: 'none',
itemStyle: {
normal: {
lineStyle: {
color: '#54f0fd',
},
},
},
areaStyle: {
normal: {
color: new LinearGradient(
0, 0, 0, 1,
[
{ offset: 0, color: '#00c9ff' },
{ offset: 1, color: '#0065ff' },
],
),
},
},
data: data,
},
{
name: '名称3',
type: 'line',
stack: '总量',
smooth: true,
itemStyle: {
normal: {
color: '296f04', //折线上的小圆点颜色设置
lineStyle: {
color: '#296f04',
// width: 1, //折线的线条宽度
},
},
},
areaStyle: {
normal: {
color: new LinearGradient(
0, 0, 0, 1,
[
{ offset: 0, color: '#00c9ff' },
{ offset: 1, color: '#0065ff' },
],
),
},
},
label: { //在折线上显示相对应的数值
normal: {
show: true,
position: 'top', //数值的位置
distance: 0, //数值距离折线的距离
fontSize: 8, //数值的字体大小
color: '#296f04', //数值的颜色
},
},
data: data,
},
],
};
echarts相关属性设置(1)折线图篇的更多相关文章
- echarts相关属性设置(2)--折线图和柱状图的结合使用
type:bar和line的组合 option = { { tooltip: { trigger: 'axis', axisPointer: { // type: 'shadow' }, // lab ...
- echarts相关属性设置(3)环状图
option = { grid: { left: '3%', top: '0%', // height: 500, right: '30%', containLabel: true, }, legen ...
- UILabel的相关属性设置
在iOS编程中UILabel是一个常用的控件,下面分享一下UILabel的相关属性设置的方法. 很多学习iOS6编程都是从storyboard开始,用到UILabel时是将控件拖到storyboard ...
- iOS开发笔记--UILabel的相关属性设置
在iOS编程中UILabel是一个常用的控件,下面分享一下UILabel的相关属性设置的方法. 很多学习iOS6编程都是从storyboard开始,用到UILabel时是将控件拖到storyboard ...
- echarts爬坑 : 怎么Line折线图设置symbol:none后Label不见了?
用 echarts 时遇到了一个奇奇怪怪的问题. 这是一张折线图. 本来这个图是有数字显示的. series : [ { name:'搜索引擎', type:'line', stack: '总量', ...
- 深入浅出ECharts系列 (二) 折线图
深入浅出ECharts系列(二) 目标 本次教程的目标是实现“折线图堆叠”折线,实现结果如图: 2. 准备工作 a) 首先下载ECharts插件,你可以根据自己的实际需求选择你想要下载 ...
- echarts图表属性设置
原地址:http://blog.csdn.net/she_lover/article/details/51448967theme = { // 全图默认背景 // backgroundColor: ‘ ...
- echarts入门基础,画折线图
注意:一定要自己引入echarts库 <!DOCTYPE html> <html> <head> <meta charset="UTF-8" ...
- 设置TextBlock默认样式后,其他控件的Text相关属性设置失效问题
问题: 定义了默认TextBlock样式后,再次自定义下拉框 or 其他控件 ,当内部含有TextBlock时,设置控件的字体相关样式无效,系统始终使用TextBlock设置默认样式 解决方案: 为相 ...
随机推荐
- Part of defining a topology is specifying for each bolt which streams it should receive as input
http://storm.apache.org/ [doing for realtime processing what Hadoop did for batch processing ] Apach ...
- ABAP抓取异常 try ,endtry.
DATA: O_CX TYPE REF TO CX_ROOT. TRY . MOVE LS_UPLOAD-MENGE TO LS_OUTPUT-MENGE. CATCH CX_ROOT INTO O_ ...
- 对于URL中文和特殊字符的处理方法
1.中文的处理方法 NSString* string1 = @"https://www.cloudsafe.com/文件夹"; NSString* string2 = [strin ...
- querySelectorAll和getElementsBy 系列比较
querySelectorAll 相比下面这些方法有什么区别? (1)getElementsByTagName (2)getElementsByClassName (3)getElementsByNa ...
- POJ2406 Power Strings —— KMP or 后缀数组 最小循环节
题目链接:https://vjudge.net/problem/POJ-2406 Power Strings Time Limit: 3000MS Memory Limit: 65536K Tot ...
- 自动化测试框架selenium+java+TestNG——读取csv文件
读取csv文件可以直接读取,也可以使用javacsv.jar,后者比较简单,这个也可以变相认为是对表格的处理,我们可以在表格中做好数据,存储成csv格式的文件,后续对xlsx表格的操作抽个时间再记录下 ...
- APP测试走过的那些坑
我现在的工作有一大部分也是app测试,虽然自己是app开发出身,但是在测试上还是跌入了很多大坑,毕竟二者还是有很大不同,所处的角度也是不一样的.而开发转测试中,我认为较难的也是一个角度的转换,以一个开 ...
- ffmpeg遇到inttypes.h和UINT64_C
http://blog.csdn.net/cll131421/article/details/7763657 编译过程:错误一:无法打开包括文件:“inttypes.h”: No such file ...
- C++之虚函数与虚继承详解
准备工作 1.VS2012使用命令行选项查看对象的内存布局 微软的Visual Studio提供给用户显示C++对象在内存中的布局的选项:/d1reportSingleClassLayout.使用方法 ...
- bzoj 2151 种树——贪心+后悔
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2151 似乎是半年+前讲过的.(然而看到的时候却不会了) 考虑贪心,限制就是不能选两边的.如果 ...