How to remove weekend datetime gaps from x-axis of a financial chart?

前端 未结 5 956
[愿得一人]
[愿得一人] 2021-01-06 16:31

I have a use case where I pull and plot Forex data in the form of ask and bid on the graph and this is based on minute, hour or day candlesti

5条回答
  •  太阳男子
    2021-01-06 16:59

    First of all, no need to quit on Plotly. The use of rangebreaks is indeed the tool to use, but that’s one side of it. I say this because for stock data bounds aren't practical compared to values, but you would be specifying dates for many holidays per year, and most of them change from one year to the other. So use values for rangebreaks and feed it with a list of every date that you don’t have in the CSV file you are loading. In case you need a bigger push to solve this, what I mean is taking the ‘date’ column aside, looping through it, and appending dates that are not there in another list. Then you can go fig.update_xaxes(rangebreaks=[dict(values=mylistofdates)]) Hope this brings you back to Plotly!

提交回复
热议问题