plotly.rs icon indicating copy to clipboard operation
plotly.rs copied to clipboard

Please support range breaks

Open bionicles opened this issue 11 months ago • 1 comments

Hi, thank you for maintaining this crate!

I'm working on some financial charts and curious if it would be possible to support range breaks to hide weekends for data which only happens during business days?

Benefit: time series data could look better with skipping weekends / "routine discontinuities" where there's no data

In the Python API, this is in fig.update_layout as the xaxis_rangebreaks argument.

I checked the book, the Axis, and the Layout, didn't see any rangebreaks

It would be ideal if a solution could be flexible enough to support days of the week (weekends) as well as hours of days (e.g. when markets are closed overnight in hourly financial data)

Here is the API reference for the python version of this feature: https://plotly.com/python/reference/layout/xaxis/#layout-xaxis-rangebreaks

And here is a guide section: https://plotly.com/python/time-series/#hiding-weekends-and-holidays

Happy New Year and I look forward to use this more and help out. I really appreciate the speed of the library in cranking plots!

bionicles avatar Dec 30 '24 16:12 bionicles

Hi @bionicles,

You are correct, rangebreaks support is not implemented yet. Should be straightforward to add, by looking into how rangeselector has been implemented.

Currently I am trying to fix & close some of the older issues, so don't know when I will come round to this.

Feel free to submit a PR.

andrei-ng avatar Jan 04 '25 08:01 andrei-ng

@bionicles Just added rangebreaks in https://github.com/plotly/plotly.rs/pull/312, it supports the examples you pointed to. Check the new examples in financial charts and the mdBook.

andrei-ng avatar Jun 20 '25 21:06 andrei-ng