名词 | 描述 |
---|
chart | 是指一个完整的图表,如折线图,饼图等“基本”图表类型或由基本图表组合而成的“混搭”图表,可能包括坐标轴、图例等 |
xAxis | 直角坐标系中的横轴,通常并默认为类目型 |
yAxis | 直角坐标系中的纵轴,通常并默认为数值型 |
grid | 直角坐标系中除坐标轴外的绘图网格,用于定义直角系整体布局 |
legend | 图例,表述数据和图形的关联 |
dataRange | 值域选择,常用于展现地域数据时选择值域范围 |
dataZoom | 数据区域缩放,常用于展现大量数据时选择可视范围 |
roamController | 缩放漫游组件,搭配地图使用 |
toolbox | 辅助工具箱,辅助功能,如添加标线,框选缩放等 |
tooltip | 气泡提示框,常用于展现更详细的数据 |
timeline | 时间轴,常用于展现同一系列数据在时间维度上的多份数据 |
series | 数据系列,一个图表可能包含多个系列,每一个系列可能包含多个数据 |
常用的属性
option = {
tooltip:{
formatter:'{c}',
},
legend:{
data:['良率']
},
xAxis: {
type: 'category',
data: ['08:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00', '00:00', '02:00', '04:00', '06:00'],
splitLine: { show: false },
axisLabel: {
color: '#79a5a5'
},
axisLine: { show: false },
axisTick: { show: false }
},
yAxis: {
type: 'value',
name: '良率 (%)',
nameTextStyle: {
color: '#79a5a5'
},
splitLine: { show: false },
axisLabel: {
color: '#79a5a5'
},
axisLine: { show: false },
axisTick: { show: false },
min: 0,
max: 100,
},
series: [{
name:'良率',
data: [90, 95, 90, 91, 96, 81, 91, 92, 78, 96, 91, 91],
type: 'line',
symbol: 'pin',
symbolSize:8,
symbolRotate:180,
showSymbol:true,
hoverAnimation:true,
label: {
normal: {
show: true
}
},
lineStyle: {
color: '#c7e821'
},
itemStyle: {
color: ({ data }) => {
if (data <= 80) { return '#ff0000 ' }
return '#c7e821'
}
},
markLine: {
symbol: 'none',
data: [
[{
value: 80,
lineStyle: {
color: '#36dcdc'
},
label: {
color: '#000',
position: 'middle',
formatter: '{c} %',
backgroundColor: '#36dcdc',
padding: 5,
borderRadius: 5
},
coord: ['08:00', 80]
}, {
coord: ['06:00', 80]
}]
]
},
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: '#505E0D'
}, {
offset: 1, color: '#171A14'
}],
global: false
}
}
}]