Plot discontinuous lines
Question
Hello,
I'm currently using the Chart class to plot a line chart for a time series data. However, I've encountered an issue when trying to plot a line that has gaps (i.e., discontinuous line).
Here's a simplified version of my code:
chart = Chart()
bid1_line = chart.create_line('bid1_line', width=1, color='#FF0000')
data = df[['time', 'bid1_line']].dropna()
bid1_line.set(data)
In my data, there are periods where 'bid1_line' is NaN, and I would like these periods to appear as gaps in the line chart. However, the current implementation seems to connect the points before and after the gap, creating the impression of a continuous line.
I was wondering if there's a way to create a broken line chart using the Chart class? If not, could this feature be considered for a future update?
Thank you for your help.
Code example
No response
Hi, I also encountered the same situation. I checked and found that when I zoom in, I can occupy non continuous lines, but when I zoom out, it shows continuous lines. By the way, have you solved this problem? If there is a good solution, can you share it?
I changed the line style, still doesn't solve the problem.
nope, unfortunately, I couldn't find any solution for this behavior.
I just solved this by spliting the series, put them into two lists, and drawing them one by one using two for loops. Stupid but works.
Fixed in latest version. Just use NaN or None values in your DataFrame for whitespace.
Louis