timbod7 / haskell-chart

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

Question: Why is there no ToPlot PlotBars #245

Open petercoppensdatylon opened 1 year ago

petercoppensdatylon commented 1 year ago

Hello,

I am new to Haskell in general and certainly to the Haskell Chart package.

While learning I was trying to change example 1 to render a barchart. But I run into the fact that there seems not be an instance of ToPlot for PlotBars.

E.g. code below gives a compile error: No instance for (ToPlot PlotBars) arising from a use of ‘plot’

` bvals :: [(String, [Double])] bvals = [ ("b1", [61]),("b2", [22]),("b3", [42]),("b4", [32]),("b5", [1])]

pb3 :: EC (Layout PlotIndex Double) () pb3 = do let dd = addIndexes (bvals ^.. traverse . _2) let xx = bars [ "Title"] dd plot xx

`

I can create a barchart in other ways following other examples, but I was wondering whether there is a reason for this missing instance or just something that was not implemented (yet)

Tx!

Peter