echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Feature] Offset for bar type series

Open Andrea-LaRoss opened this issue 1 year ago • 5 comments

What problem does this feature solve?

Hi, In my project i have a timeseries that some line types series and some bars type series. One of the lines can be either a step start or a step end. Is it possible to align the bars type series to the lines maybe adding some type of offset?

What does the proposed API look like?

graphics_bars

Andrea-LaRoss avatar Oct 11 '24 15:10 Andrea-LaRoss

align the bars type series to the lines

You didn't specify how to align... By default, line points are positioned in the middle of bars (your example chart). Points could also be aligned to start or end of bars. Adding an empty bar series before or after the stacked ones creates the offset. Demo. image 📌 please close issue if problem solved.

helgasoft avatar Oct 12 '24 06:10 helgasoft

Yes sorry for not specifing. What i meant to request was some type of property of bars series that allow to have an horizontal offset positioning them before or after a point of line series regardless of the barStack or the barGap properties and the addition of an empty bar series, because if i add a barWidth bars will return in the middle of points. Is there a workaround to maintain this type of offset even when i add barWidth?

Andrea-LaRoss avatar Oct 14 '24 08:10 Andrea-LaRoss

Is there a workaround to maintain this type of offset even when i add barWidth?

did you try barWidth on all seeries, even the empty one ? it works.

helgasoft avatar Oct 15 '24 22:10 helgasoft

Yes like this works thank you very much. Last thing I need is this to work when I set barGap to '-100%' to get overlapping bars like here Overlapping bars. Do you know any way to achieve that type of offset?

Andrea-LaRoss avatar Oct 17 '24 10:10 Andrea-LaRoss

get overlapping bars.. Do you know any way to achieve that type of offset?

yes, with two X-axes, Demo image

helgasoft avatar Oct 18 '24 07:10 helgasoft

would be nice to be able to control the bar width to the left of its middle point and to the right, so that one could do something like barWidth: [0,100%] to have it all to the right of the middle point and [-100%,0] for the other behavior.

this would be similar to using a areaStyle: {} on a line series but still having access to the bar series API

dberardo-com avatar May 07 '25 08:05 dberardo-com