echarts x轴的所有配置项基本都在这了(y轴同理)
axisLine:坐标轴轴线相关设置。
axisTick:坐标轴刻度相关设置。
axisLabel:坐标轴刻度标签的相关设置。
splitLine: 坐标轴在 grid 区域中的分隔线设置。
splitArea :坐标轴在 grid 区域中的分隔区域,默认不显示。
xAxis: {
show: true,
position: 'top',
type: 'category',
nameRotate: 10,
inverse: false,
boundaryGap: ['20%', '20%'],
splitNumber: 5,
axisLine: {
show: true,
symbol: ['none', 'arrow'],
symbolSize: [10, 15],
lineStyle: {
color: '#333',
width: '5',
type: 'solid',
},
},
axisTick: {
show: true,
inside: true,
length: 5,
lineStyle: {
color: '#FFF',
width: 10,
type: 'solid',
},
},
axisLabel: {
show: true,
interval: '0',
inside: true,
rotate: 90,
margin: 10,
color: '#FFF',
fontStyle: 'normal',
fontWeight: 'normal',
fontSize: '20',
align: 'left',
verticalAlign: 'left',
lineHeight: '50',
backgroundColor: 'red',
},
splitLine: {
show: true,
interval: '0',
color: ['#ccc'],
width: 3,
type: 'solid',
},
splitArea: {
show: true,
interval: '0',
areaStyle: {
color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)'],
opacity: 1,
},
},
data: {
textStyle: {
color: '#FFF',
fontStyle: 'normal',
fontWeight: 'normal',
fontSize: '20',
align: 'left',
verticalAlign: 'left',
lineHeight: '50',
backgroundColor: 'red',
},
},
}
title配置
title: {
show: true,
text: '',
textAlign:'auto',
textVerticalAlign:'auto',
padding:0,
left:'auto',
right:'auto',
top:'auto',
bottom:'auto',
borderColor: '',
borderWidth: 1,
textStyle: {
color: '',
fontStyle: '',
fontSize: 14,
fontWeight: 400,
fontFamily: '',
lineHeight: ''
align:'center',
verticalAlign:'middle',
},
subtext: '',
subtextStyle: {
color: '#ccc',
fontStyle:'normal',
fontWeight:'normal',
fontFamily:'sans-serif',
fontSize:18,
lineHeight:18,
}
}
title: [
{
text: 'Michelson-Morley Experiment',
left: 'center'
},
{
text: 'upper: Q3 + 1.5 * IQR \nlower: Q1 - 1.5 * IQR',
borderColor: '#999',
borderWidth: 1,
textStyle: {
fontSize: 14
},
left: '10%',
top: '90%'
}
],
tooltip提示框组件配置项
axisPointer:坐标轴指示器配置项 label:坐标轴指示器的文本标签 lineStyle:axisPointer.type为line时有效 shadowStyle:axisPointer.type为shadow时有效 crossStyle:axisPointer.type为cross时有效。 textStyle:提示框浮层的文本样式
tooltip: {
show: true,
trigger: 'item',
axisPointer: {
type: 'line',
axis: 'auto',
snap: true,
z: 0,
label: {
show: false,
precision: 'auto',
formatter: {},
margin: 3,
color: '#fff',
fontStyle: '',
fontWeight: '',
fontFamily: '',
fontSize: 12,
lineHeigh: 20,
width: 20,
height: 100,
textBorderColor: '',
textBorderWidth: ,
textBorderType: 'solid',
textBorderDashOffset: 0,
textShadowColor: 'transparent',
textShadowBlur: 0,
textShadowOffsetX: 0,
textShadowOffsetY: 0,
overflow: 'none',
ellipsis: '',
padding: 0,
backgroundColor: 'auto',
borderColor: '',
borderWidth: 0,
shadowBlur: 3,
shadowColor: #aaa,
shadowOffsetX: 0,
shadowOffsetY: 0
},
lineStyle: {
color: #555, /颜色/
width: 1,
type: solid,
dashOffset: 0,
cap: 'butt',
join: 'bevel',
miterLimit: 10,
shadowBlur: 10,
shadowColor: '',
shadowOffsetX: 0,
shadowOffsetY: 0,
opacity: 1
},
shadowStyle: {
color: '#fff', /颜色,文章链接如下 Echart图表之颜色color配置项大全/
shadowBlur: 10,
shadowColor: '',
shadowOffsetX: 0,
shadowOffsetY: 0,
opacity: 1
},
crossStyle: {
color: '#fff', /颜色,/
shadowBlur: 10,
shadowColor: '',
shadowOffsetX: 0,
shadowOffsetY: 0,
opacity: 1
},
animation: line,
animationThreshold: 2000,
animationDuration: 1000,
animationEasing: 'cubicOut',
animationDelay: 0,
animationDurationUpdate: 200,
animationEasingUpdate: exponentialOut,
},
showContent: true,
alwaysShowContent: false,
triggerOn: 'mousemove|click',
showDelay: 0,
hideDelay: 100,
enterable: false,
renderMode: 'html',
confine: false,
appendToBody: false,
className: 'echarts-tooltip echarts-tooltip-dark',
transitionDuration: 0.4,
position: [],
formatter: ()=>{}, /提示框浮层内容格式器,用这个可以修改提示框默认内容/
valueFormatter: (value: number | string) => string,
backgroundColor: '',
borderColor: '',
borderWidth: 0,
padding: 5,
textStyle: {
color: '#fff', /颜色,文章链接如下 Echart图表之颜色color配置项大全/
fontStyle: '',
fontWeight: '',
fontFamily: '',
fontSize: 14,
lineHeight : 20,
width: 220,
height: 20,
textBorderColor: '',
textBorderWidth: '',
textBorderType: 'solid',
textBorderDashOffset: 0,
textShadowColor: 'transparent',
textShadowBlur: 0,
textShadowOffsetX: 0,
textShadowOffsetY: 0,
overflow: 'none',
ellipsis: '',
rich: {},
},
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);',
order: 'seriesAsc'
}
toolbox工具栏组件配置项
toolbox: {
id: '',
show: true,
orient: 'horizontal',
itemSize: 15,
itemGap: 8,
showTitle: true,
feature: {
saveAsImage: {
type: 'png',
name: '',
backgroundColor: 'auto',
connectedBackgroundColor: '#fff',
excludeComponents: ['toolbox'],
show: true,
title: '',
icon: '',
iconStyle: {
color: none, /颜色,参考下面/
borderColor: #666,
borderWidth: 1,
borderType: 'solid',
borderDashOffset: 0,
borderCap: 'butt',
borderJoin: 'bevel',
borderMiterLimit: 10,
shadowBlur: '',
shadowColor: '',
shadowOffsetX: 0,
shadowOffsetY: 0,
opacity: 1
},
emphasis: {
iconStyle: {
color: '', /图形颜色,参考下面/
borderColor: none,
borderWidth: 0,
borderType: 'solid',
borderDashOffset: 0,
borderCap: 'butt',
borderJoin: 'bevel',
borderMiterLimit: 10,
shadowBlur: '',
shadowColor: '',
shadowOffsetX: 0,
shadowOffsetY: 0,
opacity: 1,
textPosition: 'bottom',
textFill: '#000',
textAlign: 'center',
textBackgroundColor: '',
textBorderRadius: 0,
textPadding: 0
}
},
pixelRatio: 1
},
restore: {
show: true,
title: '还原',
icon: 'image://url',
iconStyle: {},
emphasis: {}
},
dataView: {
show: true,
title: '数据视图',
icon: '',
iconStyle: {},
emphasis: {},
readOnly: false,
optionToContent: function() {},
contentToOption: (container:HTMLDomElement, option:Object) => Object,
lang: ['数据视图', '关闭', '刷新'],
backgroundColor: '#fff',
textareaColor: '#fff',
textareaBorderColor: '#333',
textColor: '#000',
buttonColor: '#c23531',
buttonTextColor: '#fff'
},
dataZoom: { /这个有两个icon图标,所以基本都必须分开配置/
show: true,
title: {
zoom: '区域缩放',
back: '区域缩放还原'
},
icon: {
zoom: '',
back: ''
},
iconStyle: {},
emphasis: {},
filterMode: 'filter',
xAxisIndex: '',
yAxisIndex: '',
brushStyle: {}
},
magicType: {
show: true,
type: ['line', 'bar'],
title: {
line: '切换为折线图',
bar: '切换为柱状图',
stack: '切换为堆叠',
tiled: '切换为平铺',
},
icon: {
line: '',
bar: '',
stack: ''
},
iconStyle: {},
emphasis: {},
option: {
line: {},
bar: {},
stack: {}
},
seriesIndex: {
line: [],
bar: []
}
},
brush: {
type:,
icon: {
rect: '',
polygon: '',
lineX: '',
lineY: '',
keep: '',
clear: ''
},
title: {
rect: '矩形选择',
polygon: '圈选',
lineX: '横向选择',
lineY: '纵向选择',
keep: '保持选择',
clear: '清除选择'
}
},
myTool: { /这个比较常用,自定义icon与功能/
show: true,
title: '',
icon: '',
onclick: function() {}
}
},
iconStyle: {},
emphasis: {},
zlevel: 0,
z: 2,
left: 'auto',
top: 'auto',
right: 'auto',
bottom: 'auto',
width: 'auto',
height: 'auto',
tooltip: {} /工具箱tooltip配置,配置项同tooltip/
}
echarts画布大小与边距设置
grid: {
show:true,
left: "5%",
top: "5%",
right: "5%",
bottom: "5%"
backgroundColor: "rgba(224, 17, 17, 1)",
borderColor: "rgba(96, 67, 67, 1)",
containLabel: true
},
如下图所示:
|