echarts
echarts copied to clipboard
横堆积柱状图X轴的splitLine不等分
问题简述 (One-line summary)
横堆积的柱状图,X轴的splitLine没有将坐标轴区域均等的进行划分,一般是最后一块和之前的几块大小有明显的不一样,看起来很难看
版本及环境 (Version & Environment)
- ECharts 版本 (3.1.5):
- 浏览器类型和版本 (chrome 49.0.2623.110 m):
- 操作系统类型和版本 (windows7 专业版):
重现步骤 (Steps to reproduce)
1.设置option中的splitLine线 2.setOption
期望结果 (Expected behaviour)
得到的柱状图背景线能够将坐标轴区域均等的划分
ECharts配置项 (ECharts option)
option = {
"calculable": false,
"color": ["#42ccef", "#9592f0", "#de90f4", "#5ed1b8", "#5592ee", "#b97d78", "#f194b3", "#f3ce03", "#a7e52d", "#90a7de"],
"tooltip": {
"trigger": "item"
},
"xAxis": [{
"max": 125.04,
"show": true,
"splitLine": {
"lineStyle": {
"type": "dashed"
}
},
"axisLine": {
"show": true
},
"axisLabel": {
"show": false,
"margin": 8,
"textStyle": {
"fontSize": "12",
"fontFamily": "Microsoft Yahei",
"align": "left"
}
},
"axisTick": {
"show": false
},
"type": "value",
"name": "Event Quantity",
"scale": false
}],
"yAxis": [{
"splitLine": {
"show": true,
"lineStyle": {
"type": "dashed"
}
},
"axisLine": {
"show": false
},
"axisLabel": {
"margin": 5,
"textStyle": {
"fontSize": "12",
"fontFamily": "Microsoft Yahei",
"color": "#666666",
"align": "right"
}
},
"axisTick": {
"show": false
},
"type": "category",
"data": ["测试长...", "Eventde...", "可行性"],
"show": true,
"name": "nihao",
"scale": true,
"max": "200",
"min": "0"
}],
"series": [{
"barMaxWidth": 14,
"name": "GML",
"type": "bar",
"stack": "总量",
"itemStyle": {
"normal": {
"barBorderRadius": [1, 7, 7, 0]
},
"emphasis": {
"barBorderRadius": [1, 7, 7, 0]
}
},
"data": [{
"name": "测试长度是否还",
"value": "100"
}, {
"name": "Eventdeductionactivu",
"value": "67"
}, {
"name": "可行性",
"value": "23"
}],
"label": {
"normal": {
"show": true,
"position": "right",
"textStyle": {
"fontSize": "14",
"fontFamily": "Helvetica",
"fontStyle": "normal",
"color": "#333333",
"align": "left"
}
},
"emphasis": {
"show": true,
"position": "right",
"textStyle": {
"fontSize": "14",
"fontFamily": "Helvetica",
"fontStyle": "normal",
"color": "#333333",
"align": "left"
}
}
}
}],
"grid": {
"left": 64,
"top": 30,
"right": 95.19999999999997,
"bottom": 20,
"borderWidth": 0,
"bordcolor": "#e5e5e5"
},
"colorList": ["#42ccef"],
"title": {
"show": false,
"text": "",
"subtext": ""
},
"dataZoom": [{
"show": false,
"type": "slider"
}],
"event": [{
"type": "click"
}, {
"type": "click"
}],
"theme": "agileUITheme",
"chartType": "bar",
"colorRangeList": [
[0, 50],
[50, 80],
[80, 101]
],
"animation": false,
"maxMinPoint": false,
"averageLine": true
}
其他信息 (Other comments)

这是因为你固定了 max
@pissang 但是在echarts2中即使固定了max也不会出现这样的情况

因为 3 中要保证刻度的好看,2 中是等分了,但是刻度都是小数点后几位的,你如果想要确定等分可以固定设置 interval