epezent / implot

Immediate Mode Plotting
MIT License
4.78k stars 531 forks source link

Hiding parts of the plot with no data for time series data #364

Open goodle06 opened 2 years ago

goodle06 commented 2 years ago

Hi!

Awesome library, thank you. Could you please let me know how I can implement this: I have a time series data and so my x-axis is time - ImPlotAxisFlags_Time. On some dates I don't have any values and for example PlotLine just produces flat line. I would like to be able to hide those parts of the plot.

epezent commented 2 years ago

You can insert a NaN for dates without values, and ImPlot will treat them as missing data (as demoed in the NaN Values section of the demo):

image

goodle06 commented 2 years ago

@epezent Hi, Sorry, it seems I wasn't clear enough. I don't want plot to show axis chunks with no data. Illustration here:

image

Is it doable?

epezent commented 2 years ago

It's not currently doable with our Time scale ticker. We would need to adopt an ordinal scale or have some complicated transformation logic to handle discontinuities in lines that cross the gap. A few folks have asked for the ability to hide weekends, but I don't have an answer at the moment. Sorry.

(you could of course generate your own ticks, but that's an annoying solution, I know)

goodle06 commented 2 years ago

@epezent Okay, thank you for quick feedback and awesome library!