Open AshleyYakeley opened 5 years ago
Some question over different cairo libraries?
Making good progress with the "Chart → diagrams → Cairo → GTK" pipeline.
Related: diagrams/diagrams-cairo#76 for that second arrow.
Probably best to follow the Haskell types where possible.
Renderable
makes sense to be a supertype of various things:
Layout <: Renderable
StackedLayout <: Renderable
Rectangle <: Renderable
etc.
Layout is a bit awkward, as there is Layout
and LayoutLR
, which share a number of fields.
Throughout this module, from a "lens" perspective we are interested in setting or constructing fields, but not getting them. In any case, we certainly want a "default with modifications" approach, rather than having to construct every field of a structure.
Could do something like this:
Layout <: Renderable
[Layout] <: Layout
layoutXAxis: Axis -> Layout
layoutYAxis: Axis -> Layout
layoutPlot: Plot -> Layout
etc.
What about different plot scales? Double
, Time
, Integer
, etc.
[Renderable] <: Renderable
Layout <: Renderable
layoutTitle: Text -> Layout -> Layout
-- etc. for setting propertieslayout: Axis x -> Axis y -> [Plot x y] -> Layout
layoutLR: Axis x -> Axis y1 -> Axis y2 -> [Either (Plot x y1) (Plot x y2)] -> Layout
(Axis
witnesses Ord
constraint.)Maybe fix "Chart → Cairo", to simplify pipeline.
Alternative: create our own approach based on ggplot2, using Cairo.
Options:
Discussion from 2016.