haskell-chart icon indicating copy to clipboard operation
haskell-chart copied to clipboard

How to put a PieChart or PieLayout in a Grid?

Open cblp opened this issue 5 years ago • 3 comments

I need to draw a pie chart beside a simple plot on a single canvas.

cblp avatar Jun 03 '20 09:06 cblp

I tried tval . pieToRenderable, but cannot unify LayoutPick and PickFn

cblp avatar Jun 03 '20 09:06 cblp

I managed to draw a pie beside a plot with help of #218 and [1], but it looks like this:

[ pie ][      ]
[     ][ plot ]

while I expect

[ pie ][ plot ]

[1]:

-- | Generalize LayoutPick to PickFn under Grid.
layoutToGrid' ::
    (Ord x, Ord y) =>
    Layout x y -> Grid (Renderable (PickFn (LayoutPick x y y)))
layoutToGrid' = fmap (fmap (const . Just)) . layoutToGrid

cblp avatar Jun 03 '20 11:06 cblp

  • pie `above` plot
  • pie `beside` plot
  • pie `overlay` plot

all give the same result:

[ pie ][      ]
[     ][ plot ]

cblp avatar Aug 31 '21 15:08 cblp