timbod7 / haskell-chart

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

FileOptions size should be optional #250

Open ad-si opened 1 year ago

ad-si commented 1 year ago

https://hackage.haskell.org/package/Chart-diagrams-1.9.4/docs/Graphics-Rendering-Chart-Backend-Diagrams.html#t:FileOptions size field should be Maybe (Double, Double). If it's set to Nothing, the width and height attributes would simply be omitted from the exported <svg> tag.

treeowl commented 1 year ago

I don't know much about this, but is it sometimes useful to include one and omit the other? That would lead to (Maybe Double, Maybe Double).

ad-si commented 1 year ago

Yeah, good idea, that would be even better!

But I just realized that probably the size is necessary to calculate the layout of the SVG. So maybe there are two sizes necessary. E.g.:

olorin37 commented 1 year ago

Or one size, but with additional parameter telling whether to include it in final image or not.

(I don't know if the size is require to render layout - just giving the idea in case it is).

ad-si commented 9 months ago

Or one size, but with additional parameter telling whether to include it in final image or not.

But you might want to calculate / generate it in a specific size (e.g. 1 mm == 1 px) and then display it at another size. So this might actually even be a good idea if it's not necessary to calculate the layout. Just as a way to have some control over the value magnitudes.