timbod7 / haskell-chart

A 2D charting library for haskell
429 stars 85 forks source link

Gray out areas with no results #251

Open CGenie opened 1 year ago

CGenie commented 1 year ago

Hello,

Thank you for this nice library.

I'm trying to create a line plot where I want to add a light gray rectangle where there are no results. I do have some heuristic on how to tell which data I want to gray out (since it's discrete anyways).

My plot is more or less like this:

  plot_lines_style .= (line_width .~ 2 $ line_color .~ opaque red $ def)
  plot_lines_values .= [[(ts, v.avg) | (ts, v) <- values]]

ts is of type UTCTime so the axis is determined automatically by the library to be of date-time type.

I'm guessing the code should be close to the one in Graphics.Rendering.Chart.Plot.FillBetween:

https://hackage.haskell.org/package/Chart-1.9.4/docs/Graphics-Rendering-Chart-Plot-FillBetween.html.

However, I'm not sure how to set y axis so that the whole y axis range is greyed out.