I am using apache echarts version 5.2.2 for rendering a bar chart with datazooms for both cartesian axes. However I am finding an easy to reproduce bug with this code that can be found just in the dataZoom documentation.
That is what happens when I apply an inside
zoom to my bars, it ends up overflowing the space for the Y axis.
The code that produces this is the following, which can be pasted in the echarts example page:
option = {
dataZoom: [
{
id: 'dataZoomX',
type: 'inside',
xAxisIndex: [0],
filterMode: 'filter'
},
{
id: 'dataZoomY',
type: 'inside',
yAxisIndex: [0],
filterMode: 'empty'
}
],
xAxis: {type: 'value'},
yAxis: {type: 'value'},
series: {
type: 'bar',
data: [
// The first column corresponds to xAxis,
// and the second column corresponds to yAxis.
[12, 24, 36],
[90, 80, 70],
[3, 9, 27],
[1, 11, 111]
]
}
}
I have read the suggested configurations for the filterMode
property, but this bug happens whether if I use filter
, weakFilter
, etc. I have also seen this work properly for other charts that have an X axis of type category
, but mine is of type value
and the inside
zooms are mandatory.
Am I missing something? Thanks for your help.
Seems like echarts places the bars as long as the center is inside the grid. I dont see an inbuild way around that currently. Here are some possible suggestions:
barMaxWidth
and yAxisoffset
to make space between bars and the yAxis. (Note, that for some reason a second yAxis is neccessary foroffset
to work properly).Example:
dataZoom
event to adjust the data by yourself if its overlapping the axis.Example: