option = {
"grid":{
"left":20,
"right":0,
"top":"5%",
"bottom":35,
"containLabel":true
},
"tooltip":{
"show":true,
"textStyle":{
"color":"#3d464a"
},
"backgroundColor":"#fff",
"extraCssText":"box-shadow: 0 2px 12px rgba(49, 114, 149, 0.3);",
"trigger":"axis"
},
"xAxis":[
{
"axisTick":{
"show":false
},
"axisLine":{
"lineStyle":{
"color":"#A4A8AB"
}
},
"axisLabel":{
"textStyle":{
"color":"#A4A8AB"
},
"interval":"auto"
},
"type":"category",
"data":[
"1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月"
],
"axisPointer":{
"show":true,
"lineStyle":{
"type":"dotted"
},
"handle":{
"show":true,
"size":38,
"margin":40,
"shadowBlur":0,
"shadowColor":"transparent"
},
"value":"7月"
}
}
],
"yAxis":[
{
"type":"value",
"axisTick":{
"show":false
},
"axisLine":{
"show":false
},
"axisLabel":{
"textStyle":{
"color":"#A4A8AB"
}
},
"splitLine":{
"show":true,
"lineStyle":{
"type":"dotted",
"color":"#e6e8ee"
}
},
min: 0,
max: (value) => {
// 1900通过计算得出
// 这里想做的是,能拿到刻度的间距大小,
// 然后能够等间距地设置刻度,避免出现像1900不等间距的刻度,而是出现2100
return 1900;
}
}
],
"series":[
{
"code":"88bbc04a-1f23--3c2-9b86-0ed2d1f66c1b",
"name":"当月目标(总计)",
"type":"bar",
"data":[
300,
400,
500,
600,
700,
800,
900
],
"yAxisIndex":0,
"barMaxWidth":"40%",
"label":{
"normal":{
"show":false
}
},
"itemStyle":{
"emphasis":{
"opacity":0.8
}
},
"markLine":{
"data":[
{
"name":"辅助线1",
"yAxis":"1700"
}
],
"label":{
"normal":{
"show":true,
"position":"start",
"rich":{
"t":{
"padding":[
3,
5
],
"height":2
},
"a":{
"backgroundColor":"#E95950",
"color":"#fff",
"padding":[
3,
5
],
"align":"right",
"height":10
}
}
}
},
"symbol":[
"",
""
],
"lineStyle":{
"normal":{
"color":"#E95950"
}
}
},
"stack":"柱状堆积"
},
{
"code":"984afcd0-7d79--ecc-8d84-7b179bd0b99e",
"name":"当月实际(总计)",
"type":"bar",
"data":[
20,
40,
40,
98,
24,
47,
80
],
"yAxisIndex":0,
"barMaxWidth":"40%",
"label":{
"normal":{
"show":false
}
},
"itemStyle":{
"emphasis":{
"opacity":0.8
}
},
"stack":"柱状堆积"
}
],
"color":[
"#716eed",
"#b76ecb",
"#AF97CB",
"#DAC2DC",
"#F2D1D1",
"#EBA2D8",
"#84CEED",
"#8691CA"
]
}
One-line summary [问题简述]
设置了yAxis(type:value)的max后,max刻度就不是等间距的出现了。
Version & Environment [版本及环境]
Expected behaviour [期望结果]
目前想达到的效果是,我能根据刻度间距动态调整最大值。
ECharts option [ECharts配置项]
Other comments [其他信息]