diff --git a/src/DearImGui/Plot.hs b/src/DearImGui/Plot.hs index f4e90f3..f4a1436 100644 --- a/src/DearImGui/Plot.hs +++ b/src/DearImGui/Plot.hs @@ -27,6 +27,9 @@ module DearImGui.Plot -- * Demo so you can play with all features , Raw.Plot.showPlotDemoWindow + -- * Plot Creation + , withPlot + -- * TEST , plotLine ) @@ -80,6 +83,11 @@ plotLine label xs ys = liftIO $ do withArray (map realToFrac ys) \ysPtr -> do Raw.Plot.plotLine labelPtr xsPtr ysPtr size +withPlot :: (MonadIO m) => String -> m () -> m () +withPlot p a = Raw.Plot.beginPlot p >>= \case + False -> return () + True -> a >> Raw.Plot.endPlot + -- setNextPlotLimits :: MonadIO m => (Double, Double) -> (Double, Double) -> m () -- setNextPlotLimits (minX, maxX) (minY, maxY) = liftIO $ do -- Raw.Plot.setNextPlotLimits (minX', maxX') (minY', maxY')