I have a program that performs a long-term calculation, where the result is shown as a graph. I am currently using Chart-0.14 . I want to show partial results and update during calculations.
Graphics.Rendering.Chart.Gtk.updateCanvas :: Renderable a -> DrawingArea -> IO Boolseems to be doing this, but I find no way to get the DrawingArea from the plot. The function renderableToWindow :: Renderable a -> Int -> Int -> IO ()returns nothing (and, in addition, it does not return until the window is closed).
I would like to do something like the following:
main = do
drawingArea = forkRenderableToWindow (toRenderable $ plotLayout $
plot [0,0.1..10] sin "sin(x)") 640 480
updateCanvas (toRenderable $ plotLayout $ plot [0,0.1..10] sin "sin(x)") drawingArea
How should I do it? I need to override the functions in the Graphics.Rendering.Chart.Gtkversion that returns DrawingAreaand somehow (how do I do this? ForkIO?) Returns immediately without closing the window?
source
share