getLineBar(opt) {
return {
legend: {
show: true,
top: 10,
...opt.legend,
},
tooltip: {
trigger: 'axis', axisPointer: { lineStyle: { type: 'dashed' } },
...opt.tooltip,
},
grid: {
left: 20, right: 20, bottom: (opt?.xAxis?.name==''||opt?.xAxis?.name==undefined)?10:25, containLabel: true,
...opt.grid,
},
xAxis: {
type: 'category',
name: '',
nameLocation: 'center',
nameGap: '25',
data: opt.xdata,
...opt.xAxis,
},
yAxis: opt.yAxis instanceof Array ? opt.yAxis.map(m => {
return {
type: 'value',
name: '',
...m
}
}) : {
type: 'value',
name: '',
...opt.yAxis
},
series: opt.series.map(m => {
return {
...m,
一个简单的echart options的封装函数
最新推荐文章于 2024-06-27 15:00:28 发布
本文介绍如何利用typescript简洁地封装echarts的options配置,通过一个简单的调用示例展示其实现过程。
摘要由CSDN通过智能技术生成