最近需要实现大致如图的图表效果,找了很多文章和官网配置说明最终版的配置如下:
可以通过定义一个函数,传入要展示在图表的数据,返回最终的图标配置如下,
export const echartoption1 = (yAxisdata: string[], seriesData: string[]) => {
return {
grid: {
top: "0%",
left: "3%",
right: "4%",
bottom: "2%",
containLabel: true
},
xAxis: [
{
type: "value",
show: false, //隐藏X轴
min: Math.ceil(Math.min.apply(null, seriesData.map(Number))) - 25,
max: Math.ceil(Math.max.apply(null, seriesData.map(Number))) + 25
}
],
yAxis: [
{
type: "category",
axisTick: {
show: false //隐藏刻度线
},
axisLine: {
show: true