1.0.1 • Published 5 months ago
echarts-yaxis-options v1.0.1
echarts-yaxis-options
echarts动态匹配Y轴刻度线的工具函数
使用方法
import { getYAxisOptions } from 'echarts-yaxis-options'
const mockData = [
102345, 117654, 132987, 145678, 109876, 123456, 147258, 111111, 135790, 104321,
126543, 148901, 112345, 136902, 105678, 127890, 149012, 113456, 137890, 106789,
128901, 141234, 114567, 138901, 107890, 129012, 142345, 115678, 139012, 108901
]
chart.setOption({
...,
yAxis: {
type: 'value',
...getYAxisOptions(mockData)
}
})
参数说明
const { min, max, interval } = getYAxisOptions(numberList)
- 入参:numberList(Array)
Y轴数据值
- 出参:min
Y轴刻度最小值
- 出参:max
Y轴刻度最大值
- 出参:interval
Y轴刻度间隔值