KarthikRIyer / swiftplot

Swift library for Data Visualization :bar_chart:
Apache License 2.0
401 stars 39 forks source link

Add functions to get base64 png image from AGGRenderer #14

Closed KarthikRIyer closed 5 years ago

KarthikRIyer commented 5 years ago

13

KarthikRIyer commented 5 years ago

The last commit actually introduced a bug. I'll correct it.

KarthikRIyer commented 5 years ago

I've updated the AGG Renderer code to support SubPlots. I also found there was a problem in changing the plot size in SVG too. I've solved the SVG probem. I still haven't been able to solve the problem with AGG, i.e. to change the plot size. At the moment AGGRenderer also has a memory leak problem.

KarthikRIyer commented 5 years ago

Also I'd like to test the current work in Jupyter notebook and also add an example for the same, for which I'll have to add a tag. So, can I do that? If so, what should I use, because obviously this isn't an actual release.

KarthikRIyer commented 5 years ago

@marcrasi @BradLarson could you please review?

KarthikRIyer commented 5 years ago

That's alright. Do you mean Memorial Day? The weather in India's scorching hot, with temperatures going up to 44℃! You just don't feel like getting out of the house.

Thanks for the review. I too have been thinking it would be nice to have to just import SwiftPlot. I'll make the changes in the next PR.

BradLarson commented 5 years ago

@KarthikRIyer - My thinking is that the generic Renderer interface would be part of the SwiftPlot module. Specific instances of Renderers (AGGRenderer, SVGRenderer) could potentially be modules outside of SwiftPlot, and they would depend on SwiftPlot to build (and use import SwiftPlot within them).

Whether or not to have external renderers as separate modules or as part of SwiftPlot is something I go back and forth on. It may depend on how Renderers are selected by the end user. Do we want them to manually import AGGRenderer when they want to use that?

We're going to need to have conditional inclusion of Renderers based on platform, because on iOS we may not want the weight of an AGGRenderer, and if we create a CGRenderer (for Core Graphics) it wouldn't be supported on non-Apple platforms. This could be done, even if these were part of the framework, by using conditional compilation (#if os(iOS), etc.), but I don't know if we want to be more explicit about that.

KarthikRIyer commented 5 years ago

I think if having separate modules for each renderer does give us the modularity to implement renderers not included in the package, we should go for that. In the end, the user will have to write something like var svg_renderer : SVGRenderer = SVGRenderer() and pass it to the plot to draw. So why not write an extra line to import it...