Noticed while testing go-chart in a UI with fairly frequent re-render requirements:
There is no in-memory renderer that would let the user simply acquire an image.Image for display purposes. Using the PNG in raster_renderer.go will incur overhead as it encodes the compressed image.
The simple change request here adds a new utility method (InMemory()), which internally extends the existing rasterRenderer to send the generated image.Image through a callback, rather than serializing to a compressed image format.
The setup of widgets' Render(RenderProvider, io.Writer) is a bit unwieldy here. I would further suggest splitting the .Save() from the .Render(), either explicitly (requiring the graph creator to call Save()) or perhaps by a similar callback for PNG as I use here with InMemory(). I have not looked too deeply into this yet.
Noticed while testing go-chart in a UI with fairly frequent re-render requirements: There is no in-memory renderer that would let the user simply acquire an image.Image for display purposes. Using the PNG in raster_renderer.go will incur overhead as it encodes the compressed image.
The simple change request here adds a new utility method (InMemory()), which internally extends the existing rasterRenderer to send the generated image.Image through a callback, rather than serializing to a compressed image format.
The setup of widgets' Render(RenderProvider, io.Writer) is a bit unwieldy here. I would further suggest splitting the .Save() from the .Render(), either explicitly (requiring the graph creator to call Save()) or perhaps by a similar callback for PNG as I use here with InMemory(). I have not looked too deeply into this yet.