{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ExistentialQuantification #-}
module Graphics.Rendering.Chart.Layout
(
Layout(..)
, LayoutLR(..)
, LayoutAxis(..)
, LayoutPick(..)
, StackedLayouts(..)
, StackedLayout(..)
, MAxisFn
, layoutToRenderable
, layoutToGrid
, layoutLRToRenderable
, layoutLRToGrid
, renderStackedLayouts
, laxis_title_style
, laxis_title
, laxis_style
, laxis_generate
, laxis_override
, laxis_reverse
, layout_background
, layout_plot_background
, layout_title
, layout_title_style
, layout_x_axis
, layout_top_axis_visibility
, layout_bottom_axis_visibility
, layout_y_axis
, layout_left_axis_visibility
, layout_right_axis_visibility
, layout_margin
, layout_plots
, layout_legend
, layout_grid_last
, layout_axes_styles
, layout_axes_title_styles
, layout_all_font_styles
, layout_foreground
, layoutlr_background
, layoutlr_plot_background
, layoutlr_title
, layoutlr_title_style
, layoutlr_x_axis
, layoutlr_top_axis_visibility
, layoutlr_bottom_axis_visibility
, layoutlr_left_axis
, layoutlr_right_axis
, layoutlr_left_axis_visibility
, layoutlr_right_axis_visibility
, layoutlr_plots
, layoutlr_legend
, layoutlr_margin
, layoutlr_grid_last
, layoutlr_axes_styles
, layoutlr_axes_title_styles
, layoutlr_all_font_styles
, layoutlr_foreground
, slayouts_layouts
, slayouts_compress_legend
) where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<$>))
#endif
import Graphics.Rendering.Chart.Axis
import Graphics.Rendering.Chart.Geometry
import Graphics.Rendering.Chart.Drawing
import Graphics.Rendering.Chart.Utils
import Graphics.Rendering.Chart.Plot
import Graphics.Rendering.Chart.Legend
import Graphics.Rendering.Chart.Renderable
import Graphics.Rendering.Chart.Grid
import Control.Monad
import Control.Lens hiding (at)
import Data.Colour
import Data.Colour.Names (white)
import Data.Default.Class
import Data.Maybe (fromMaybe)
type MAxisFn t = [t] -> Maybe (AxisData t)
data LayoutAxis x = LayoutAxis
{ LayoutAxis x -> FontStyle
_laxis_title_style :: FontStyle
, LayoutAxis x -> String
_laxis_title :: String
, LayoutAxis x -> AxisStyle
_laxis_style :: AxisStyle
, LayoutAxis x -> AxisFn x
_laxis_generate :: AxisFn x
, LayoutAxis x -> AxisData x -> AxisData x
_laxis_override :: AxisData x -> AxisData x
, LayoutAxis x -> Bool
_laxis_reverse :: Bool
}
data LayoutPick x y1 y2 = LayoutPick_Legend String
| LayoutPick_Title String
| LayoutPick_XTopAxisTitle String
| LayoutPick_XBottomAxisTitle String
| LayoutPick_YLeftAxisTitle String
| LayoutPick_YRightAxisTitle String
| LayoutPick_PlotArea x y1 y2
| LayoutPick_XTopAxis x
| LayoutPick_XBottomAxis x
| LayoutPick_YLeftAxis y1
| LayoutPick_YRightAxis y2
deriving (Int -> LayoutPick x y1 y2 -> ShowS
[LayoutPick x y1 y2] -> ShowS
LayoutPick x y1 y2 -> String
(Int -> LayoutPick x y1 y2 -> ShowS)
-> (LayoutPick x y1 y2 -> String)
-> ([LayoutPick x y1 y2] -> ShowS)
-> Show (LayoutPick x y1 y2)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall x y1 y2.
(Show x, Show y1, Show y2) =>
Int -> LayoutPick x y1 y2 -> ShowS
forall x y1 y2.
(Show x, Show y1, Show y2) =>
[LayoutPick x y1 y2] -> ShowS
forall x y1 y2.
(Show x, Show y1, Show y2) =>
LayoutPick x y1 y2 -> String
showList :: [LayoutPick x y1 y2] -> ShowS
$cshowList :: forall x y1 y2.
(Show x, Show y1, Show y2) =>
[LayoutPick x y1 y2] -> ShowS
show :: LayoutPick x y1 y2 -> String
$cshow :: forall x y1 y2.
(Show x, Show y1, Show y2) =>
LayoutPick x y1 y2 -> String
showsPrec :: Int -> LayoutPick x y1 y2 -> ShowS
$cshowsPrec :: forall x y1 y2.
(Show x, Show y1, Show y2) =>
Int -> LayoutPick x y1 y2 -> ShowS
Show)
type LegendItem = (String,Rect -> BackendProgram ())
data Layout x y = Layout
{ Layout x y -> FillStyle
_layout_background :: FillStyle
, Layout x y -> Maybe FillStyle
_layout_plot_background :: Maybe FillStyle
, Layout x y -> String
_layout_title :: String
, Layout x y -> FontStyle
_layout_title_style :: FontStyle
, Layout x y -> LayoutAxis x
_layout_x_axis :: LayoutAxis x
, Layout x y -> AxisVisibility
_layout_top_axis_visibility :: AxisVisibility
, Layout x y -> AxisVisibility
_layout_bottom_axis_visibility :: AxisVisibility
, Layout x y -> LayoutAxis y
_layout_y_axis :: LayoutAxis y
, Layout x y -> AxisVisibility
_layout_left_axis_visibility :: AxisVisibility
, Layout x y -> AxisVisibility
_layout_right_axis_visibility :: AxisVisibility
, Layout x y -> [Plot x y]
_layout_plots :: [Plot x y]
, Layout x y -> Maybe LegendStyle
_layout_legend :: Maybe LegendStyle
, Layout x y -> Double
_layout_margin :: Double
, Layout x y -> Bool
_layout_grid_last :: Bool
}
instance (Ord x, Ord y) => ToRenderable (Layout x y) where
toRenderable :: Layout x y -> Renderable ()
toRenderable = PickFn () -> Renderable (LayoutPick x y y) -> Renderable ()
forall b a. PickFn b -> Renderable a -> Renderable b
setPickFn PickFn ()
forall a. PickFn a
nullPickFn (Renderable (LayoutPick x y y) -> Renderable ())
-> (Layout x y -> Renderable (LayoutPick x y y))
-> Layout x y
-> Renderable ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Layout x y -> Renderable (LayoutPick x y y)
forall x y.
(Ord x, Ord y) =>
Layout x y -> Renderable (LayoutPick x y y)
layoutToRenderable
layoutToRenderable :: forall x y . (Ord x, Ord y) => Layout x y -> Renderable (LayoutPick x y y)
layoutToRenderable :: Layout x y -> Renderable (LayoutPick x y y)
layoutToRenderable Layout x y
l = FillStyle
-> Renderable (LayoutPick x y y) -> Renderable (LayoutPick x y y)
forall a. FillStyle -> Renderable a -> Renderable a
fillBackground (Layout x y -> FillStyle
forall x y. Layout x y -> FillStyle
_layout_background Layout x y
l) (Renderable (LayoutPick x y y) -> Renderable (LayoutPick x y y))
-> Renderable (LayoutPick x y y) -> Renderable (LayoutPick x y y)
forall a b. (a -> b) -> a -> b
$ Grid (Renderable (LayoutPick x y y))
-> Renderable (LayoutPick x y y)
forall a. Grid (Renderable a) -> Renderable a
gridToRenderable (Layout x y -> Grid (Renderable (LayoutPick x y y))
forall x y.
(Ord x, Ord y) =>
Layout x y -> Grid (Renderable (LayoutPick x y y))
layoutToGrid Layout x y
l)
layoutToGrid :: forall x y . (Ord x, Ord y) => Layout x y -> Grid (Renderable (LayoutPick x y y))
layoutToGrid :: Layout x y -> Grid (Renderable (LayoutPick x y y))
layoutToGrid Layout x y
l = Grid (Renderable (LayoutPick x y y))
grid
where
lp :: Grid a -> a -> Grid a
lp :: Grid a -> a -> Grid a
lp = case LegendPosition -> Maybe LegendPosition -> LegendPosition
forall a. a -> Maybe a -> a
fromMaybe LegendPosition
LegendBelow (Maybe LegendPosition -> LegendPosition)
-> Maybe LegendPosition -> LegendPosition
forall a b. (a -> b) -> a -> b
$ LegendStyle -> LegendPosition
_legend_position (LegendStyle -> LegendPosition)
-> Maybe LegendStyle -> Maybe LegendPosition
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Layout x y -> Maybe LegendStyle
forall x y. Layout x y -> Maybe LegendStyle
_layout_legend Layout x y
l of
LegendPosition
LegendAbove -> (a -> Grid a -> Grid a) -> Grid a -> a -> Grid a
forall a b c. (a -> b -> c) -> b -> a -> c
flip a -> Grid a -> Grid a
forall a. a -> Grid a -> Grid a
wideAbove
LegendPosition
LegendBelow -> Grid a -> a -> Grid a
forall a. Grid a -> a -> Grid a
aboveWide
LegendPosition
LegendRight -> Grid a -> a -> Grid a
forall a. Grid a -> a -> Grid a
besideTall
LegendPosition
LegendLeft -> (a -> Grid a -> Grid a) -> Grid a -> a -> Grid a
forall a b c. (a -> b -> c) -> b -> a -> c
flip a -> Grid a -> Grid a
forall a. a -> Grid a -> Grid a
tallBeside
title :: Renderable (LayoutPick x yl yr)
title = Double -> FontStyle -> String -> Renderable (LayoutPick x yl yr)
forall x yl yr.
Double -> FontStyle -> String -> Renderable (LayoutPick x yl yr)
titleToRenderable Double
lm (Layout x y -> FontStyle
forall x y. Layout x y -> FontStyle
_layout_title_style Layout x y
l) (Layout x y -> String
forall x y. Layout x y -> String
_layout_title Layout x y
l)
plotArea :: Grid (Renderable (LayoutPick x y y))
plotArea = (Double, Double, Double, Double)
-> Grid (Renderable (LayoutPick x y y))
-> Grid (Renderable (LayoutPick x y y))
forall a.
(Double, Double, Double, Double)
-> Grid (Renderable a) -> Grid (Renderable a)
addMarginsToGrid (Double
lm,Double
lm,Double
lm,Double
lm) (Layout x y -> Grid (Renderable (LayoutPick x y y))
forall x y.
(Ord x, Ord y) =>
Layout x y -> Grid (Renderable (LayoutPick x y y))
layoutPlotAreaToGrid Layout x y
l)
legend :: Renderable (LayoutPick x y y)
legend = Layout x y -> [LegendItem] -> Renderable (LayoutPick x y y)
forall x y.
Layout x y -> [LegendItem] -> Renderable (LayoutPick x y y)
renderLegend Layout x y
l (Layout x y -> [LegendItem]
forall x y. Layout x y -> [LegendItem]
getLegendItems Layout x y
l)
grid :: Grid (Renderable (LayoutPick x y y))
grid = Renderable (LayoutPick x y y)
forall x yl yr. Renderable (LayoutPick x yl yr)
title Renderable (LayoutPick x y y)
-> Grid (Renderable (LayoutPick x y y))
-> Grid (Renderable (LayoutPick x y y))
forall a. a -> Grid a -> Grid a
`wideAbove` (Grid (Renderable (LayoutPick x y y))
plotArea Grid (Renderable (LayoutPick x y y))
-> Renderable (LayoutPick x y y)
-> Grid (Renderable (LayoutPick x y y))
forall a. Grid a -> a -> Grid a
`lp` Renderable (LayoutPick x y y)
legend)
lm :: Double
lm = Layout x y -> Double
forall x y. Layout x y -> Double
_layout_margin Layout x y
l
getLayoutXVals :: Layout x y -> [x]
getLayoutXVals :: Layout x y -> [x]
getLayoutXVals Layout x y
l = (Plot x y -> [x]) -> [Plot x y] -> [x]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (([x], [y]) -> [x]
forall a b. (a, b) -> a
fst (([x], [y]) -> [x]) -> (Plot x y -> ([x], [y])) -> Plot x y -> [x]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Plot x y -> ([x], [y])
forall x y. Plot x y -> ([x], [y])
_plot_all_points) (Layout x y -> [Plot x y]
forall x y. Layout x y -> [Plot x y]
_layout_plots Layout x y
l)
getLegendItems :: Layout x y -> [LegendItem]
getLegendItems :: Layout x y -> [LegendItem]
getLegendItems Layout x y
l = [[LegendItem]] -> [LegendItem]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ Plot x y -> [LegendItem]
forall x y. Plot x y -> [LegendItem]
_plot_legend Plot x y
p | Plot x y
p <- Layout x y -> [Plot x y]
forall x y. Layout x y -> [Plot x y]
_layout_plots Layout x y
l ]
renderLegend :: Layout x y -> [LegendItem] -> Renderable (LayoutPick x y y)
renderLegend :: Layout x y -> [LegendItem] -> Renderable (LayoutPick x y y)
renderLegend Layout x y
l [LegendItem]
legItems = Grid (Renderable (LayoutPick x y y))
-> Renderable (LayoutPick x y y)
forall a. Grid (Renderable a) -> Renderable a
gridToRenderable Grid (Renderable (LayoutPick x y y))
forall x yl yr. Grid (Renderable (LayoutPick x yl yr))
g
where
g :: Grid (Renderable (LayoutPick x yl yr))
g = [Grid (Renderable (LayoutPick x yl yr))]
-> Grid (Renderable (LayoutPick x yl yr))
forall a. [Grid a] -> Grid a
besideN [ Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a. a -> Grid a
tval (Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr)))
-> Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a b. (a -> b) -> a -> b
$ Maybe LegendStyle
-> Double -> [LegendItem] -> Renderable (LayoutPick x yl yr)
forall x yl yr.
Maybe LegendStyle
-> Double -> [LegendItem] -> Renderable (LayoutPick x yl yr)
mkLegend (Layout x y -> Maybe LegendStyle
forall x y. Layout x y -> Maybe LegendStyle
_layout_legend Layout x y
l) (Layout x y -> Double
forall x y. Layout x y -> Double
_layout_margin Layout x y
l) [LegendItem]
legItems
, SpaceWeight
-> Grid (Renderable (LayoutPick x yl yr))
-> Grid (Renderable (LayoutPick x yl yr))
forall a. SpaceWeight -> Grid a -> Grid a
weights (Double
1,Double
1) (Grid (Renderable (LayoutPick x yl yr))
-> Grid (Renderable (LayoutPick x yl yr)))
-> Grid (Renderable (LayoutPick x yl yr))
-> Grid (Renderable (LayoutPick x yl yr))
forall a b. (a -> b) -> a -> b
$ Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a. a -> Grid a
tval Renderable (LayoutPick x yl yr)
forall a. Renderable a
emptyRenderable ]
layoutPlotAreaToGrid :: forall x y. (Ord x, Ord y) =>
Layout x y -> Grid (Renderable (LayoutPick x y y))
layoutPlotAreaToGrid :: Layout x y -> Grid (Renderable (LayoutPick x y y))
layoutPlotAreaToGrid Layout x y
l = LayoutGridElements x y y -> Grid (Renderable (LayoutPick x y y))
forall x yl yr.
(Ord x, Ord yl, Ord yr) =>
LayoutGridElements x yl yr
-> Grid (Renderable (LayoutPick x yl yr))
buildGrid LayoutGridElements :: forall x yl yr.
Renderable (LayoutPick x yl yr)
-> (Maybe (AxisT x), String, FontStyle)
-> (Maybe (AxisT x), String, FontStyle)
-> (Maybe (AxisT yl), String, FontStyle)
-> (Maybe (AxisT yr), String, FontStyle)
-> Double
-> LayoutGridElements x yl yr
LayoutGridElements{
lge_plots :: Renderable (LayoutPick x y y)
lge_plots = Maybe FillStyle
-> Renderable (LayoutPick x y y) -> Renderable (LayoutPick x y y)
forall a. Maybe FillStyle -> Renderable a -> Renderable a
mfill (Layout x y -> Maybe FillStyle
forall x y. Layout x y -> Maybe FillStyle
_layout_plot_background Layout x y
l) (Renderable (LayoutPick x y y) -> Renderable (LayoutPick x y y))
-> Renderable (LayoutPick x y y) -> Renderable (LayoutPick x y y)
forall a b. (a -> b) -> a -> b
$ Layout x y -> Renderable (LayoutPick x y y)
plotsToRenderable Layout x y
l,
lge_taxis :: (Maybe (AxisT x), String, FontStyle)
lge_taxis = (Maybe (AxisT x)
tAxis,LayoutAxis x -> String
forall x. LayoutAxis x -> String
_laxis_title (LayoutAxis x -> String) -> LayoutAxis x -> String
forall a b. (a -> b) -> a -> b
$ Layout x y -> LayoutAxis x
forall x y. Layout x y -> LayoutAxis x
_layout_x_axis Layout x y
l, LayoutAxis x -> FontStyle
forall x. LayoutAxis x -> FontStyle
_laxis_title_style (LayoutAxis x -> FontStyle) -> LayoutAxis x -> FontStyle
forall a b. (a -> b) -> a -> b
$ Layout x y -> LayoutAxis x
forall x y. Layout x y -> LayoutAxis x
_layout_x_axis Layout x y
l),
lge_baxis :: (Maybe (AxisT x), String, FontStyle)
lge_baxis = (Maybe (AxisT x)
bAxis,LayoutAxis x -> String
forall x. LayoutAxis x -> String
_laxis_title (LayoutAxis x -> String) -> LayoutAxis x -> String
forall a b. (a -> b) -> a -> b
$ Layout x y -> LayoutAxis x
forall x y. Layout x y -> LayoutAxis x
_layout_x_axis Layout x y
l, LayoutAxis x -> FontStyle
forall x. LayoutAxis x -> FontStyle
_laxis_title_style (LayoutAxis x -> FontStyle) -> LayoutAxis x -> FontStyle
forall a b. (a -> b) -> a -> b
$ Layout x y -> LayoutAxis x
forall x y. Layout x y -> LayoutAxis x
_layout_x_axis Layout x y
l),
lge_laxis :: (Maybe (AxisT y), String, FontStyle)
lge_laxis = (Maybe (AxisT y)
lAxis,LayoutAxis y -> String
forall x. LayoutAxis x -> String
_laxis_title (LayoutAxis y -> String) -> LayoutAxis y -> String
forall a b. (a -> b) -> a -> b
$ Layout x y -> LayoutAxis y
forall x y. Layout x y -> LayoutAxis y
_layout_y_axis Layout x y
l, LayoutAxis y -> FontStyle
forall x. LayoutAxis x -> FontStyle
_laxis_title_style (LayoutAxis y -> FontStyle) -> LayoutAxis y -> FontStyle
forall a b. (a -> b) -> a -> b
$ Layout x y -> LayoutAxis y
forall x y. Layout x y -> LayoutAxis y
_layout_y_axis Layout x y
l),
lge_raxis :: (Maybe (AxisT y), String, FontStyle)
lge_raxis = (Maybe (AxisT y)
rAxis,String
"", FontStyle
forall a. Default a => a
def),
lge_margin :: Double
lge_margin = Layout x y -> Double
forall x y. Layout x y -> Double
_layout_margin Layout x y
l
}
where
xvals :: [x]
xvals = [ x
x | Plot x y
p <- Layout x y -> [Plot x y]
forall x y. Layout x y -> [Plot x y]
_layout_plots Layout x y
l, x
x <- ([x], [y]) -> [x]
forall a b. (a, b) -> a
fst (([x], [y]) -> [x]) -> ([x], [y]) -> [x]
forall a b. (a -> b) -> a -> b
$ Plot x y -> ([x], [y])
forall x y. Plot x y -> ([x], [y])
_plot_all_points Plot x y
p]
yvals :: [y]
yvals = [ y
y | Plot x y
p <- Layout x y -> [Plot x y]
forall x y. Layout x y -> [Plot x y]
_layout_plots Layout x y
l, y
y <- ([x], [y]) -> [y]
forall a b. (a, b) -> b
snd (([x], [y]) -> [y]) -> ([x], [y]) -> [y]
forall a b. (a -> b) -> a -> b
$ Plot x y -> ([x], [y])
forall x y. Plot x y -> ([x], [y])
_plot_all_points Plot x y
p]
bAxis :: Maybe (AxisT x)
bAxis = RectEdge -> LayoutAxis x -> [x] -> Maybe (AxisT x)
forall z. RectEdge -> LayoutAxis z -> [z] -> Maybe (AxisT z)
mkAxis RectEdge
E_Bottom (Layout x y
-> (Layout x y -> LayoutAxis x)
-> (Layout x y -> AxisVisibility)
-> LayoutAxis x
forall layout z.
layout
-> (layout -> LayoutAxis z)
-> (layout -> AxisVisibility)
-> LayoutAxis z
overrideAxisVisibility Layout x y
l Layout x y -> LayoutAxis x
forall x y. Layout x y -> LayoutAxis x
_layout_x_axis Layout x y -> AxisVisibility
forall x y. Layout x y -> AxisVisibility
_layout_bottom_axis_visibility) [x]
xvals
tAxis :: Maybe (AxisT x)
tAxis = RectEdge -> LayoutAxis x -> [x] -> Maybe (AxisT x)
forall z. RectEdge -> LayoutAxis z -> [z] -> Maybe (AxisT z)
mkAxis RectEdge
E_Top (Layout x y
-> (Layout x y -> LayoutAxis x)
-> (Layout x y -> AxisVisibility)
-> LayoutAxis x
forall layout z.
layout
-> (layout -> LayoutAxis z)
-> (layout -> AxisVisibility)
-> LayoutAxis z
overrideAxisVisibility Layout x y
l Layout x y -> LayoutAxis x
forall x y. Layout x y -> LayoutAxis x
_layout_x_axis Layout x y -> AxisVisibility
forall x y. Layout x y -> AxisVisibility
_layout_top_axis_visibility ) [x]
xvals
lAxis :: Maybe (AxisT y)
lAxis = RectEdge -> LayoutAxis y -> [y] -> Maybe (AxisT y)
forall z. RectEdge -> LayoutAxis z -> [z] -> Maybe (AxisT z)
mkAxis RectEdge
E_Left (Layout x y
-> (Layout x y -> LayoutAxis y)
-> (Layout x y -> AxisVisibility)
-> LayoutAxis y
forall layout z.
layout
-> (layout -> LayoutAxis z)
-> (layout -> AxisVisibility)
-> LayoutAxis z
overrideAxisVisibility Layout x y
l Layout x y -> LayoutAxis y
forall x y. Layout x y -> LayoutAxis y
_layout_y_axis Layout x y -> AxisVisibility
forall x y. Layout x y -> AxisVisibility
_layout_left_axis_visibility ) [y]
yvals
rAxis :: Maybe (AxisT y)
rAxis = RectEdge -> LayoutAxis y -> [y] -> Maybe (AxisT y)
forall z. RectEdge -> LayoutAxis z -> [z] -> Maybe (AxisT z)
mkAxis RectEdge
E_Right (Layout x y
-> (Layout x y -> LayoutAxis y)
-> (Layout x y -> AxisVisibility)
-> LayoutAxis y
forall layout z.
layout
-> (layout -> LayoutAxis z)
-> (layout -> AxisVisibility)
-> LayoutAxis z
overrideAxisVisibility Layout x y
l Layout x y -> LayoutAxis y
forall x y. Layout x y -> LayoutAxis y
_layout_y_axis Layout x y -> AxisVisibility
forall x y. Layout x y -> AxisVisibility
_layout_right_axis_visibility ) [y]
yvals
axes :: (Maybe (AxisT x), Maybe (AxisT y), Maybe (AxisT x),
Maybe (AxisT y))
axes = (Maybe (AxisT x)
bAxis,Maybe (AxisT y)
lAxis,Maybe (AxisT x)
tAxis,Maybe (AxisT y)
rAxis)
plotsToRenderable :: Layout x y -> Renderable (LayoutPick x y y)
plotsToRenderable Layout x y
lxy = Renderable :: forall a.
BackendProgram SpaceWeight
-> (SpaceWeight -> BackendProgram (PickFn a)) -> Renderable a
Renderable {
minsize :: BackendProgram SpaceWeight
minsize = SpaceWeight -> BackendProgram SpaceWeight
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
0,Double
0),
render :: SpaceWeight -> BackendProgram (PickFn (LayoutPick x y y))
render = Layout x y
-> SpaceWeight -> BackendProgram (PickFn (LayoutPick x y y))
renderPlots Layout x y
lxy
}
renderPlots :: Layout x y -> RectSize -> BackendProgram (PickFn (LayoutPick x y y))
renderPlots :: Layout x y
-> SpaceWeight -> BackendProgram (PickFn (LayoutPick x y y))
renderPlots Layout x y
lxy sz :: SpaceWeight
sz@(Double
w,Double
h) = do
Bool
-> ProgramT ChartBackendInstr Identity ()
-> ProgramT ChartBackendInstr Identity ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Layout x y -> Bool
forall x y. Layout x y -> Bool
_layout_grid_last Layout x y
lxy) (SpaceWeight
-> (Maybe (AxisT x), Maybe (AxisT y), Maybe (AxisT x),
Maybe (AxisT y))
-> ProgramT ChartBackendInstr Identity ()
forall x yl yr.
SpaceWeight
-> (Maybe (AxisT x), Maybe (AxisT yl), Maybe (AxisT x),
Maybe (AxisT yr))
-> ProgramT ChartBackendInstr Identity ()
renderGrids SpaceWeight
sz (Maybe (AxisT x), Maybe (AxisT y), Maybe (AxisT x),
Maybe (AxisT y))
axes)
Rect
-> ProgramT ChartBackendInstr Identity ()
-> ProgramT ChartBackendInstr Identity ()
forall a. Rect -> BackendProgram a -> BackendProgram a
withClipRegion (Point -> Point -> Rect
Rect (Double -> Double -> Point
Point Double
0 Double
0) (Double -> Double -> Point
Point Double
w Double
h)) (ProgramT ChartBackendInstr Identity ()
-> ProgramT ChartBackendInstr Identity ())
-> ProgramT ChartBackendInstr Identity ()
-> ProgramT ChartBackendInstr Identity ()
forall a b. (a -> b) -> a -> b
$
(Plot x y -> ProgramT ChartBackendInstr Identity ())
-> [Plot x y] -> ProgramT ChartBackendInstr Identity ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Plot x y -> ProgramT ChartBackendInstr Identity ()
rPlot (Layout x y -> [Plot x y]
forall x y. Layout x y -> [Plot x y]
_layout_plots Layout x y
lxy)
Bool
-> ProgramT ChartBackendInstr Identity ()
-> ProgramT ChartBackendInstr Identity ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Layout x y -> Bool
forall x y. Layout x y -> Bool
_layout_grid_last Layout x y
lxy) (SpaceWeight
-> (Maybe (AxisT x), Maybe (AxisT y), Maybe (AxisT x),
Maybe (AxisT y))
-> ProgramT ChartBackendInstr Identity ()
forall x yl yr.
SpaceWeight
-> (Maybe (AxisT x), Maybe (AxisT yl), Maybe (AxisT x),
Maybe (AxisT yr))
-> ProgramT ChartBackendInstr Identity ()
renderGrids SpaceWeight
sz (Maybe (AxisT x), Maybe (AxisT y), Maybe (AxisT x),
Maybe (AxisT y))
axes)
PickFn (LayoutPick x y y)
-> BackendProgram (PickFn (LayoutPick x y y))
forall (m :: * -> *) a. Monad m => a -> m a
return PickFn (LayoutPick x y y)
pickfn
where
rPlot :: Plot x y -> ProgramT ChartBackendInstr Identity ()
rPlot = SpaceWeight
-> Maybe (AxisT x)
-> Maybe (AxisT y)
-> Plot x y
-> ProgramT ChartBackendInstr Identity ()
forall x y.
SpaceWeight
-> Maybe (AxisT x)
-> Maybe (AxisT y)
-> Plot x y
-> ProgramT ChartBackendInstr Identity ()
renderSinglePlot SpaceWeight
sz Maybe (AxisT x)
bAxis Maybe (AxisT y)
lAxis
xr :: SpaceWeight
xr = (Double
0, Double
w)
yr :: SpaceWeight
yr = (Double
h, Double
0)
pickfn :: PickFn (LayoutPick x y y)
pickfn :: PickFn (LayoutPick x y y)
pickfn (Point Double
x Double
y) = do
AxisT x
xat <- Maybe (AxisT x)
mxat
AxisT y
yat <- Maybe (AxisT y)
myat
LayoutPick x y y -> Maybe (LayoutPick x y y)
forall (m :: * -> *) a. Monad m => a -> m a
return (x -> y -> y -> LayoutPick x y y
forall x y1 y2. x -> y1 -> y2 -> LayoutPick x y1 y2
LayoutPick_PlotArea (AxisT x -> Double -> x
forall x. AxisT x -> Double -> x
mapx AxisT x
xat Double
x) (AxisT y -> Double -> y
forall x. AxisT x -> Double -> x
mapy AxisT y
yat Double
y) (AxisT y -> Double -> y
forall x. AxisT x -> Double -> x
mapy AxisT y
yat Double
y))
where
mxat :: Maybe (AxisT x)
mxat = case (Maybe (AxisT x)
bAxis,Maybe (AxisT x)
tAxis) of
(Just AxisT x
at,Maybe (AxisT x)
_) -> AxisT x -> Maybe (AxisT x)
forall a. a -> Maybe a
Just AxisT x
at
(Maybe (AxisT x)
_,Just AxisT x
at) -> AxisT x -> Maybe (AxisT x)
forall a. a -> Maybe a
Just AxisT x
at
(Maybe (AxisT x)
Nothing,Maybe (AxisT x)
Nothing) -> Maybe (AxisT x)
forall a. Maybe a
Nothing
myat :: Maybe (AxisT y)
myat = case (Maybe (AxisT y)
lAxis,Maybe (AxisT y)
rAxis) of
(Just AxisT y
at,Maybe (AxisT y)
_) -> AxisT y -> Maybe (AxisT y)
forall a. a -> Maybe a
Just AxisT y
at
(Maybe (AxisT y)
_,Just AxisT y
at) -> AxisT y -> Maybe (AxisT y)
forall a. a -> Maybe a
Just AxisT y
at
(Maybe (AxisT y)
Nothing,Maybe (AxisT y)
Nothing) -> Maybe (AxisT y)
forall a. Maybe a
Nothing
mapx :: AxisT x -> Double -> x
mapx (AxisT RectEdge
_ AxisStyle
_ Bool
rev AxisData x
ad) = AxisData x -> SpaceWeight -> Double -> x
forall x. AxisData x -> SpaceWeight -> Double -> x
_axis_tropweiv AxisData x
ad (Bool -> SpaceWeight -> SpaceWeight
forall a. Bool -> (a, a) -> (a, a)
optPairReverse Bool
rev SpaceWeight
xr)
mapy :: AxisT x -> Double -> x
mapy (AxisT RectEdge
_ AxisStyle
_ Bool
rev AxisData x
ad) = AxisData x -> SpaceWeight -> Double -> x
forall x. AxisData x -> SpaceWeight -> Double -> x
_axis_tropweiv AxisData x
ad (Bool -> SpaceWeight -> SpaceWeight
forall a. Bool -> (a, a) -> (a, a)
optPairReverse Bool
rev SpaceWeight
yr)
instance (PlotValue x, PlotValue y) => Default (Layout x y) where
def :: Layout x y
def = Layout :: forall x y.
FillStyle
-> Maybe FillStyle
-> String
-> FontStyle
-> LayoutAxis x
-> AxisVisibility
-> AxisVisibility
-> LayoutAxis y
-> AxisVisibility
-> AxisVisibility
-> [Plot x y]
-> Maybe LegendStyle
-> Double
-> Bool
-> Layout x y
Layout
{ _layout_background :: FillStyle
_layout_background = AlphaColour Double -> FillStyle
solidFillStyle (AlphaColour Double -> FillStyle)
-> AlphaColour Double -> FillStyle
forall a b. (a -> b) -> a -> b
$ Colour Double -> AlphaColour Double
forall a. Num a => Colour a -> AlphaColour a
opaque Colour Double
forall a. (Ord a, Floating a) => Colour a
white
, _layout_plot_background :: Maybe FillStyle
_layout_plot_background = Maybe FillStyle
forall a. Maybe a
Nothing
, _layout_title :: String
_layout_title = String
""
, _layout_title_style :: FontStyle
_layout_title_style = FontStyle
forall a. Default a => a
def { _font_size :: Double
_font_size = Double
15
, _font_weight :: FontWeight
_font_weight = FontWeight
FontWeightBold }
, _layout_x_axis :: LayoutAxis x
_layout_x_axis = LayoutAxis x
forall a. Default a => a
def
, _layout_top_axis_visibility :: AxisVisibility
_layout_top_axis_visibility = AxisVisibility
forall a. Default a => a
def { _axis_show_line :: Bool
_axis_show_line = Bool
False
, _axis_show_ticks :: Bool
_axis_show_ticks = Bool
False
, _axis_show_labels :: Bool
_axis_show_labels = Bool
False }
, _layout_bottom_axis_visibility :: AxisVisibility
_layout_bottom_axis_visibility = AxisVisibility
forall a. Default a => a
def
, _layout_y_axis :: LayoutAxis y
_layout_y_axis = LayoutAxis y
forall a. Default a => a
def
, _layout_left_axis_visibility :: AxisVisibility
_layout_left_axis_visibility = AxisVisibility
forall a. Default a => a
def
, _layout_right_axis_visibility :: AxisVisibility
_layout_right_axis_visibility = AxisVisibility
forall a. Default a => a
def { _axis_show_line :: Bool
_axis_show_line = Bool
False
, _axis_show_ticks :: Bool
_axis_show_ticks = Bool
False
, _axis_show_labels :: Bool
_axis_show_labels = Bool
False }
, _layout_margin :: Double
_layout_margin = Double
10
, _layout_plots :: [Plot x y]
_layout_plots = []
, _layout_legend :: Maybe LegendStyle
_layout_legend = LegendStyle -> Maybe LegendStyle
forall a. a -> Maybe a
Just LegendStyle
forall a. Default a => a
def
, _layout_grid_last :: Bool
_layout_grid_last = Bool
False
}
data LayoutLR x y1 y2 = LayoutLR
{ LayoutLR x y1 y2 -> FillStyle
_layoutlr_background :: FillStyle
, LayoutLR x y1 y2 -> Maybe FillStyle
_layoutlr_plot_background :: Maybe FillStyle
, LayoutLR x y1 y2 -> String
_layoutlr_title :: String
, LayoutLR x y1 y2 -> FontStyle
_layoutlr_title_style :: FontStyle
, LayoutLR x y1 y2 -> LayoutAxis x
_layoutlr_x_axis :: LayoutAxis x
, LayoutLR x y1 y2 -> AxisVisibility
_layoutlr_top_axis_visibility :: AxisVisibility
, LayoutLR x y1 y2 -> AxisVisibility
_layoutlr_bottom_axis_visibility :: AxisVisibility
, LayoutLR x y1 y2 -> LayoutAxis y1
_layoutlr_left_axis :: LayoutAxis y1
, LayoutLR x y1 y2 -> AxisVisibility
_layoutlr_left_axis_visibility :: AxisVisibility
, LayoutLR x y1 y2 -> LayoutAxis y2
_layoutlr_right_axis :: LayoutAxis y2
, LayoutLR x y1 y2 -> AxisVisibility
_layoutlr_right_axis_visibility :: AxisVisibility
, LayoutLR x y1 y2 -> [Either (Plot x y1) (Plot x y2)]
_layoutlr_plots :: [Either (Plot x y1) (Plot x y2)]
, LayoutLR x y1 y2 -> Maybe LegendStyle
_layoutlr_legend :: Maybe LegendStyle
, LayoutLR x y1 y2 -> Double
_layoutlr_margin :: Double
, LayoutLR x y1 y2 -> Bool
_layoutlr_grid_last :: Bool
}
instance (Ord x, Ord yl, Ord yr) => ToRenderable (LayoutLR x yl yr) where
toRenderable :: LayoutLR x yl yr -> Renderable ()
toRenderable = PickFn () -> Renderable (LayoutPick x yl yr) -> Renderable ()
forall b a. PickFn b -> Renderable a -> Renderable b
setPickFn PickFn ()
forall a. PickFn a
nullPickFn (Renderable (LayoutPick x yl yr) -> Renderable ())
-> (LayoutLR x yl yr -> Renderable (LayoutPick x yl yr))
-> LayoutLR x yl yr
-> Renderable ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LayoutLR x yl yr -> Renderable (LayoutPick x yl yr)
forall x yl yr.
(Ord x, Ord yl, Ord yr) =>
LayoutLR x yl yr -> Renderable (LayoutPick x yl yr)
layoutLRToRenderable
layoutLRToRenderable :: forall x yl yr . (Ord x, Ord yl, Ord yr)
=> LayoutLR x yl yr -> Renderable (LayoutPick x yl yr)
layoutLRToRenderable :: LayoutLR x yl yr -> Renderable (LayoutPick x yl yr)
layoutLRToRenderable LayoutLR x yl yr
l = FillStyle
-> Renderable (LayoutPick x yl yr)
-> Renderable (LayoutPick x yl yr)
forall a. FillStyle -> Renderable a -> Renderable a
fillBackground (LayoutLR x yl yr -> FillStyle
forall x y1 y2. LayoutLR x y1 y2 -> FillStyle
_layoutlr_background LayoutLR x yl yr
l)
(Renderable (LayoutPick x yl yr)
-> Renderable (LayoutPick x yl yr))
-> Renderable (LayoutPick x yl yr)
-> Renderable (LayoutPick x yl yr)
forall a b. (a -> b) -> a -> b
$ Grid (Renderable (LayoutPick x yl yr))
-> Renderable (LayoutPick x yl yr)
forall a. Grid (Renderable a) -> Renderable a
gridToRenderable (LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr))
forall x yl yr.
(Ord x, Ord yl, Ord yr) =>
LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr))
layoutLRToGrid LayoutLR x yl yr
l)
layoutLRToGrid :: forall x yl yr . (Ord x, Ord yl, Ord yr)
=> LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr))
layoutLRToGrid :: LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr))
layoutLRToGrid LayoutLR x yl yr
l = Grid (Renderable (LayoutPick x yl yr))
grid
where
grid :: Grid (Renderable (LayoutPick x yl yr))
grid = Double -> FontStyle -> String -> Renderable (LayoutPick x yl yr)
forall x yl yr.
Double -> FontStyle -> String -> Renderable (LayoutPick x yl yr)
titleToRenderable Double
lm (LayoutLR x yl yr -> FontStyle
forall x y1 y2. LayoutLR x y1 y2 -> FontStyle
_layoutlr_title_style LayoutLR x yl yr
l) (LayoutLR x yl yr -> String
forall x y1 y2. LayoutLR x y1 y2 -> String
_layoutlr_title LayoutLR x yl yr
l)
Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
-> Grid (Renderable (LayoutPick x yl yr))
forall a. a -> Grid a -> Grid a
`wideAbove`
(Double, Double, Double, Double)
-> Grid (Renderable (LayoutPick x yl yr))
-> Grid (Renderable (LayoutPick x yl yr))
forall a.
(Double, Double, Double, Double)
-> Grid (Renderable a) -> Grid (Renderable a)
addMarginsToGrid (Double
lm,Double
lm,Double
lm,Double
lm) (LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr))
forall x yl yr.
(Ord x, Ord yl, Ord yr) =>
LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr))
layoutLRPlotAreaToGrid LayoutLR x yl yr
l)
Grid (Renderable (LayoutPick x yl yr))
-> Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a. Grid a -> a -> Grid a
`aboveWide`
LayoutLR x yl yr
-> ([LegendItem], [LegendItem]) -> Renderable (LayoutPick x yl yr)
forall x yl yr.
LayoutLR x yl yr
-> ([LegendItem], [LegendItem]) -> Renderable (LayoutPick x yl yr)
renderLegendLR LayoutLR x yl yr
l (LayoutLR x yl yr -> ([LegendItem], [LegendItem])
forall x yl yr. LayoutLR x yl yr -> ([LegendItem], [LegendItem])
getLegendItemsLR LayoutLR x yl yr
l)
lm :: Double
lm = LayoutLR x yl yr -> Double
forall x y1 y2. LayoutLR x y1 y2 -> Double
_layoutlr_margin LayoutLR x yl yr
l
getLayoutLRXVals :: LayoutLR x yl yr -> [x]
getLayoutLRXVals :: LayoutLR x yl yr -> [x]
getLayoutLRXVals LayoutLR x yl yr
l = (Either (Plot x yl) (Plot x yr) -> [x])
-> [Either (Plot x yl) (Plot x yr)] -> [x]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Either (Plot x yl) (Plot x yr) -> [x]
forall x yl yr. Either (Plot x yl) (Plot x yr) -> [x]
deEither ([Either (Plot x yl) (Plot x yr)] -> [x])
-> [Either (Plot x yl) (Plot x yr)] -> [x]
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr -> [Either (Plot x yl) (Plot x yr)]
forall x y1 y2.
LayoutLR x y1 y2 -> [Either (Plot x y1) (Plot x y2)]
_layoutlr_plots LayoutLR x yl yr
l
where
deEither :: Either (Plot x yl) (Plot x yr) -> [x]
deEither :: Either (Plot x yl) (Plot x yr) -> [x]
deEither (Left Plot x yl
x) = ([x], [yl]) -> [x]
forall a b. (a, b) -> a
fst (([x], [yl]) -> [x]) -> ([x], [yl]) -> [x]
forall a b. (a -> b) -> a -> b
$ Plot x yl -> ([x], [yl])
forall x y. Plot x y -> ([x], [y])
_plot_all_points Plot x yl
x
deEither (Right Plot x yr
x) = ([x], [yr]) -> [x]
forall a b. (a, b) -> a
fst (([x], [yr]) -> [x]) -> ([x], [yr]) -> [x]
forall a b. (a -> b) -> a -> b
$ Plot x yr -> ([x], [yr])
forall x y. Plot x y -> ([x], [y])
_plot_all_points Plot x yr
x
getLegendItemsLR :: LayoutLR x yl yr -> ([LegendItem],[LegendItem])
getLegendItemsLR :: LayoutLR x yl yr -> ([LegendItem], [LegendItem])
getLegendItemsLR LayoutLR x yl yr
l = (
[[LegendItem]] -> [LegendItem]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ Plot x yl -> [LegendItem]
forall x y. Plot x y -> [LegendItem]
_plot_legend Plot x yl
p | (Left Plot x yl
p ) <- LayoutLR x yl yr -> [Either (Plot x yl) (Plot x yr)]
forall x y1 y2.
LayoutLR x y1 y2 -> [Either (Plot x y1) (Plot x y2)]
_layoutlr_plots LayoutLR x yl yr
l ],
[[LegendItem]] -> [LegendItem]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ Plot x yr -> [LegendItem]
forall x y. Plot x y -> [LegendItem]
_plot_legend Plot x yr
p | (Right Plot x yr
p) <- LayoutLR x yl yr -> [Either (Plot x yl) (Plot x yr)]
forall x y1 y2.
LayoutLR x y1 y2 -> [Either (Plot x y1) (Plot x y2)]
_layoutlr_plots LayoutLR x yl yr
l ]
)
renderLegendLR :: LayoutLR x yl yr -> ([LegendItem],[LegendItem]) -> Renderable (LayoutPick x yl yr)
renderLegendLR :: LayoutLR x yl yr
-> ([LegendItem], [LegendItem]) -> Renderable (LayoutPick x yl yr)
renderLegendLR LayoutLR x yl yr
l ([LegendItem]
lefts,[LegendItem]
rights) = Grid (Renderable (LayoutPick x yl yr))
-> Renderable (LayoutPick x yl yr)
forall a. Grid (Renderable a) -> Renderable a
gridToRenderable Grid (Renderable (LayoutPick x yl yr))
forall x yl yr. Grid (Renderable (LayoutPick x yl yr))
g
where
g :: Grid (Renderable (LayoutPick x yl yr))
g = [Grid (Renderable (LayoutPick x yl yr))]
-> Grid (Renderable (LayoutPick x yl yr))
forall a. [Grid a] -> Grid a
besideN [ Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a. a -> Grid a
tval (Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr)))
-> Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a b. (a -> b) -> a -> b
$ Maybe LegendStyle
-> Double -> [LegendItem] -> Renderable (LayoutPick x yl yr)
forall x yl yr.
Maybe LegendStyle
-> Double -> [LegendItem] -> Renderable (LayoutPick x yl yr)
mkLegend (LayoutLR x yl yr -> Maybe LegendStyle
forall x y1 y2. LayoutLR x y1 y2 -> Maybe LegendStyle
_layoutlr_legend LayoutLR x yl yr
l) (LayoutLR x yl yr -> Double
forall x y1 y2. LayoutLR x y1 y2 -> Double
_layoutlr_margin LayoutLR x yl yr
l) [LegendItem]
lefts
, SpaceWeight
-> Grid (Renderable (LayoutPick x yl yr))
-> Grid (Renderable (LayoutPick x yl yr))
forall a. SpaceWeight -> Grid a -> Grid a
weights (Double
1,Double
1) (Grid (Renderable (LayoutPick x yl yr))
-> Grid (Renderable (LayoutPick x yl yr)))
-> Grid (Renderable (LayoutPick x yl yr))
-> Grid (Renderable (LayoutPick x yl yr))
forall a b. (a -> b) -> a -> b
$ Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a. a -> Grid a
tval Renderable (LayoutPick x yl yr)
forall a. Renderable a
emptyRenderable
, Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a. a -> Grid a
tval (Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr)))
-> Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a b. (a -> b) -> a -> b
$ Maybe LegendStyle
-> Double -> [LegendItem] -> Renderable (LayoutPick x yl yr)
forall x yl yr.
Maybe LegendStyle
-> Double -> [LegendItem] -> Renderable (LayoutPick x yl yr)
mkLegend (LayoutLR x yl yr -> Maybe LegendStyle
forall x y1 y2. LayoutLR x y1 y2 -> Maybe LegendStyle
_layoutlr_legend LayoutLR x yl yr
l) (LayoutLR x yl yr -> Double
forall x y1 y2. LayoutLR x y1 y2 -> Double
_layoutlr_margin LayoutLR x yl yr
l) [LegendItem]
rights ]
layoutLRPlotAreaToGrid :: forall x yl yr. (Ord x, Ord yl, Ord yr)
=> LayoutLR x yl yr
-> Grid (Renderable (LayoutPick x yl yr))
layoutLRPlotAreaToGrid :: LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr))
layoutLRPlotAreaToGrid LayoutLR x yl yr
l = LayoutGridElements x yl yr
-> Grid (Renderable (LayoutPick x yl yr))
forall x yl yr.
(Ord x, Ord yl, Ord yr) =>
LayoutGridElements x yl yr
-> Grid (Renderable (LayoutPick x yl yr))
buildGrid LayoutGridElements :: forall x yl yr.
Renderable (LayoutPick x yl yr)
-> (Maybe (AxisT x), String, FontStyle)
-> (Maybe (AxisT x), String, FontStyle)
-> (Maybe (AxisT yl), String, FontStyle)
-> (Maybe (AxisT yr), String, FontStyle)
-> Double
-> LayoutGridElements x yl yr
LayoutGridElements{
lge_plots :: Renderable (LayoutPick x yl yr)
lge_plots = Maybe FillStyle
-> Renderable (LayoutPick x yl yr)
-> Renderable (LayoutPick x yl yr)
forall a. Maybe FillStyle -> Renderable a -> Renderable a
mfill (LayoutLR x yl yr -> Maybe FillStyle
forall x y1 y2. LayoutLR x y1 y2 -> Maybe FillStyle
_layoutlr_plot_background LayoutLR x yl yr
l) (Renderable (LayoutPick x yl yr)
-> Renderable (LayoutPick x yl yr))
-> Renderable (LayoutPick x yl yr)
-> Renderable (LayoutPick x yl yr)
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr -> Renderable (LayoutPick x yl yr)
plotsToRenderable LayoutLR x yl yr
l,
lge_taxis :: (Maybe (AxisT x), String, FontStyle)
lge_taxis = (Maybe (AxisT x)
tAxis,LayoutAxis x -> String
forall x. LayoutAxis x -> String
_laxis_title (LayoutAxis x -> String) -> LayoutAxis x -> String
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr -> LayoutAxis x
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis x
_layoutlr_x_axis LayoutLR x yl yr
l, LayoutAxis x -> FontStyle
forall x. LayoutAxis x -> FontStyle
_laxis_title_style (LayoutAxis x -> FontStyle) -> LayoutAxis x -> FontStyle
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr -> LayoutAxis x
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis x
_layoutlr_x_axis LayoutLR x yl yr
l),
lge_baxis :: (Maybe (AxisT x), String, FontStyle)
lge_baxis = (Maybe (AxisT x)
bAxis,LayoutAxis x -> String
forall x. LayoutAxis x -> String
_laxis_title (LayoutAxis x -> String) -> LayoutAxis x -> String
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr -> LayoutAxis x
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis x
_layoutlr_x_axis LayoutLR x yl yr
l, LayoutAxis x -> FontStyle
forall x. LayoutAxis x -> FontStyle
_laxis_title_style (LayoutAxis x -> FontStyle) -> LayoutAxis x -> FontStyle
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr -> LayoutAxis x
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis x
_layoutlr_x_axis LayoutLR x yl yr
l),
lge_laxis :: (Maybe (AxisT yl), String, FontStyle)
lge_laxis = (Maybe (AxisT yl)
lAxis,LayoutAxis yl -> String
forall x. LayoutAxis x -> String
_laxis_title (LayoutAxis yl -> String) -> LayoutAxis yl -> String
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr -> LayoutAxis yl
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis y1
_layoutlr_left_axis LayoutLR x yl yr
l, LayoutAxis yl -> FontStyle
forall x. LayoutAxis x -> FontStyle
_laxis_title_style (LayoutAxis yl -> FontStyle) -> LayoutAxis yl -> FontStyle
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr -> LayoutAxis yl
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis y1
_layoutlr_left_axis LayoutLR x yl yr
l),
lge_raxis :: (Maybe (AxisT yr), String, FontStyle)
lge_raxis = (Maybe (AxisT yr)
rAxis,LayoutAxis yr -> String
forall x. LayoutAxis x -> String
_laxis_title (LayoutAxis yr -> String) -> LayoutAxis yr -> String
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr -> LayoutAxis yr
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis y2
_layoutlr_right_axis LayoutLR x yl yr
l, LayoutAxis yr -> FontStyle
forall x. LayoutAxis x -> FontStyle
_laxis_title_style (LayoutAxis yr -> FontStyle) -> LayoutAxis yr -> FontStyle
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr -> LayoutAxis yr
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis y2
_layoutlr_right_axis LayoutLR x yl yr
l),
lge_margin :: Double
lge_margin = LayoutLR x yl yr -> Double
forall x y1 y2. LayoutLR x y1 y2 -> Double
_layoutlr_margin LayoutLR x yl yr
l
}
where
xvals :: [x]
xvals = [ x
x | (Left Plot x yl
p) <- LayoutLR x yl yr -> [Either (Plot x yl) (Plot x yr)]
forall x y1 y2.
LayoutLR x y1 y2 -> [Either (Plot x y1) (Plot x y2)]
_layoutlr_plots LayoutLR x yl yr
l, x
x <- ([x], [yl]) -> [x]
forall a b. (a, b) -> a
fst (([x], [yl]) -> [x]) -> ([x], [yl]) -> [x]
forall a b. (a -> b) -> a -> b
$ Plot x yl -> ([x], [yl])
forall x y. Plot x y -> ([x], [y])
_plot_all_points Plot x yl
p]
[x] -> [x] -> [x]
forall a. [a] -> [a] -> [a]
++ [ x
x | (Right Plot x yr
p) <- LayoutLR x yl yr -> [Either (Plot x yl) (Plot x yr)]
forall x y1 y2.
LayoutLR x y1 y2 -> [Either (Plot x y1) (Plot x y2)]
_layoutlr_plots LayoutLR x yl yr
l, x
x <- ([x], [yr]) -> [x]
forall a b. (a, b) -> a
fst (([x], [yr]) -> [x]) -> ([x], [yr]) -> [x]
forall a b. (a -> b) -> a -> b
$ Plot x yr -> ([x], [yr])
forall x y. Plot x y -> ([x], [y])
_plot_all_points Plot x yr
p]
yvalsL :: [yl]
yvalsL = [ yl
y | (Left Plot x yl
p) <- LayoutLR x yl yr -> [Either (Plot x yl) (Plot x yr)]
forall x y1 y2.
LayoutLR x y1 y2 -> [Either (Plot x y1) (Plot x y2)]
_layoutlr_plots LayoutLR x yl yr
l, yl
y <- ([x], [yl]) -> [yl]
forall a b. (a, b) -> b
snd (([x], [yl]) -> [yl]) -> ([x], [yl]) -> [yl]
forall a b. (a -> b) -> a -> b
$ Plot x yl -> ([x], [yl])
forall x y. Plot x y -> ([x], [y])
_plot_all_points Plot x yl
p]
yvalsR :: [yr]
yvalsR = [ yr
y | (Right Plot x yr
p) <- LayoutLR x yl yr -> [Either (Plot x yl) (Plot x yr)]
forall x y1 y2.
LayoutLR x y1 y2 -> [Either (Plot x y1) (Plot x y2)]
_layoutlr_plots LayoutLR x yl yr
l, yr
y <- ([x], [yr]) -> [yr]
forall a b. (a, b) -> b
snd (([x], [yr]) -> [yr]) -> ([x], [yr]) -> [yr]
forall a b. (a -> b) -> a -> b
$ Plot x yr -> ([x], [yr])
forall x y. Plot x y -> ([x], [y])
_plot_all_points Plot x yr
p]
bAxis :: Maybe (AxisT x)
bAxis = RectEdge -> LayoutAxis x -> [x] -> Maybe (AxisT x)
forall z. RectEdge -> LayoutAxis z -> [z] -> Maybe (AxisT z)
mkAxis RectEdge
E_Bottom (LayoutLR x yl yr
-> (LayoutLR x yl yr -> LayoutAxis x)
-> (LayoutLR x yl yr -> AxisVisibility)
-> LayoutAxis x
forall layout z.
layout
-> (layout -> LayoutAxis z)
-> (layout -> AxisVisibility)
-> LayoutAxis z
overrideAxisVisibility LayoutLR x yl yr
l LayoutLR x yl yr -> LayoutAxis x
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis x
_layoutlr_x_axis LayoutLR x yl yr -> AxisVisibility
forall x y1 y2. LayoutLR x y1 y2 -> AxisVisibility
_layoutlr_bottom_axis_visibility) [x]
xvals
tAxis :: Maybe (AxisT x)
tAxis = RectEdge -> LayoutAxis x -> [x] -> Maybe (AxisT x)
forall z. RectEdge -> LayoutAxis z -> [z] -> Maybe (AxisT z)
mkAxis RectEdge
E_Top (LayoutLR x yl yr
-> (LayoutLR x yl yr -> LayoutAxis x)
-> (LayoutLR x yl yr -> AxisVisibility)
-> LayoutAxis x
forall layout z.
layout
-> (layout -> LayoutAxis z)
-> (layout -> AxisVisibility)
-> LayoutAxis z
overrideAxisVisibility LayoutLR x yl yr
l LayoutLR x yl yr -> LayoutAxis x
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis x
_layoutlr_x_axis LayoutLR x yl yr -> AxisVisibility
forall x y1 y2. LayoutLR x y1 y2 -> AxisVisibility
_layoutlr_top_axis_visibility ) [x]
xvals
lAxis :: Maybe (AxisT yl)
lAxis = RectEdge -> LayoutAxis yl -> [yl] -> Maybe (AxisT yl)
forall z. RectEdge -> LayoutAxis z -> [z] -> Maybe (AxisT z)
mkAxis RectEdge
E_Left (LayoutLR x yl yr
-> (LayoutLR x yl yr -> LayoutAxis yl)
-> (LayoutLR x yl yr -> AxisVisibility)
-> LayoutAxis yl
forall layout z.
layout
-> (layout -> LayoutAxis z)
-> (layout -> AxisVisibility)
-> LayoutAxis z
overrideAxisVisibility LayoutLR x yl yr
l LayoutLR x yl yr -> LayoutAxis yl
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis y1
_layoutlr_left_axis LayoutLR x yl yr -> AxisVisibility
forall x y1 y2. LayoutLR x y1 y2 -> AxisVisibility
_layoutlr_left_axis_visibility ) [yl]
yvalsL
rAxis :: Maybe (AxisT yr)
rAxis = RectEdge -> LayoutAxis yr -> [yr] -> Maybe (AxisT yr)
forall z. RectEdge -> LayoutAxis z -> [z] -> Maybe (AxisT z)
mkAxis RectEdge
E_Right (LayoutLR x yl yr
-> (LayoutLR x yl yr -> LayoutAxis yr)
-> (LayoutLR x yl yr -> AxisVisibility)
-> LayoutAxis yr
forall layout z.
layout
-> (layout -> LayoutAxis z)
-> (layout -> AxisVisibility)
-> LayoutAxis z
overrideAxisVisibility LayoutLR x yl yr
l LayoutLR x yl yr -> LayoutAxis yr
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis y2
_layoutlr_right_axis LayoutLR x yl yr -> AxisVisibility
forall x y1 y2. LayoutLR x y1 y2 -> AxisVisibility
_layoutlr_right_axis_visibility) [yr]
yvalsR
axes :: (Maybe (AxisT x), Maybe (AxisT yl), Maybe (AxisT x),
Maybe (AxisT yr))
axes = (Maybe (AxisT x)
bAxis,Maybe (AxisT yl)
lAxis,Maybe (AxisT x)
tAxis,Maybe (AxisT yr)
rAxis)
plotsToRenderable :: LayoutLR x yl yr -> Renderable (LayoutPick x yl yr)
plotsToRenderable LayoutLR x yl yr
llr = Renderable :: forall a.
BackendProgram SpaceWeight
-> (SpaceWeight -> BackendProgram (PickFn a)) -> Renderable a
Renderable {
minsize :: BackendProgram SpaceWeight
minsize = SpaceWeight -> BackendProgram SpaceWeight
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
0,Double
0),
render :: SpaceWeight -> BackendProgram (PickFn (LayoutPick x yl yr))
render = LayoutLR x yl yr
-> SpaceWeight -> BackendProgram (PickFn (LayoutPick x yl yr))
renderPlots LayoutLR x yl yr
llr
}
renderPlots :: LayoutLR x yl yr -> RectSize -> BackendProgram (PickFn (LayoutPick x yl yr))
renderPlots :: LayoutLR x yl yr
-> SpaceWeight -> BackendProgram (PickFn (LayoutPick x yl yr))
renderPlots LayoutLR x yl yr
llr sz :: SpaceWeight
sz@(Double
w,Double
h) = do
Bool
-> ProgramT ChartBackendInstr Identity ()
-> ProgramT ChartBackendInstr Identity ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (LayoutLR x yl yr -> Bool
forall x y1 y2. LayoutLR x y1 y2 -> Bool
_layoutlr_grid_last LayoutLR x yl yr
llr) (SpaceWeight
-> (Maybe (AxisT x), Maybe (AxisT yl), Maybe (AxisT x),
Maybe (AxisT yr))
-> ProgramT ChartBackendInstr Identity ()
forall x yl yr.
SpaceWeight
-> (Maybe (AxisT x), Maybe (AxisT yl), Maybe (AxisT x),
Maybe (AxisT yr))
-> ProgramT ChartBackendInstr Identity ()
renderGrids SpaceWeight
sz (Maybe (AxisT x), Maybe (AxisT yl), Maybe (AxisT x),
Maybe (AxisT yr))
axes)
Rect
-> ProgramT ChartBackendInstr Identity ()
-> ProgramT ChartBackendInstr Identity ()
forall a. Rect -> BackendProgram a -> BackendProgram a
withClipRegion (Point -> Point -> Rect
Rect (Double -> Double -> Point
Point Double
0 Double
0) (Double -> Double -> Point
Point Double
w Double
h)) (ProgramT ChartBackendInstr Identity ()
-> ProgramT ChartBackendInstr Identity ())
-> ProgramT ChartBackendInstr Identity ()
-> ProgramT ChartBackendInstr Identity ()
forall a b. (a -> b) -> a -> b
$
(Either (Plot x yl) (Plot x yr)
-> ProgramT ChartBackendInstr Identity ())
-> [Either (Plot x yl) (Plot x yr)]
-> ProgramT ChartBackendInstr Identity ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Either (Plot x yl) (Plot x yr)
-> ProgramT ChartBackendInstr Identity ()
rPlot (LayoutLR x yl yr -> [Either (Plot x yl) (Plot x yr)]
forall x y1 y2.
LayoutLR x y1 y2 -> [Either (Plot x y1) (Plot x y2)]
_layoutlr_plots LayoutLR x yl yr
llr)
Bool
-> ProgramT ChartBackendInstr Identity ()
-> ProgramT ChartBackendInstr Identity ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (LayoutLR x yl yr -> Bool
forall x y1 y2. LayoutLR x y1 y2 -> Bool
_layoutlr_grid_last LayoutLR x yl yr
llr) (SpaceWeight
-> (Maybe (AxisT x), Maybe (AxisT yl), Maybe (AxisT x),
Maybe (AxisT yr))
-> ProgramT ChartBackendInstr Identity ()
forall x yl yr.
SpaceWeight
-> (Maybe (AxisT x), Maybe (AxisT yl), Maybe (AxisT x),
Maybe (AxisT yr))
-> ProgramT ChartBackendInstr Identity ()
renderGrids SpaceWeight
sz (Maybe (AxisT x), Maybe (AxisT yl), Maybe (AxisT x),
Maybe (AxisT yr))
axes)
PickFn (LayoutPick x yl yr)
-> BackendProgram (PickFn (LayoutPick x yl yr))
forall (m :: * -> *) a. Monad m => a -> m a
return PickFn (LayoutPick x yl yr)
pickfn
where
rPlot :: Either (Plot x yl) (Plot x yr)
-> ProgramT ChartBackendInstr Identity ()
rPlot (Left Plot x yl
p) = SpaceWeight
-> Maybe (AxisT x)
-> Maybe (AxisT yl)
-> Plot x yl
-> ProgramT ChartBackendInstr Identity ()
forall x y.
SpaceWeight
-> Maybe (AxisT x)
-> Maybe (AxisT y)
-> Plot x y
-> ProgramT ChartBackendInstr Identity ()
renderSinglePlot SpaceWeight
sz Maybe (AxisT x)
bAxis Maybe (AxisT yl)
lAxis Plot x yl
p
rPlot (Right Plot x yr
p) = SpaceWeight
-> Maybe (AxisT x)
-> Maybe (AxisT yr)
-> Plot x yr
-> ProgramT ChartBackendInstr Identity ()
forall x y.
SpaceWeight
-> Maybe (AxisT x)
-> Maybe (AxisT y)
-> Plot x y
-> ProgramT ChartBackendInstr Identity ()
renderSinglePlot SpaceWeight
sz Maybe (AxisT x)
bAxis Maybe (AxisT yr)
rAxis Plot x yr
p
xr :: SpaceWeight
xr = (Double
0, Double
w)
yr :: SpaceWeight
yr = (Double
h, Double
0)
pickfn :: PickFn (LayoutPick x yl yr)
pickfn (Point Double
x Double
y) = do
AxisT x
xat <- Maybe (AxisT x)
mxat
(AxisT yl
yatL,AxisT yr
yatR) <- Maybe (AxisT yl, AxisT yr)
myats
LayoutPick x yl yr -> Maybe (LayoutPick x yl yr)
forall (m :: * -> *) a. Monad m => a -> m a
return (x -> yl -> yr -> LayoutPick x yl yr
forall x y1 y2. x -> y1 -> y2 -> LayoutPick x y1 y2
LayoutPick_PlotArea (AxisT x -> Double -> x
forall x. AxisT x -> Double -> x
mapx AxisT x
xat Double
x) (AxisT yl -> Double -> yl
forall x. AxisT x -> Double -> x
mapy AxisT yl
yatL Double
y) (AxisT yr -> Double -> yr
forall x. AxisT x -> Double -> x
mapy AxisT yr
yatR Double
y))
where
mxat :: Maybe (AxisT x)
mxat = case (Maybe (AxisT x)
bAxis,Maybe (AxisT x)
tAxis) of
(Just AxisT x
at,Maybe (AxisT x)
_) -> AxisT x -> Maybe (AxisT x)
forall a. a -> Maybe a
Just AxisT x
at
(Maybe (AxisT x)
_,Just AxisT x
at) -> AxisT x -> Maybe (AxisT x)
forall a. a -> Maybe a
Just AxisT x
at
(Maybe (AxisT x)
Nothing,Maybe (AxisT x)
Nothing) -> Maybe (AxisT x)
forall a. Maybe a
Nothing
myats :: Maybe (AxisT yl, AxisT yr)
myats = case (Maybe (AxisT yl)
lAxis,Maybe (AxisT yr)
rAxis) of
(Just AxisT yl
at1,Just AxisT yr
at2) -> (AxisT yl, AxisT yr) -> Maybe (AxisT yl, AxisT yr)
forall a. a -> Maybe a
Just (AxisT yl
at1,AxisT yr
at2)
(Maybe (AxisT yl)
_,Maybe (AxisT yr)
_) -> Maybe (AxisT yl, AxisT yr)
forall a. Maybe a
Nothing
mapx :: AxisT x -> Double -> x
mapx (AxisT RectEdge
_ AxisStyle
_ Bool
rev AxisData x
ad) = AxisData x -> SpaceWeight -> Double -> x
forall x. AxisData x -> SpaceWeight -> Double -> x
_axis_tropweiv AxisData x
ad (Bool -> SpaceWeight -> SpaceWeight
forall a. Bool -> (a, a) -> (a, a)
optPairReverse Bool
rev SpaceWeight
xr)
mapy :: AxisT x -> Double -> x
mapy (AxisT RectEdge
_ AxisStyle
_ Bool
rev AxisData x
ad) = AxisData x -> SpaceWeight -> Double -> x
forall x. AxisData x -> SpaceWeight -> Double -> x
_axis_tropweiv AxisData x
ad (Bool -> SpaceWeight -> SpaceWeight
forall a. Bool -> (a, a) -> (a, a)
optPairReverse Bool
rev SpaceWeight
yr)
data StackedLayout x = forall y . (Ord y) => StackedLayout (Layout x y)
| forall yl yr . (Ord yl, Ord yr) => StackedLayoutLR (LayoutLR x yl yr)
data StackedLayouts x = StackedLayouts
{ StackedLayouts x -> [StackedLayout x]
_slayouts_layouts :: [StackedLayout x]
, StackedLayouts x -> Bool
_slayouts_compress_legend :: Bool
}
instance Default (StackedLayouts x) where
def :: StackedLayouts x
def = [StackedLayout x] -> Bool -> StackedLayouts x
forall x. [StackedLayout x] -> Bool -> StackedLayouts x
StackedLayouts [] Bool
True
instance Ord x => ToRenderable (StackedLayouts x) where
toRenderable :: StackedLayouts x -> Renderable ()
toRenderable = StackedLayouts x -> Renderable ()
forall x. Ord x => StackedLayouts x -> Renderable ()
renderStackedLayouts
renderStackedLayouts :: forall x. (Ord x) => StackedLayouts x -> Renderable ()
renderStackedLayouts :: StackedLayouts x -> Renderable ()
renderStackedLayouts (StackedLayouts{_slayouts_layouts :: forall x. StackedLayouts x -> [StackedLayout x]
_slayouts_layouts=[]}) = Renderable ()
forall a. Renderable a
emptyRenderable
renderStackedLayouts slp :: StackedLayouts x
slp@(StackedLayouts{_slayouts_layouts :: forall x. StackedLayouts x -> [StackedLayout x]
_slayouts_layouts=sls :: [StackedLayout x]
sls@(StackedLayout x
sl1:[StackedLayout x]
_)}) = Grid (Renderable ()) -> Renderable ()
forall a. Grid (Renderable a) -> Renderable a
gridToRenderable Grid (Renderable ())
g
where
g :: Grid (Renderable ())
g = Renderable () -> Grid (Renderable ()) -> Grid (Renderable ())
forall a. a -> Grid a -> Grid a
fullOverlayUnder (FillStyle -> Renderable () -> Renderable ()
forall a. FillStyle -> Renderable a -> Renderable a
fillBackground FillStyle
bg Renderable ()
forall a. Renderable a
emptyRenderable)
(Grid (Renderable ()) -> Grid (Renderable ()))
-> Grid (Renderable ()) -> Grid (Renderable ())
forall a b. (a -> b) -> a -> b
$ ((StackedLayout x, Int)
-> Grid (Renderable ()) -> Grid (Renderable ()))
-> Grid (Renderable ())
-> [(StackedLayout x, Int)]
-> Grid (Renderable ())
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (Grid (Renderable ())
-> Grid (Renderable ()) -> Grid (Renderable ())
forall a. Grid a -> Grid a -> Grid a
above(Grid (Renderable ())
-> Grid (Renderable ()) -> Grid (Renderable ()))
-> ((StackedLayout x, Int) -> Grid (Renderable ()))
-> (StackedLayout x, Int)
-> Grid (Renderable ())
-> Grid (Renderable ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(StackedLayout x, Int) -> Grid (Renderable ())
mkGrid) Grid (Renderable ())
forall a. Grid a
nullt ([StackedLayout x] -> [Int] -> [(StackedLayout x, Int)]
forall a b. [a] -> [b] -> [(a, b)]
zip [StackedLayout x]
sls [Int
0,Int
1..])
mkGrid :: (StackedLayout x, Int) -> Grid (Renderable ())
mkGrid :: (StackedLayout x, Int) -> Grid (Renderable ())
mkGrid (StackedLayout x
sl, Int
i)
= Renderable ()
titleR
Renderable () -> Grid (Renderable ()) -> Grid (Renderable ())
forall a. a -> Grid a -> Grid a
`wideAbove`
(Double, Double, Double, Double)
-> Grid (Renderable ()) -> Grid (Renderable ())
forall a.
(Double, Double, Double, Double)
-> Grid (Renderable a) -> Grid (Renderable a)
addMarginsToGrid (Double
lm,Double
lm,Double
lm,Double
lm) (LayoutAxis x -> Grid (Renderable ())
mkPlotArea LayoutAxis x
usedAxis)
Grid (Renderable ()) -> Renderable () -> Grid (Renderable ())
forall a. Grid a -> a -> Grid a
`aboveWide`
(if Bool
showLegend then Renderable ()
legendR else Renderable ()
forall a. Renderable a
emptyRenderable)
where
titleR :: Renderable ()
titleR = case StackedLayout x
sl of
StackedLayout Layout x y
l -> Renderable (LayoutPick Any Any Any) -> Renderable ()
forall a. Renderable a -> Renderable ()
noPickFn (Renderable (LayoutPick Any Any Any) -> Renderable ())
-> Renderable (LayoutPick Any Any Any) -> Renderable ()
forall a b. (a -> b) -> a -> b
$ Double
-> FontStyle -> String -> Renderable (LayoutPick Any Any Any)
forall x yl yr.
Double -> FontStyle -> String -> Renderable (LayoutPick x yl yr)
titleToRenderable (Layout x y -> Double
forall x y. Layout x y -> Double
_layout_margin Layout x y
l) (Layout x y -> FontStyle
forall x y. Layout x y -> FontStyle
_layout_title_style Layout x y
l) (Layout x y -> String
forall x y. Layout x y -> String
_layout_title Layout x y
l)
StackedLayoutLR LayoutLR x yl yr
l -> Renderable (LayoutPick Any Any Any) -> Renderable ()
forall a. Renderable a -> Renderable ()
noPickFn (Renderable (LayoutPick Any Any Any) -> Renderable ())
-> Renderable (LayoutPick Any Any Any) -> Renderable ()
forall a b. (a -> b) -> a -> b
$ Double
-> FontStyle -> String -> Renderable (LayoutPick Any Any Any)
forall x yl yr.
Double -> FontStyle -> String -> Renderable (LayoutPick x yl yr)
titleToRenderable (LayoutLR x yl yr -> Double
forall x y1 y2. LayoutLR x y1 y2 -> Double
_layoutlr_margin LayoutLR x yl yr
l) (LayoutLR x yl yr -> FontStyle
forall x y1 y2. LayoutLR x y1 y2 -> FontStyle
_layoutlr_title_style LayoutLR x yl yr
l) (LayoutLR x yl yr -> String
forall x y1 y2. LayoutLR x y1 y2 -> String
_layoutlr_title LayoutLR x yl yr
l)
legendR :: Renderable ()
legendR = case StackedLayout x
sl of
StackedLayout Layout x y
l -> Renderable (LayoutPick x y y) -> Renderable ()
forall a. Renderable a -> Renderable ()
noPickFn (Renderable (LayoutPick x y y) -> Renderable ())
-> Renderable (LayoutPick x y y) -> Renderable ()
forall a b. (a -> b) -> a -> b
$ Layout x y -> [LegendItem] -> Renderable (LayoutPick x y y)
forall x y.
Layout x y -> [LegendItem] -> Renderable (LayoutPick x y y)
renderLegend Layout x y
l ([LegendItem] -> Renderable (LayoutPick x y y))
-> [LegendItem] -> Renderable (LayoutPick x y y)
forall a b. (a -> b) -> a -> b
$ ([LegendItem], [LegendItem]) -> [LegendItem]
forall a b. (a, b) -> a
fst ([LegendItem], [LegendItem])
legenditems
StackedLayoutLR LayoutLR x yl yr
l -> Renderable (LayoutPick x yl yr) -> Renderable ()
forall a. Renderable a -> Renderable ()
noPickFn (Renderable (LayoutPick x yl yr) -> Renderable ())
-> Renderable (LayoutPick x yl yr) -> Renderable ()
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr
-> ([LegendItem], [LegendItem]) -> Renderable (LayoutPick x yl yr)
forall x yl yr.
LayoutLR x yl yr
-> ([LegendItem], [LegendItem]) -> Renderable (LayoutPick x yl yr)
renderLegendLR LayoutLR x yl yr
l ([LegendItem], [LegendItem])
legenditems
legenditems :: ([LegendItem], [LegendItem])
legenditems = case (StackedLayouts x -> Bool
forall x. StackedLayouts x -> Bool
_slayouts_compress_legend StackedLayouts x
slp,Bool
isBottomPlot) of
(Bool
False,Bool
_) -> case StackedLayout x
sl of
StackedLayout Layout x y
l -> (Layout x y -> [LegendItem]
forall x y. Layout x y -> [LegendItem]
getLegendItems Layout x y
l, [])
StackedLayoutLR LayoutLR x yl yr
l -> LayoutLR x yl yr -> ([LegendItem], [LegendItem])
forall x yl yr. LayoutLR x yl yr -> ([LegendItem], [LegendItem])
getLegendItemsLR LayoutLR x yl yr
l
(Bool
True,Bool
True) -> ([LegendItem], [LegendItem])
allLegendItems
(Bool
True,Bool
False) -> ([],[])
mkPlotArea :: LayoutAxis x -> Grid (Renderable ())
mkPlotArea :: LayoutAxis x -> Grid (Renderable ())
mkPlotArea LayoutAxis x
axis = case StackedLayout x
sl of
StackedLayout Layout x y
l -> (Renderable (LayoutPick x y y) -> Renderable ())
-> Grid (Renderable (LayoutPick x y y)) -> Grid (Renderable ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Renderable (LayoutPick x y y) -> Renderable ()
forall a. Renderable a -> Renderable ()
noPickFn
(Grid (Renderable (LayoutPick x y y)) -> Grid (Renderable ()))
-> Grid (Renderable (LayoutPick x y y)) -> Grid (Renderable ())
forall a b. (a -> b) -> a -> b
$ Layout x y -> Grid (Renderable (LayoutPick x y y))
forall x y.
(Ord x, Ord y) =>
Layout x y -> Grid (Renderable (LayoutPick x y y))
layoutPlotAreaToGrid
(Layout x y -> Grid (Renderable (LayoutPick x y y)))
-> Layout x y -> Grid (Renderable (LayoutPick x y y))
forall a b. (a -> b) -> a -> b
$ Layout x y
l { _layout_x_axis :: LayoutAxis x
_layout_x_axis = LayoutAxis x
axis }
StackedLayoutLR LayoutLR x yl yr
l -> (Renderable (LayoutPick x yl yr) -> Renderable ())
-> Grid (Renderable (LayoutPick x yl yr)) -> Grid (Renderable ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Renderable (LayoutPick x yl yr) -> Renderable ()
forall a. Renderable a -> Renderable ()
noPickFn
(Grid (Renderable (LayoutPick x yl yr)) -> Grid (Renderable ()))
-> Grid (Renderable (LayoutPick x yl yr)) -> Grid (Renderable ())
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr))
forall x yl yr.
(Ord x, Ord yl, Ord yr) =>
LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr))
layoutLRPlotAreaToGrid
(LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr)))
-> LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr))
forall a b. (a -> b) -> a -> b
$ LayoutLR x yl yr
l { _layoutlr_x_axis :: LayoutAxis x
_layoutlr_x_axis = LayoutAxis x
axis }
showLegend :: Bool
showLegend = Bool -> Bool
not ([LegendItem] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (([LegendItem], [LegendItem]) -> [LegendItem]
forall a b. (a, b) -> a
fst ([LegendItem], [LegendItem])
legenditems)) Bool -> Bool -> Bool
|| Bool -> Bool
not ([LegendItem] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (([LegendItem], [LegendItem]) -> [LegendItem]
forall a b. (a, b) -> b
snd ([LegendItem], [LegendItem])
legenditems))
isBottomPlot :: Bool
isBottomPlot = Int
i Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== [StackedLayout x] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [StackedLayout x]
sls Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1
lm :: Double
lm = case StackedLayout x
sl of
StackedLayout Layout x y
l -> Layout x y -> Double
forall x y. Layout x y -> Double
_layout_margin Layout x y
l
StackedLayoutLR LayoutLR x yl yr
l -> LayoutLR x yl yr -> Double
forall x y1 y2. LayoutLR x y1 y2 -> Double
_layoutlr_margin LayoutLR x yl yr
l
xAxis :: LayoutAxis x
xAxis :: LayoutAxis x
xAxis = case StackedLayout x
sl of
StackedLayout Layout x y
l -> Layout x y -> LayoutAxis x
forall x y. Layout x y -> LayoutAxis x
_layout_x_axis Layout x y
l
StackedLayoutLR LayoutLR x yl yr
l -> LayoutLR x yl yr -> LayoutAxis x
forall x y1 y2. LayoutLR x y1 y2 -> LayoutAxis x
_layoutlr_x_axis LayoutLR x yl yr
l
usedAxis :: LayoutAxis x
usedAxis :: LayoutAxis x
usedAxis = LayoutAxis x
xAxis
{ _laxis_generate :: AxisFn x
_laxis_generate = AxisData x -> AxisFn x
forall a b. a -> b -> a
const (LayoutAxis x -> AxisFn x
forall x. LayoutAxis x -> AxisFn x
_laxis_generate LayoutAxis x
xAxis [x]
all_xvals) }
bg :: FillStyle
bg = case StackedLayout x
sl1 of
StackedLayout Layout x y
l -> Layout x y -> FillStyle
forall x y. Layout x y -> FillStyle
_layout_background Layout x y
l
StackedLayoutLR LayoutLR x yl yr
l -> LayoutLR x yl yr -> FillStyle
forall x y1 y2. LayoutLR x y1 y2 -> FillStyle
_layoutlr_background LayoutLR x yl yr
l
getXVals :: StackedLayout x -> [x]
getXVals :: StackedLayout x -> [x]
getXVals (StackedLayout Layout x y
l) = Layout x y -> [x]
forall x y. Layout x y -> [x]
getLayoutXVals Layout x y
l
getXVals (StackedLayoutLR LayoutLR x yl yr
l) = LayoutLR x yl yr -> [x]
forall x yl yr. LayoutLR x yl yr -> [x]
getLayoutLRXVals LayoutLR x yl yr
l
all_xvals :: [x]
all_xvals = (StackedLayout x -> [x]) -> [StackedLayout x] -> [x]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap StackedLayout x -> [x]
getXVals [StackedLayout x]
sls
allLegendItems :: ([LegendItem], [LegendItem])
allLegendItems = ((StackedLayout x -> [LegendItem])
-> [StackedLayout x] -> [LegendItem]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (([LegendItem], [LegendItem]) -> [LegendItem]
forall a b. (a, b) -> a
fst(([LegendItem], [LegendItem]) -> [LegendItem])
-> (StackedLayout x -> ([LegendItem], [LegendItem]))
-> StackedLayout x
-> [LegendItem]
forall b c a. (b -> c) -> (a -> b) -> a -> c
.StackedLayout x -> ([LegendItem], [LegendItem])
legendItems) [StackedLayout x]
sls, (StackedLayout x -> [LegendItem])
-> [StackedLayout x] -> [LegendItem]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (([LegendItem], [LegendItem]) -> [LegendItem]
forall a b. (a, b) -> b
snd(([LegendItem], [LegendItem]) -> [LegendItem])
-> (StackedLayout x -> ([LegendItem], [LegendItem]))
-> StackedLayout x
-> [LegendItem]
forall b c a. (b -> c) -> (a -> b) -> a -> c
.StackedLayout x -> ([LegendItem], [LegendItem])
legendItems) [StackedLayout x]
sls)
legendItems :: StackedLayout x -> ([LegendItem], [LegendItem])
legendItems :: StackedLayout x -> ([LegendItem], [LegendItem])
legendItems (StackedLayout Layout x y
l) = (Layout x y -> [LegendItem]
forall x y. Layout x y -> [LegendItem]
getLegendItems Layout x y
l, [])
legendItems (StackedLayoutLR LayoutLR x yl yr
l) = LayoutLR x yl yr -> ([LegendItem], [LegendItem])
forall x yl yr. LayoutLR x yl yr -> ([LegendItem], [LegendItem])
getLegendItemsLR LayoutLR x yl yr
l
noPickFn :: Renderable a -> Renderable ()
noPickFn :: Renderable a -> Renderable ()
noPickFn = (a -> ()) -> Renderable a -> Renderable ()
forall a b. (a -> b) -> Renderable a -> Renderable b
mapPickFn (() -> a -> ()
forall a b. a -> b -> a
const ())
addMarginsToGrid :: (Double,Double,Double,Double) -> Grid (Renderable a)
-> Grid (Renderable a)
addMarginsToGrid :: (Double, Double, Double, Double)
-> Grid (Renderable a) -> Grid (Renderable a)
addMarginsToGrid (Double
t,Double
b,Double
l,Double
r) Grid (Renderable a)
g = [Grid (Renderable a)] -> Grid (Renderable a)
forall a. [Grid a] -> Grid a
aboveN [
[Grid (Renderable a)] -> Grid (Renderable a)
forall a. [Grid a] -> Grid a
besideN [Grid (Renderable a)
forall a. Grid a
er, Grid (Renderable a)
forall a. Grid (Renderable a)
ts, Grid (Renderable a)
forall a. Grid a
er],
[Grid (Renderable a)] -> Grid (Renderable a)
forall a. [Grid a] -> Grid a
besideN [Grid (Renderable a)
forall a. Grid (Renderable a)
ls, Grid (Renderable a)
g, Grid (Renderable a)
forall a. Grid (Renderable a)
rs],
[Grid (Renderable a)] -> Grid (Renderable a)
forall a. [Grid a] -> Grid a
besideN [Grid (Renderable a)
forall a. Grid a
er, Grid (Renderable a)
forall a. Grid (Renderable a)
bs, Grid (Renderable a)
forall a. Grid a
er]
]
where
er :: Grid a
er = Grid a
forall a. Grid a
empty
ts :: Grid (Renderable a)
ts = Renderable a -> Grid (Renderable a)
forall a. a -> Grid a
tval (Renderable a -> Grid (Renderable a))
-> Renderable a -> Grid (Renderable a)
forall a b. (a -> b) -> a -> b
$ SpaceWeight -> Renderable a
forall a. SpaceWeight -> Renderable a
spacer (Double
0,Double
t)
ls :: Grid (Renderable a)
ls = Renderable a -> Grid (Renderable a)
forall a. a -> Grid a
tval (Renderable a -> Grid (Renderable a))
-> Renderable a -> Grid (Renderable a)
forall a b. (a -> b) -> a -> b
$ SpaceWeight -> Renderable a
forall a. SpaceWeight -> Renderable a
spacer (Double
l,Double
0)
bs :: Grid (Renderable a)
bs = Renderable a -> Grid (Renderable a)
forall a. a -> Grid a
tval (Renderable a -> Grid (Renderable a))
-> Renderable a -> Grid (Renderable a)
forall a b. (a -> b) -> a -> b
$ SpaceWeight -> Renderable a
forall a. SpaceWeight -> Renderable a
spacer (Double
0,Double
b)
rs :: Grid (Renderable a)
rs = Renderable a -> Grid (Renderable a)
forall a. a -> Grid a
tval (Renderable a -> Grid (Renderable a))
-> Renderable a -> Grid (Renderable a)
forall a b. (a -> b) -> a -> b
$ SpaceWeight -> Renderable a
forall a. SpaceWeight -> Renderable a
spacer (Double
r,Double
0)
titleToRenderable :: Double -> FontStyle -> String -> Renderable (LayoutPick x yl yr)
titleToRenderable :: Double -> FontStyle -> String -> Renderable (LayoutPick x yl yr)
titleToRenderable Double
_ FontStyle
_ String
"" = Renderable (LayoutPick x yl yr)
forall a. Renderable a
emptyRenderable
titleToRenderable Double
lm FontStyle
fs String
s = (Double, Double, Double, Double)
-> Renderable (LayoutPick x yl yr)
-> Renderable (LayoutPick x yl yr)
forall a.
(Double, Double, Double, Double) -> Renderable a -> Renderable a
addMargins (Double
lmDouble -> Double -> Double
forall a. Fractional a => a -> a -> a
/Double
2,Double
0,Double
0,Double
0) ((String -> LayoutPick x yl yr)
-> Renderable String -> Renderable (LayoutPick x yl yr)
forall a b. (a -> b) -> Renderable a -> Renderable b
mapPickFn String -> LayoutPick x yl yr
forall x y1 y2. String -> LayoutPick x y1 y2
LayoutPick_Title Renderable String
title)
where
title :: Renderable String
title = FontStyle
-> HTextAnchor -> VTextAnchor -> String -> Renderable String
label FontStyle
fs HTextAnchor
HTA_Centre VTextAnchor
VTA_Centre String
s
mkLegend :: Maybe LegendStyle -> Double -> [LegendItem] -> Renderable (LayoutPick x yl yr)
mkLegend :: Maybe LegendStyle
-> Double -> [LegendItem] -> Renderable (LayoutPick x yl yr)
mkLegend Maybe LegendStyle
mls Double
lm [LegendItem]
vals = case Maybe LegendStyle
mls of
Maybe LegendStyle
Nothing -> Renderable (LayoutPick x yl yr)
forall a. Renderable a
emptyRenderable
Just LegendStyle
ls -> case (LegendItem -> Bool) -> [LegendItem] -> [LegendItem]
forall a. (a -> Bool) -> [a] -> [a]
filter ((String -> String -> Bool
forall a. Eq a => a -> a -> Bool
/=String
"")(String -> Bool) -> (LegendItem -> String) -> LegendItem -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
.LegendItem -> String
forall a b. (a, b) -> a
fst) [LegendItem]
vals of
[] -> Renderable (LayoutPick x yl yr)
forall a. Renderable a
emptyRenderable ;
[LegendItem]
lvs -> (Double, Double, Double, Double)
-> Renderable (LayoutPick x yl yr)
-> Renderable (LayoutPick x yl yr)
forall a.
(Double, Double, Double, Double) -> Renderable a -> Renderable a
addMargins (Double
0,Double
lm,Double
lm,Double
lm) (Renderable (LayoutPick x yl yr)
-> Renderable (LayoutPick x yl yr))
-> Renderable (LayoutPick x yl yr)
-> Renderable (LayoutPick x yl yr)
forall a b. (a -> b) -> a -> b
$
(String -> LayoutPick x yl yr)
-> Renderable String -> Renderable (LayoutPick x yl yr)
forall a b. (a -> b) -> Renderable a -> Renderable b
mapPickFn String -> LayoutPick x yl yr
forall x y1 y2. String -> LayoutPick x y1 y2
LayoutPick_Legend (Renderable String -> Renderable (LayoutPick x yl yr))
-> Renderable String -> Renderable (LayoutPick x yl yr)
forall a b. (a -> b) -> a -> b
$ Legend Any Any -> Renderable String
forall x y. Legend x y -> Renderable String
legendToRenderable (LegendStyle -> [LegendItem] -> Legend Any Any
forall x y. LegendStyle -> [LegendItem] -> Legend x y
Legend LegendStyle
ls [LegendItem]
lvs)
data LayoutGridElements x yl yr = LayoutGridElements {
LayoutGridElements x yl yr -> Renderable (LayoutPick x yl yr)
lge_plots :: Renderable (LayoutPick x yl yr),
LayoutGridElements x yl yr -> (Maybe (AxisT x), String, FontStyle)
lge_taxis :: (Maybe (AxisT x),String,FontStyle),
LayoutGridElements x yl yr -> (Maybe (AxisT x), String, FontStyle)
lge_baxis :: (Maybe (AxisT x),String,FontStyle),
LayoutGridElements x yl yr -> (Maybe (AxisT yl), String, FontStyle)
lge_laxis :: (Maybe (AxisT yl),String,FontStyle),
LayoutGridElements x yl yr -> (Maybe (AxisT yr), String, FontStyle)
lge_raxis :: (Maybe (AxisT yr),String,FontStyle),
LayoutGridElements x yl yr -> Double
lge_margin :: Double
}
buildGrid :: (Ord x, Ord yl, Ord yr) => LayoutGridElements x yl yr -> Grid (Renderable (LayoutPick x yl yr))
buildGrid :: LayoutGridElements x yl yr
-> Grid (Renderable (LayoutPick x yl yr))
buildGrid LayoutGridElements x yl yr
lge = Grid (Renderable (LayoutPick x yl yr))
layer2 Grid (Renderable (LayoutPick x yl yr))
-> Grid (Renderable (LayoutPick x yl yr))
-> Grid (Renderable (LayoutPick x yl yr))
forall a. Grid a -> Grid a -> Grid a
`overlay` Grid (Renderable (LayoutPick x yl yr))
layer1
where
layer1 :: Grid (Renderable (LayoutPick x yl yr))
layer1 = [Grid (Renderable (LayoutPick x yl yr))]
-> Grid (Renderable (LayoutPick x yl yr))
forall a. [Grid a] -> Grid a
aboveN
[ [Grid (Renderable (LayoutPick x yl yr))]
-> Grid (Renderable (LayoutPick x yl yr))
forall a. [Grid a] -> Grid a
besideN [Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er ]
, [Grid (Renderable (LayoutPick x yl yr))]
-> Grid (Renderable (LayoutPick x yl yr))
forall a. [Grid a] -> Grid a
besideN [Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, SpaceWeight
-> Grid (Renderable (LayoutPick x yl yr))
-> Grid (Renderable (LayoutPick x yl yr))
forall a. SpaceWeight -> Grid a -> Grid a
weights (Double
1,Double
1) Grid (Renderable (LayoutPick x yl yr))
plots ]
]
layer2 :: Grid (Renderable (LayoutPick x yl yr))
layer2 = [Grid (Renderable (LayoutPick x yl yr))]
-> Grid (Renderable (LayoutPick x yl yr))
forall a. [Grid a] -> Grid a
aboveN
[ [Grid (Renderable (LayoutPick x yl yr))]
-> Grid (Renderable (LayoutPick x yl yr))
forall a. [Grid a] -> Grid a
besideN [Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
tl, Grid (Renderable (LayoutPick x yl yr))
forall y1 y2. Grid (Renderable (LayoutPick x y1 y2))
taxis, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
tr, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er ]
, [Grid (Renderable (LayoutPick x yl yr))]
-> Grid (Renderable (LayoutPick x yl yr))
forall a. [Grid a] -> Grid a
besideN [Grid (Renderable (LayoutPick x yl yr))
forall x yl yr. Grid (Renderable (LayoutPick x yl yr))
ltitle, Grid (Renderable (LayoutPick x yl yr))
forall x yl yr. Grid (Renderable (LayoutPick x yl yr))
lam, Grid (Renderable (LayoutPick x yl yr))
forall x y2. Grid (Renderable (LayoutPick x yl y2))
laxis, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall x y1. Grid (Renderable (LayoutPick x y1 yr))
raxis, Grid (Renderable (LayoutPick x yl yr))
forall x yl yr. Grid (Renderable (LayoutPick x yl yr))
ram, Grid (Renderable (LayoutPick x yl yr))
forall x yl yr. Grid (Renderable (LayoutPick x yl yr))
rtitle ]
, [Grid (Renderable (LayoutPick x yl yr))]
-> Grid (Renderable (LayoutPick x yl yr))
forall a. [Grid a] -> Grid a
besideN [Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
bl, Grid (Renderable (LayoutPick x yl yr))
forall y1 y2. Grid (Renderable (LayoutPick x y1 y2))
baxis, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
br, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er ]
, [Grid (Renderable (LayoutPick x yl yr))]
-> Grid (Renderable (LayoutPick x yl yr))
forall a. [Grid a] -> Grid a
besideN [Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall x yl yr. Grid (Renderable (LayoutPick x yl yr))
btitle, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er, Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er ]
]
er :: Grid (Renderable a)
er = Renderable a -> Grid (Renderable a)
forall a. a -> Grid a
tval Renderable a
forall a. Renderable a
emptyRenderable
plots :: Grid (Renderable (LayoutPick x yl yr))
plots = Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a. a -> Grid a
tval (Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr)))
-> Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a b. (a -> b) -> a -> b
$ LayoutGridElements x yl yr -> Renderable (LayoutPick x yl yr)
forall x yl yr.
LayoutGridElements x yl yr -> Renderable (LayoutPick x yl yr)
lge_plots LayoutGridElements x yl yr
lge
(Maybe (AxisT x)
tdata,String
_,FontStyle
_) = LayoutGridElements x yl yr -> (Maybe (AxisT x), String, FontStyle)
forall x yl yr.
LayoutGridElements x yl yr -> (Maybe (AxisT x), String, FontStyle)
lge_taxis LayoutGridElements x yl yr
lge
(Maybe (AxisT x)
bdata,String
blbl,FontStyle
bstyle) = LayoutGridElements x yl yr -> (Maybe (AxisT x), String, FontStyle)
forall x yl yr.
LayoutGridElements x yl yr -> (Maybe (AxisT x), String, FontStyle)
lge_baxis LayoutGridElements x yl yr
lge
(Maybe (AxisT yl)
ldata,String
llbl,FontStyle
lstyle) = LayoutGridElements x yl yr -> (Maybe (AxisT yl), String, FontStyle)
forall x yl yr.
LayoutGridElements x yl yr -> (Maybe (AxisT yl), String, FontStyle)
lge_laxis LayoutGridElements x yl yr
lge
(Maybe (AxisT yr)
rdata,String
rlbl,FontStyle
rstyle) = LayoutGridElements x yl yr -> (Maybe (AxisT yr), String, FontStyle)
forall x yl yr.
LayoutGridElements x yl yr -> (Maybe (AxisT yr), String, FontStyle)
lge_raxis LayoutGridElements x yl yr
lge
(Grid (Renderable (LayoutPick x yl yr))
btitle,Grid (Renderable (LayoutPick x yl yr))
_) = HTextAnchor
-> VTextAnchor
-> Double
-> String
-> FontStyle
-> (String -> LayoutPick x yl yr)
-> (Grid (Renderable (LayoutPick x yl yr)),
Grid (Renderable (LayoutPick x yl yr)))
forall x yl yr.
HTextAnchor
-> VTextAnchor
-> Double
-> String
-> FontStyle
-> (String -> LayoutPick x yl yr)
-> (Grid (Renderable (LayoutPick x yl yr)),
Grid (Renderable (LayoutPick x yl yr)))
mktitle HTextAnchor
HTA_Centre VTextAnchor
VTA_Top Double
0 String
blbl FontStyle
bstyle String -> LayoutPick x yl yr
forall x y1 y2. String -> LayoutPick x y1 y2
LayoutPick_XBottomAxisTitle
(Grid (Renderable (LayoutPick x yl yr))
ltitle,Grid (Renderable (LayoutPick x yl yr))
lam) = HTextAnchor
-> VTextAnchor
-> Double
-> String
-> FontStyle
-> (String -> LayoutPick x yl yr)
-> (Grid (Renderable (LayoutPick x yl yr)),
Grid (Renderable (LayoutPick x yl yr)))
forall x yl yr.
HTextAnchor
-> VTextAnchor
-> Double
-> String
-> FontStyle
-> (String -> LayoutPick x yl yr)
-> (Grid (Renderable (LayoutPick x yl yr)),
Grid (Renderable (LayoutPick x yl yr)))
mktitle HTextAnchor
HTA_Right VTextAnchor
VTA_Centre Double
270 String
llbl FontStyle
lstyle String -> LayoutPick x yl yr
forall x y1 y2. String -> LayoutPick x y1 y2
LayoutPick_YLeftAxisTitle
(Grid (Renderable (LayoutPick x yl yr))
rtitle,Grid (Renderable (LayoutPick x yl yr))
ram) = HTextAnchor
-> VTextAnchor
-> Double
-> String
-> FontStyle
-> (String -> LayoutPick x yl yr)
-> (Grid (Renderable (LayoutPick x yl yr)),
Grid (Renderable (LayoutPick x yl yr)))
forall x yl yr.
HTextAnchor
-> VTextAnchor
-> Double
-> String
-> FontStyle
-> (String -> LayoutPick x yl yr)
-> (Grid (Renderable (LayoutPick x yl yr)),
Grid (Renderable (LayoutPick x yl yr)))
mktitle HTextAnchor
HTA_Left VTextAnchor
VTA_Centre Double
270 String
rlbl FontStyle
rstyle String -> LayoutPick x yl yr
forall x y1 y2. String -> LayoutPick x y1 y2
LayoutPick_YRightAxisTitle
baxis :: Grid (Renderable (LayoutPick x y1 y2))
baxis = Renderable (LayoutPick x y1 y2)
-> Grid (Renderable (LayoutPick x y1 y2))
forall a. a -> Grid a
tval (Renderable (LayoutPick x y1 y2)
-> Grid (Renderable (LayoutPick x y1 y2)))
-> Renderable (LayoutPick x y1 y2)
-> Grid (Renderable (LayoutPick x y1 y2))
forall a b. (a -> b) -> a -> b
$ Renderable (LayoutPick x y1 y2)
-> (AxisT x -> Renderable (LayoutPick x y1 y2))
-> Maybe (AxisT x)
-> Renderable (LayoutPick x y1 y2)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Renderable (LayoutPick x y1 y2)
forall a. Renderable a
emptyRenderable
((x -> LayoutPick x y1 y2)
-> Renderable x -> Renderable (LayoutPick x y1 y2)
forall a b. (a -> b) -> Renderable a -> Renderable b
mapPickFn x -> LayoutPick x y1 y2
forall x y1 y2. x -> LayoutPick x y1 y2
LayoutPick_XBottomAxis (Renderable x -> Renderable (LayoutPick x y1 y2))
-> (AxisT x -> Renderable x)
-> AxisT x
-> Renderable (LayoutPick x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AxisT x -> Renderable x
forall x. AxisT x -> Renderable x
axisToRenderable) Maybe (AxisT x)
bdata
taxis :: Grid (Renderable (LayoutPick x y1 y2))
taxis = Renderable (LayoutPick x y1 y2)
-> Grid (Renderable (LayoutPick x y1 y2))
forall a. a -> Grid a
tval (Renderable (LayoutPick x y1 y2)
-> Grid (Renderable (LayoutPick x y1 y2)))
-> Renderable (LayoutPick x y1 y2)
-> Grid (Renderable (LayoutPick x y1 y2))
forall a b. (a -> b) -> a -> b
$ Renderable (LayoutPick x y1 y2)
-> (AxisT x -> Renderable (LayoutPick x y1 y2))
-> Maybe (AxisT x)
-> Renderable (LayoutPick x y1 y2)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Renderable (LayoutPick x y1 y2)
forall a. Renderable a
emptyRenderable
((x -> LayoutPick x y1 y2)
-> Renderable x -> Renderable (LayoutPick x y1 y2)
forall a b. (a -> b) -> Renderable a -> Renderable b
mapPickFn x -> LayoutPick x y1 y2
forall x y1 y2. x -> LayoutPick x y1 y2
LayoutPick_XTopAxis (Renderable x -> Renderable (LayoutPick x y1 y2))
-> (AxisT x -> Renderable x)
-> AxisT x
-> Renderable (LayoutPick x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AxisT x -> Renderable x
forall x. AxisT x -> Renderable x
axisToRenderable) Maybe (AxisT x)
tdata
laxis :: Grid (Renderable (LayoutPick x yl y2))
laxis = Renderable (LayoutPick x yl y2)
-> Grid (Renderable (LayoutPick x yl y2))
forall a. a -> Grid a
tval (Renderable (LayoutPick x yl y2)
-> Grid (Renderable (LayoutPick x yl y2)))
-> Renderable (LayoutPick x yl y2)
-> Grid (Renderable (LayoutPick x yl y2))
forall a b. (a -> b) -> a -> b
$ Renderable (LayoutPick x yl y2)
-> (AxisT yl -> Renderable (LayoutPick x yl y2))
-> Maybe (AxisT yl)
-> Renderable (LayoutPick x yl y2)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Renderable (LayoutPick x yl y2)
forall a. Renderable a
emptyRenderable
((yl -> LayoutPick x yl y2)
-> Renderable yl -> Renderable (LayoutPick x yl y2)
forall a b. (a -> b) -> Renderable a -> Renderable b
mapPickFn yl -> LayoutPick x yl y2
forall x y1 y2. y1 -> LayoutPick x y1 y2
LayoutPick_YLeftAxis (Renderable yl -> Renderable (LayoutPick x yl y2))
-> (AxisT yl -> Renderable yl)
-> AxisT yl
-> Renderable (LayoutPick x yl y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AxisT yl -> Renderable yl
forall x. AxisT x -> Renderable x
axisToRenderable) Maybe (AxisT yl)
ldata
raxis :: Grid (Renderable (LayoutPick x y1 yr))
raxis = Renderable (LayoutPick x y1 yr)
-> Grid (Renderable (LayoutPick x y1 yr))
forall a. a -> Grid a
tval (Renderable (LayoutPick x y1 yr)
-> Grid (Renderable (LayoutPick x y1 yr)))
-> Renderable (LayoutPick x y1 yr)
-> Grid (Renderable (LayoutPick x y1 yr))
forall a b. (a -> b) -> a -> b
$ Renderable (LayoutPick x y1 yr)
-> (AxisT yr -> Renderable (LayoutPick x y1 yr))
-> Maybe (AxisT yr)
-> Renderable (LayoutPick x y1 yr)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Renderable (LayoutPick x y1 yr)
forall a. Renderable a
emptyRenderable
((yr -> LayoutPick x y1 yr)
-> Renderable yr -> Renderable (LayoutPick x y1 yr)
forall a b. (a -> b) -> Renderable a -> Renderable b
mapPickFn yr -> LayoutPick x y1 yr
forall x y1 y2. y2 -> LayoutPick x y1 y2
LayoutPick_YRightAxis (Renderable yr -> Renderable (LayoutPick x y1 yr))
-> (AxisT yr -> Renderable yr)
-> AxisT yr
-> Renderable (LayoutPick x y1 yr)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AxisT yr -> Renderable yr
forall x. AxisT x -> Renderable x
axisToRenderable) Maybe (AxisT yr)
rdata
tl :: Grid (Renderable a)
tl = Renderable a -> Grid (Renderable a)
forall a. a -> Grid a
tval (Renderable a -> Grid (Renderable a))
-> Renderable a -> Grid (Renderable a)
forall a b. (a -> b) -> a -> b
$ (SpaceWeight -> Double)
-> Maybe (AxisT x)
-> (SpaceWeight -> Double)
-> Maybe (AxisT yl)
-> Renderable a
forall x y a.
(Ord x, Ord y) =>
(SpaceWeight -> Double)
-> Maybe (AxisT x)
-> (SpaceWeight -> Double)
-> Maybe (AxisT y)
-> Renderable a
axesSpacer SpaceWeight -> Double
forall a b. (a, b) -> a
fst Maybe (AxisT x)
tdata SpaceWeight -> Double
forall a b. (a, b) -> a
fst Maybe (AxisT yl)
ldata
bl :: Grid (Renderable a)
bl = Renderable a -> Grid (Renderable a)
forall a. a -> Grid a
tval (Renderable a -> Grid (Renderable a))
-> Renderable a -> Grid (Renderable a)
forall a b. (a -> b) -> a -> b
$ (SpaceWeight -> Double)
-> Maybe (AxisT x)
-> (SpaceWeight -> Double)
-> Maybe (AxisT yl)
-> Renderable a
forall x y a.
(Ord x, Ord y) =>
(SpaceWeight -> Double)
-> Maybe (AxisT x)
-> (SpaceWeight -> Double)
-> Maybe (AxisT y)
-> Renderable a
axesSpacer SpaceWeight -> Double
forall a b. (a, b) -> a
fst Maybe (AxisT x)
bdata SpaceWeight -> Double
forall a b. (a, b) -> b
snd Maybe (AxisT yl)
ldata
tr :: Grid (Renderable a)
tr = Renderable a -> Grid (Renderable a)
forall a. a -> Grid a
tval (Renderable a -> Grid (Renderable a))
-> Renderable a -> Grid (Renderable a)
forall a b. (a -> b) -> a -> b
$ (SpaceWeight -> Double)
-> Maybe (AxisT x)
-> (SpaceWeight -> Double)
-> Maybe (AxisT yr)
-> Renderable a
forall x y a.
(Ord x, Ord y) =>
(SpaceWeight -> Double)
-> Maybe (AxisT x)
-> (SpaceWeight -> Double)
-> Maybe (AxisT y)
-> Renderable a
axesSpacer SpaceWeight -> Double
forall a b. (a, b) -> b
snd Maybe (AxisT x)
tdata SpaceWeight -> Double
forall a b. (a, b) -> a
fst Maybe (AxisT yr)
rdata
br :: Grid (Renderable a)
br = Renderable a -> Grid (Renderable a)
forall a. a -> Grid a
tval (Renderable a -> Grid (Renderable a))
-> Renderable a -> Grid (Renderable a)
forall a b. (a -> b) -> a -> b
$ (SpaceWeight -> Double)
-> Maybe (AxisT x)
-> (SpaceWeight -> Double)
-> Maybe (AxisT yr)
-> Renderable a
forall x y a.
(Ord x, Ord y) =>
(SpaceWeight -> Double)
-> Maybe (AxisT x)
-> (SpaceWeight -> Double)
-> Maybe (AxisT y)
-> Renderable a
axesSpacer SpaceWeight -> Double
forall a b. (a, b) -> b
snd Maybe (AxisT x)
bdata SpaceWeight -> Double
forall a b. (a, b) -> b
snd Maybe (AxisT yr)
rdata
mktitle :: HTextAnchor -> VTextAnchor
-> Double
-> String -> FontStyle
-> (String -> LayoutPick x yl yr)
-> ( Grid (Renderable (LayoutPick x yl yr))
, Grid (Renderable (LayoutPick x yl yr)) )
mktitle :: HTextAnchor
-> VTextAnchor
-> Double
-> String
-> FontStyle
-> (String -> LayoutPick x yl yr)
-> (Grid (Renderable (LayoutPick x yl yr)),
Grid (Renderable (LayoutPick x yl yr)))
mktitle HTextAnchor
ha VTextAnchor
va Double
rot String
lbl FontStyle
style String -> LayoutPick x yl yr
pf = if String
lbl String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
"" then (Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er,Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
er) else (Grid (Renderable (LayoutPick x yl yr))
labelG,Grid (Renderable (LayoutPick x yl yr))
forall a. Grid (Renderable a)
gapG)
where
labelG :: Grid (Renderable (LayoutPick x yl yr))
labelG = Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a. a -> Grid a
tval (Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr)))
-> Renderable (LayoutPick x yl yr)
-> Grid (Renderable (LayoutPick x yl yr))
forall a b. (a -> b) -> a -> b
$ (String -> LayoutPick x yl yr)
-> Renderable String -> Renderable (LayoutPick x yl yr)
forall a b. (a -> b) -> Renderable a -> Renderable b
mapPickFn String -> LayoutPick x yl yr
pf (Renderable String -> Renderable (LayoutPick x yl yr))
-> Renderable String -> Renderable (LayoutPick x yl yr)
forall a b. (a -> b) -> a -> b
$ FontStyle
-> HTextAnchor
-> VTextAnchor
-> Double
-> String
-> Renderable String
rlabel FontStyle
style HTextAnchor
ha VTextAnchor
va Double
rot String
lbl
gapG :: Grid (Renderable a)
gapG = Renderable a -> Grid (Renderable a)
forall a. a -> Grid a
tval (Renderable a -> Grid (Renderable a))
-> Renderable a -> Grid (Renderable a)
forall a b. (a -> b) -> a -> b
$ SpaceWeight -> Renderable a
forall a. SpaceWeight -> Renderable a
spacer (LayoutGridElements x yl yr -> Double
forall x yl yr. LayoutGridElements x yl yr -> Double
lge_margin LayoutGridElements x yl yr
lge,Double
0)
renderGrids :: RectSize -> (Maybe (AxisT x), Maybe (AxisT yl), Maybe (AxisT x), Maybe (AxisT yr)) -> BackendProgram ()
renderGrids :: SpaceWeight
-> (Maybe (AxisT x), Maybe (AxisT yl), Maybe (AxisT x),
Maybe (AxisT yr))
-> ProgramT ChartBackendInstr Identity ()
renderGrids SpaceWeight
sz (Maybe (AxisT x)
bAxis, Maybe (AxisT yl)
lAxis, Maybe (AxisT x)
tAxis, Maybe (AxisT yr)
rAxis) = do
()
-> (AxisT x -> ProgramT ChartBackendInstr Identity ())
-> Maybe (AxisT x)
-> ProgramT ChartBackendInstr Identity ()
forall (m :: * -> *) b a.
Monad m =>
b -> (a -> m b) -> Maybe a -> m b
maybeM () (SpaceWeight -> AxisT x -> ProgramT ChartBackendInstr Identity ()
forall z.
SpaceWeight -> AxisT z -> ProgramT ChartBackendInstr Identity ()
renderAxisGrid SpaceWeight
sz) Maybe (AxisT x)
tAxis
()
-> (AxisT x -> ProgramT ChartBackendInstr Identity ())
-> Maybe (AxisT x)
-> ProgramT ChartBackendInstr Identity ()
forall (m :: * -> *) b a.
Monad m =>
b -> (a -> m b) -> Maybe a -> m b
maybeM () (SpaceWeight -> AxisT x -> ProgramT ChartBackendInstr Identity ()
forall z.
SpaceWeight -> AxisT z -> ProgramT ChartBackendInstr Identity ()
renderAxisGrid SpaceWeight
sz) Maybe (AxisT x)
bAxis
()
-> (AxisT yl -> ProgramT ChartBackendInstr Identity ())
-> Maybe (AxisT yl)
-> ProgramT ChartBackendInstr Identity ()
forall (m :: * -> *) b a.
Monad m =>
b -> (a -> m b) -> Maybe a -> m b
maybeM () (SpaceWeight -> AxisT yl -> ProgramT ChartBackendInstr Identity ()
forall z.
SpaceWeight -> AxisT z -> ProgramT ChartBackendInstr Identity ()
renderAxisGrid SpaceWeight
sz) Maybe (AxisT yl)
lAxis
()
-> (AxisT yr -> ProgramT ChartBackendInstr Identity ())
-> Maybe (AxisT yr)
-> ProgramT ChartBackendInstr Identity ()
forall (m :: * -> *) b a.
Monad m =>
b -> (a -> m b) -> Maybe a -> m b
maybeM () (SpaceWeight -> AxisT yr -> ProgramT ChartBackendInstr Identity ()
forall z.
SpaceWeight -> AxisT z -> ProgramT ChartBackendInstr Identity ()
renderAxisGrid SpaceWeight
sz) Maybe (AxisT yr)
rAxis
optPairReverse :: Bool -> (a,a) -> (a,a)
optPairReverse :: Bool -> (a, a) -> (a, a)
optPairReverse Bool
rev (a
a,a
b) = if Bool
rev then (a
b,a
a) else (a
a,a
b)
renderSinglePlot :: RectSize -> Maybe (AxisT x) -> Maybe (AxisT y) -> Plot x y -> BackendProgram ()
renderSinglePlot :: SpaceWeight
-> Maybe (AxisT x)
-> Maybe (AxisT y)
-> Plot x y
-> ProgramT ChartBackendInstr Identity ()
renderSinglePlot (Double
w, Double
h) (Just (AxisT RectEdge
_ AxisStyle
_ Bool
xrev AxisData x
xaxis)) (Just (AxisT RectEdge
_ AxisStyle
_ Bool
yrev AxisData y
yaxis)) Plot x y
p =
let xr :: SpaceWeight
xr = Bool -> SpaceWeight -> SpaceWeight
forall a. Bool -> (a, a) -> (a, a)
optPairReverse Bool
xrev (Double
0, Double
w)
yr :: SpaceWeight
yr = Bool -> SpaceWeight -> SpaceWeight
forall a. Bool -> (a, a) -> (a, a)
optPairReverse Bool
yrev (Double
h, Double
0)
pmfn :: (Limit x, Limit y) -> Point
pmfn (Limit x
x,Limit y
y) = Double -> Double -> Point
Point (SpaceWeight -> (x -> Double) -> Limit x -> Double
forall a t. (a, a) -> (t -> a) -> Limit t -> a
mapv SpaceWeight
xr (AxisData x -> SpaceWeight -> x -> Double
forall x. AxisData x -> SpaceWeight -> x -> Double
_axis_viewport AxisData x
xaxis SpaceWeight
xr) Limit x
x)
(SpaceWeight -> (y -> Double) -> Limit y -> Double
forall a t. (a, a) -> (t -> a) -> Limit t -> a
mapv SpaceWeight
yr (AxisData y -> SpaceWeight -> y -> Double
forall x. AxisData x -> SpaceWeight -> x -> Double
_axis_viewport AxisData y
yaxis SpaceWeight
yr) Limit y
y)
mapv :: (a, a) -> (t -> a) -> Limit t -> a
mapv (a, a)
lims t -> a
_ Limit t
LMin = (a, a) -> a
forall a b. (a, b) -> a
fst (a, a)
lims
mapv (a, a)
lims t -> a
_ Limit t
LMax = (a, a) -> a
forall a b. (a, b) -> b
snd (a, a)
lims
mapv (a, a)
_ t -> a
f (LValue t
v) = t -> a
f t
v
in Plot x y
-> ((Limit x, Limit y) -> Point)
-> ProgramT ChartBackendInstr Identity ()
forall x y.
Plot x y
-> PointMapFn x y -> ProgramT ChartBackendInstr Identity ()
_plot_render Plot x y
p (Limit x, Limit y) -> Point
pmfn
renderSinglePlot SpaceWeight
_ Maybe (AxisT x)
_ Maybe (AxisT y)
_ Plot x y
_ = () -> ProgramT ChartBackendInstr Identity ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
axesSpacer :: (Ord x, Ord y)
=> ((Double, Double) -> Double) -> Maybe (AxisT x)
-> ((Double, Double) -> Double) -> Maybe (AxisT y)
-> Renderable a
axesSpacer :: (SpaceWeight -> Double)
-> Maybe (AxisT x)
-> (SpaceWeight -> Double)
-> Maybe (AxisT y)
-> Renderable a
axesSpacer SpaceWeight -> Double
f1 Maybe (AxisT x)
a1 SpaceWeight -> Double
f2 Maybe (AxisT y)
a2 = BackendProgram (Renderable a) -> Renderable a
forall a. BackendProgram (Renderable a) -> Renderable a
embedRenderable (BackendProgram (Renderable a) -> Renderable a)
-> BackendProgram (Renderable a) -> Renderable a
forall a b. (a -> b) -> a -> b
$ do
SpaceWeight
oh1 <- SpaceWeight
-> (AxisT x -> BackendProgram SpaceWeight)
-> Maybe (AxisT x)
-> BackendProgram SpaceWeight
forall (m :: * -> *) b a.
Monad m =>
b -> (a -> m b) -> Maybe a -> m b
maybeM (Double
0,Double
0) AxisT x -> BackendProgram SpaceWeight
forall x. Ord x => AxisT x -> BackendProgram SpaceWeight
axisOverhang Maybe (AxisT x)
a1
SpaceWeight
oh2 <- SpaceWeight
-> (AxisT y -> BackendProgram SpaceWeight)
-> Maybe (AxisT y)
-> BackendProgram SpaceWeight
forall (m :: * -> *) b a.
Monad m =>
b -> (a -> m b) -> Maybe a -> m b
maybeM (Double
0,Double
0) AxisT y -> BackendProgram SpaceWeight
forall x. Ord x => AxisT x -> BackendProgram SpaceWeight
axisOverhang Maybe (AxisT y)
a2
Renderable a -> BackendProgram (Renderable a)
forall (m :: * -> *) a. Monad m => a -> m a
return (SpaceWeight -> Renderable a
forall a. SpaceWeight -> Renderable a
spacer (SpaceWeight -> Double
f1 SpaceWeight
oh1, SpaceWeight -> Double
f2 SpaceWeight
oh2))
mkAxis :: RectEdge -> LayoutAxis z -> [z] -> Maybe (AxisT z)
mkAxis :: RectEdge -> LayoutAxis z -> [z] -> Maybe (AxisT z)
mkAxis RectEdge
edge LayoutAxis z
laxis [z]
vals = case Bool
axisVisible of
Bool
False -> Maybe (AxisT z)
forall a. Maybe a
Nothing
Bool
True -> AxisT z -> Maybe (AxisT z)
forall a. a -> Maybe a
Just (AxisT z -> Maybe (AxisT z)) -> AxisT z -> Maybe (AxisT z)
forall a b. (a -> b) -> a -> b
$ RectEdge -> AxisStyle -> Bool -> AxisData z -> AxisT z
forall x. RectEdge -> AxisStyle -> Bool -> AxisData x -> AxisT x
AxisT RectEdge
edge AxisStyle
style Bool
rev AxisData z
adata
where
style :: AxisStyle
style = LayoutAxis z -> AxisStyle
forall x. LayoutAxis x -> AxisStyle
_laxis_style LayoutAxis z
laxis
rev :: Bool
rev = LayoutAxis z -> Bool
forall x. LayoutAxis x -> Bool
_laxis_reverse LayoutAxis z
laxis
adata :: AxisData z
adata = LayoutAxis z -> AxisData z -> AxisData z
forall x. LayoutAxis x -> AxisData x -> AxisData x
_laxis_override LayoutAxis z
laxis (LayoutAxis z -> AxisFn z
forall x. LayoutAxis x -> AxisFn x
_laxis_generate LayoutAxis z
laxis [z]
vals)
vis :: AxisVisibility
vis = AxisData z -> AxisVisibility
forall x. AxisData x -> AxisVisibility
_axis_visibility AxisData z
adata
axisVisible :: Bool
axisVisible = AxisVisibility -> Bool
_axis_show_labels AxisVisibility
vis Bool -> Bool -> Bool
|| AxisVisibility -> Bool
_axis_show_line AxisVisibility
vis Bool -> Bool -> Bool
|| AxisVisibility -> Bool
_axis_show_ticks AxisVisibility
vis
overrideAxisVisibility :: layout
-> (layout -> LayoutAxis z)
-> (layout -> AxisVisibility)
-> LayoutAxis z
overrideAxisVisibility :: layout
-> (layout -> LayoutAxis z)
-> (layout -> AxisVisibility)
-> LayoutAxis z
overrideAxisVisibility layout
ly layout -> LayoutAxis z
selAxis layout -> AxisVisibility
selVis =
let vis :: AxisVisibility
vis = layout -> AxisVisibility
selVis layout
ly
in (layout -> LayoutAxis z
selAxis layout
ly) { _laxis_override :: AxisData z -> AxisData z
_laxis_override = (\AxisData z
ad -> AxisData z
ad { _axis_visibility :: AxisVisibility
_axis_visibility = AxisVisibility
vis })
(AxisData z -> AxisData z)
-> (AxisData z -> AxisData z) -> AxisData z -> AxisData z
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LayoutAxis z -> AxisData z -> AxisData z
forall x. LayoutAxis x -> AxisData x -> AxisData x
_laxis_override (layout -> LayoutAxis z
selAxis layout
ly)
}
mfill :: Maybe FillStyle -> Renderable a -> Renderable a
mfill :: Maybe FillStyle -> Renderable a -> Renderable a
mfill Maybe FillStyle
Nothing = Renderable a -> Renderable a
forall a. a -> a
id
mfill (Just FillStyle
fs) = FillStyle -> Renderable a -> Renderable a
forall a. FillStyle -> Renderable a -> Renderable a
fillBackground FillStyle
fs
instance (PlotValue x, PlotValue y1, PlotValue y2) => Default (LayoutLR x y1 y2) where
def :: LayoutLR x y1 y2
def = LayoutLR :: forall x y1 y2.
FillStyle
-> Maybe FillStyle
-> String
-> FontStyle
-> LayoutAxis x
-> AxisVisibility
-> AxisVisibility
-> LayoutAxis y1
-> AxisVisibility
-> LayoutAxis y2
-> AxisVisibility
-> [Either (Plot x y1) (Plot x y2)]
-> Maybe LegendStyle
-> Double
-> Bool
-> LayoutLR x y1 y2
LayoutLR
{ _layoutlr_background :: FillStyle
_layoutlr_background = AlphaColour Double -> FillStyle
solidFillStyle (AlphaColour Double -> FillStyle)
-> AlphaColour Double -> FillStyle
forall a b. (a -> b) -> a -> b
$ Colour Double -> AlphaColour Double
forall a. Num a => Colour a -> AlphaColour a
opaque Colour Double
forall a. (Ord a, Floating a) => Colour a
white
, _layoutlr_plot_background :: Maybe FillStyle
_layoutlr_plot_background = Maybe FillStyle
forall a. Maybe a
Nothing
, _layoutlr_title :: String
_layoutlr_title = String
""
, _layoutlr_title_style :: FontStyle
_layoutlr_title_style = FontStyle
forall a. Default a => a
def { _font_size :: Double
_font_size = Double
15
, _font_weight :: FontWeight
_font_weight = FontWeight
FontWeightBold }
, _layoutlr_x_axis :: LayoutAxis x
_layoutlr_x_axis = LayoutAxis x
forall a. Default a => a
def
, _layoutlr_top_axis_visibility :: AxisVisibility
_layoutlr_top_axis_visibility = AxisVisibility
forall a. Default a => a
def { _axis_show_line :: Bool
_axis_show_line = Bool
False
, _axis_show_ticks :: Bool
_axis_show_ticks = Bool
False
, _axis_show_labels :: Bool
_axis_show_labels = Bool
False }
, _layoutlr_bottom_axis_visibility :: AxisVisibility
_layoutlr_bottom_axis_visibility = AxisVisibility
forall a. Default a => a
def
, _layoutlr_left_axis :: LayoutAxis y1
_layoutlr_left_axis = LayoutAxis y1
forall a. Default a => a
def
, _layoutlr_left_axis_visibility :: AxisVisibility
_layoutlr_left_axis_visibility = AxisVisibility
forall a. Default a => a
def
, _layoutlr_right_axis :: LayoutAxis y2
_layoutlr_right_axis = LayoutAxis y2
forall a. Default a => a
def
, _layoutlr_right_axis_visibility :: AxisVisibility
_layoutlr_right_axis_visibility = AxisVisibility
forall a. Default a => a
def
, _layoutlr_plots :: [Either (Plot x y1) (Plot x y2)]
_layoutlr_plots = []
, _layoutlr_legend :: Maybe LegendStyle
_layoutlr_legend = LegendStyle -> Maybe LegendStyle
forall a. a -> Maybe a
Just LegendStyle
forall a. Default a => a
def
, _layoutlr_margin :: Double
_layoutlr_margin = Double
10
, _layoutlr_grid_last :: Bool
_layoutlr_grid_last = Bool
False
}
instance PlotValue t => Default (LayoutAxis t) where
def :: LayoutAxis t
def = LayoutAxis :: forall x.
FontStyle
-> String
-> AxisStyle
-> AxisFn x
-> (AxisData x -> AxisData x)
-> Bool
-> LayoutAxis x
LayoutAxis
{ _laxis_title_style :: FontStyle
_laxis_title_style = FontStyle
forall a. Default a => a
def { _font_size :: Double
_font_size=Double
10 }
, _laxis_title :: String
_laxis_title = String
""
, _laxis_style :: AxisStyle
_laxis_style = AxisStyle
forall a. Default a => a
def
, _laxis_generate :: AxisFn t
_laxis_generate = AxisFn t
forall a. PlotValue a => AxisFn a
autoAxis
, _laxis_override :: AxisData t -> AxisData t
_laxis_override = AxisData t -> AxisData t
forall a. a -> a
id
, _laxis_reverse :: Bool
_laxis_reverse = Bool
False
}
$( makeLenses ''Layout )
$( makeLenses ''LayoutLR )
$( makeLenses ''LayoutAxis )
$( makeLenses ''StackedLayouts )
layout_axes_styles :: Setter' (Layout x y) AxisStyle
layout_axes_styles :: (AxisStyle -> f AxisStyle) -> Layout x y -> f (Layout x y)
layout_axes_styles = ((AxisStyle -> AxisStyle) -> Layout x y -> Layout x y)
-> (AxisStyle -> f AxisStyle) -> Layout x y -> f (Layout x y)
forall (p :: * -> * -> *) (q :: * -> * -> *) (f :: * -> *) a b s t.
(Profunctor p, Profunctor q, Settable f) =>
(p a b -> q s t) -> Optical p q f s t a b
sets (((AxisStyle -> AxisStyle) -> Layout x y -> Layout x y)
-> (AxisStyle -> f AxisStyle) -> Layout x y -> f (Layout x y))
-> ((AxisStyle -> AxisStyle) -> Layout x y -> Layout x y)
-> (AxisStyle -> f AxisStyle)
-> Layout x y
-> f (Layout x y)
forall a b. (a -> b) -> a -> b
$ \AxisStyle -> AxisStyle
af ->
((LayoutAxis x -> Identity (LayoutAxis x))
-> Layout x y -> Identity (Layout x y)
forall x y. Lens' (Layout x y) (LayoutAxis x)
layout_x_axis ((LayoutAxis x -> Identity (LayoutAxis x))
-> Layout x y -> Identity (Layout x y))
-> ((AxisStyle -> Identity AxisStyle)
-> LayoutAxis x -> Identity (LayoutAxis x))
-> (AxisStyle -> Identity AxisStyle)
-> Layout x y
-> Identity (Layout x y)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AxisStyle -> Identity AxisStyle)
-> LayoutAxis x -> Identity (LayoutAxis x)
forall x. Lens' (LayoutAxis x) AxisStyle
laxis_style ((AxisStyle -> Identity AxisStyle)
-> Layout x y -> Identity (Layout x y))
-> (AxisStyle -> AxisStyle) -> Layout x y -> Layout x y
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ AxisStyle -> AxisStyle
af) (Layout x y -> Layout x y)
-> (Layout x y -> Layout x y) -> Layout x y -> Layout x y
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((LayoutAxis y -> Identity (LayoutAxis y))
-> Layout x y -> Identity (Layout x y)
forall x y. Lens' (Layout x y) (LayoutAxis y)
layout_y_axis ((LayoutAxis y -> Identity (LayoutAxis y))
-> Layout x y -> Identity (Layout x y))
-> ((AxisStyle -> Identity AxisStyle)
-> LayoutAxis y -> Identity (LayoutAxis y))
-> (AxisStyle -> Identity AxisStyle)
-> Layout x y
-> Identity (Layout x y)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AxisStyle -> Identity AxisStyle)
-> LayoutAxis y -> Identity (LayoutAxis y)
forall x. Lens' (LayoutAxis x) AxisStyle
laxis_style ((AxisStyle -> Identity AxisStyle)
-> Layout x y -> Identity (Layout x y))
-> (AxisStyle -> AxisStyle) -> Layout x y -> Layout x y
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ AxisStyle -> AxisStyle
af)
layout_axes_title_styles :: Setter' (Layout x y) FontStyle
layout_axes_title_styles :: (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y)
layout_axes_title_styles = ((FontStyle -> FontStyle) -> Layout x y -> Layout x y)
-> (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y)
forall (p :: * -> * -> *) (q :: * -> * -> *) (f :: * -> *) a b s t.
(Profunctor p, Profunctor q, Settable f) =>
(p a b -> q s t) -> Optical p q f s t a b
sets (((FontStyle -> FontStyle) -> Layout x y -> Layout x y)
-> (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y))
-> ((FontStyle -> FontStyle) -> Layout x y -> Layout x y)
-> (FontStyle -> f FontStyle)
-> Layout x y
-> f (Layout x y)
forall a b. (a -> b) -> a -> b
$ \FontStyle -> FontStyle
af ->
((LayoutAxis x -> Identity (LayoutAxis x))
-> Layout x y -> Identity (Layout x y)
forall x y. Lens' (Layout x y) (LayoutAxis x)
layout_x_axis ((LayoutAxis x -> Identity (LayoutAxis x))
-> Layout x y -> Identity (Layout x y))
-> ((FontStyle -> Identity FontStyle)
-> LayoutAxis x -> Identity (LayoutAxis x))
-> (FontStyle -> Identity FontStyle)
-> Layout x y
-> Identity (Layout x y)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> LayoutAxis x -> Identity (LayoutAxis x)
forall x. Lens' (LayoutAxis x) FontStyle
laxis_title_style ((FontStyle -> Identity FontStyle)
-> Layout x y -> Identity (Layout x y))
-> (FontStyle -> FontStyle) -> Layout x y -> Layout x y
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (Layout x y -> Layout x y)
-> (Layout x y -> Layout x y) -> Layout x y -> Layout x y
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((LayoutAxis y -> Identity (LayoutAxis y))
-> Layout x y -> Identity (Layout x y)
forall x y. Lens' (Layout x y) (LayoutAxis y)
layout_y_axis ((LayoutAxis y -> Identity (LayoutAxis y))
-> Layout x y -> Identity (Layout x y))
-> ((FontStyle -> Identity FontStyle)
-> LayoutAxis y -> Identity (LayoutAxis y))
-> (FontStyle -> Identity FontStyle)
-> Layout x y
-> Identity (Layout x y)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> LayoutAxis y -> Identity (LayoutAxis y)
forall x. Lens' (LayoutAxis x) FontStyle
laxis_title_style ((FontStyle -> Identity FontStyle)
-> Layout x y -> Identity (Layout x y))
-> (FontStyle -> FontStyle) -> Layout x y -> Layout x y
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af)
layout_all_font_styles :: Setter' (Layout x y) FontStyle
layout_all_font_styles :: (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y)
layout_all_font_styles = ((FontStyle -> FontStyle) -> Layout x y -> Layout x y)
-> (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y)
forall (p :: * -> * -> *) (q :: * -> * -> *) (f :: * -> *) a b s t.
(Profunctor p, Profunctor q, Settable f) =>
(p a b -> q s t) -> Optical p q f s t a b
sets (((FontStyle -> FontStyle) -> Layout x y -> Layout x y)
-> (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y))
-> ((FontStyle -> FontStyle) -> Layout x y -> Layout x y)
-> (FontStyle -> f FontStyle)
-> Layout x y
-> f (Layout x y)
forall a b. (a -> b) -> a -> b
$ \FontStyle -> FontStyle
af ->
((FontStyle -> Identity FontStyle)
-> Layout x y -> Identity (Layout x y)
forall x y. Setter' (Layout x y) FontStyle
layout_axes_title_styles ((FontStyle -> Identity FontStyle)
-> Layout x y -> Identity (Layout x y))
-> (FontStyle -> FontStyle) -> Layout x y -> Layout x y
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (Layout x y -> Layout x y)
-> (Layout x y -> Layout x y) -> Layout x y -> Layout x y
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((LayoutAxis x -> Identity (LayoutAxis x))
-> Layout x y -> Identity (Layout x y)
forall x y. Lens' (Layout x y) (LayoutAxis x)
layout_x_axis ((LayoutAxis x -> Identity (LayoutAxis x))
-> Layout x y -> Identity (Layout x y))
-> ((FontStyle -> Identity FontStyle)
-> LayoutAxis x -> Identity (LayoutAxis x))
-> (FontStyle -> Identity FontStyle)
-> Layout x y
-> Identity (Layout x y)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AxisStyle -> Identity AxisStyle)
-> LayoutAxis x -> Identity (LayoutAxis x)
forall x. Lens' (LayoutAxis x) AxisStyle
laxis_style ((AxisStyle -> Identity AxisStyle)
-> LayoutAxis x -> Identity (LayoutAxis x))
-> ((FontStyle -> Identity FontStyle)
-> AxisStyle -> Identity AxisStyle)
-> (FontStyle -> Identity FontStyle)
-> LayoutAxis x
-> Identity (LayoutAxis x)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> AxisStyle -> Identity AxisStyle
Lens' AxisStyle FontStyle
axis_label_style ((FontStyle -> Identity FontStyle)
-> Layout x y -> Identity (Layout x y))
-> (FontStyle -> FontStyle) -> Layout x y -> Layout x y
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (Layout x y -> Layout x y)
-> (Layout x y -> Layout x y) -> Layout x y -> Layout x y
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((LayoutAxis y -> Identity (LayoutAxis y))
-> Layout x y -> Identity (Layout x y)
forall x y. Lens' (Layout x y) (LayoutAxis y)
layout_y_axis ((LayoutAxis y -> Identity (LayoutAxis y))
-> Layout x y -> Identity (Layout x y))
-> ((FontStyle -> Identity FontStyle)
-> LayoutAxis y -> Identity (LayoutAxis y))
-> (FontStyle -> Identity FontStyle)
-> Layout x y
-> Identity (Layout x y)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AxisStyle -> Identity AxisStyle)
-> LayoutAxis y -> Identity (LayoutAxis y)
forall x. Lens' (LayoutAxis x) AxisStyle
laxis_style ((AxisStyle -> Identity AxisStyle)
-> LayoutAxis y -> Identity (LayoutAxis y))
-> ((FontStyle -> Identity FontStyle)
-> AxisStyle -> Identity AxisStyle)
-> (FontStyle -> Identity FontStyle)
-> LayoutAxis y
-> Identity (LayoutAxis y)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> AxisStyle -> Identity AxisStyle
Lens' AxisStyle FontStyle
axis_label_style ((FontStyle -> Identity FontStyle)
-> Layout x y -> Identity (Layout x y))
-> (FontStyle -> FontStyle) -> Layout x y -> Layout x y
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (Layout x y -> Layout x y)
-> (Layout x y -> Layout x y) -> Layout x y -> Layout x y
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((Maybe LegendStyle -> Identity (Maybe LegendStyle))
-> Layout x y -> Identity (Layout x y)
forall x y. Lens' (Layout x y) (Maybe LegendStyle)
layout_legend ((Maybe LegendStyle -> Identity (Maybe LegendStyle))
-> Layout x y -> Identity (Layout x y))
-> ((FontStyle -> Identity FontStyle)
-> Maybe LegendStyle -> Identity (Maybe LegendStyle))
-> (FontStyle -> Identity FontStyle)
-> Layout x y
-> Identity (Layout x y)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LegendStyle -> Identity LegendStyle)
-> Maybe LegendStyle -> Identity (Maybe LegendStyle)
forall a b. Prism (Maybe a) (Maybe b) a b
_Just ((LegendStyle -> Identity LegendStyle)
-> Maybe LegendStyle -> Identity (Maybe LegendStyle))
-> ((FontStyle -> Identity FontStyle)
-> LegendStyle -> Identity LegendStyle)
-> (FontStyle -> Identity FontStyle)
-> Maybe LegendStyle
-> Identity (Maybe LegendStyle)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> LegendStyle -> Identity LegendStyle
Lens' LegendStyle FontStyle
legend_label_style ((FontStyle -> Identity FontStyle)
-> Layout x y -> Identity (Layout x y))
-> (FontStyle -> FontStyle) -> Layout x y -> Layout x y
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (Layout x y -> Layout x y)
-> (Layout x y -> Layout x y) -> Layout x y -> Layout x y
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((FontStyle -> Identity FontStyle)
-> Layout x y -> Identity (Layout x y)
forall x y. Lens' (Layout x y) FontStyle
layout_title_style ((FontStyle -> Identity FontStyle)
-> Layout x y -> Identity (Layout x y))
-> (FontStyle -> FontStyle) -> Layout x y -> Layout x y
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af)
layout_foreground :: Setter' (Layout x y) (AlphaColour Double)
layout_foreground :: (AlphaColour Double -> f (AlphaColour Double))
-> Layout x y -> f (Layout x y)
layout_foreground = ((AlphaColour Double -> AlphaColour Double)
-> Layout x y -> Layout x y)
-> (AlphaColour Double -> f (AlphaColour Double))
-> Layout x y
-> f (Layout x y)
forall (p :: * -> * -> *) (q :: * -> * -> *) (f :: * -> *) a b s t.
(Profunctor p, Profunctor q, Settable f) =>
(p a b -> q s t) -> Optical p q f s t a b
sets (((AlphaColour Double -> AlphaColour Double)
-> Layout x y -> Layout x y)
-> (AlphaColour Double -> f (AlphaColour Double))
-> Layout x y
-> f (Layout x y))
-> ((AlphaColour Double -> AlphaColour Double)
-> Layout x y -> Layout x y)
-> (AlphaColour Double -> f (AlphaColour Double))
-> Layout x y
-> f (Layout x y)
forall a b. (a -> b) -> a -> b
$ \AlphaColour Double -> AlphaColour Double
af ->
((FontStyle -> Identity FontStyle)
-> Layout x y -> Identity (Layout x y)
forall x y. Setter' (Layout x y) FontStyle
layout_all_font_styles ((FontStyle -> Identity FontStyle)
-> Layout x y -> Identity (Layout x y))
-> ((AlphaColour Double -> Identity (AlphaColour Double))
-> FontStyle -> Identity FontStyle)
-> (AlphaColour Double -> Identity (AlphaColour Double))
-> Layout x y
-> Identity (Layout x y)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AlphaColour Double -> Identity (AlphaColour Double))
-> FontStyle -> Identity FontStyle
Lens' FontStyle (AlphaColour Double)
font_color ((AlphaColour Double -> Identity (AlphaColour Double))
-> Layout x y -> Identity (Layout x y))
-> (AlphaColour Double -> AlphaColour Double)
-> Layout x y
-> Layout x y
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ AlphaColour Double -> AlphaColour Double
af) (Layout x y -> Layout x y)
-> (Layout x y -> Layout x y) -> Layout x y -> Layout x y
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((AxisStyle -> Identity AxisStyle)
-> Layout x y -> Identity (Layout x y)
forall x y. Setter' (Layout x y) AxisStyle
layout_axes_styles ((AxisStyle -> Identity AxisStyle)
-> Layout x y -> Identity (Layout x y))
-> ((AlphaColour Double -> Identity (AlphaColour Double))
-> AxisStyle -> Identity AxisStyle)
-> (AlphaColour Double -> Identity (AlphaColour Double))
-> Layout x y
-> Identity (Layout x y)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LineStyle -> Identity LineStyle)
-> AxisStyle -> Identity AxisStyle
Lens' AxisStyle LineStyle
axis_line_style ((LineStyle -> Identity LineStyle)
-> AxisStyle -> Identity AxisStyle)
-> ((AlphaColour Double -> Identity (AlphaColour Double))
-> LineStyle -> Identity LineStyle)
-> (AlphaColour Double -> Identity (AlphaColour Double))
-> AxisStyle
-> Identity AxisStyle
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AlphaColour Double -> Identity (AlphaColour Double))
-> LineStyle -> Identity LineStyle
Lens' LineStyle (AlphaColour Double)
line_color ((AlphaColour Double -> Identity (AlphaColour Double))
-> Layout x y -> Identity (Layout x y))
-> (AlphaColour Double -> AlphaColour Double)
-> Layout x y
-> Layout x y
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ AlphaColour Double -> AlphaColour Double
af)
layoutlr_axes_styles :: Setter' (LayoutLR x y1 y2) AxisStyle
layoutlr_axes_styles :: (AxisStyle -> f AxisStyle)
-> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
layoutlr_axes_styles = ((AxisStyle -> AxisStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (AxisStyle -> f AxisStyle)
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2)
forall (p :: * -> * -> *) (q :: * -> * -> *) (f :: * -> *) a b s t.
(Profunctor p, Profunctor q, Settable f) =>
(p a b -> q s t) -> Optical p q f s t a b
sets (((AxisStyle -> AxisStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (AxisStyle -> f AxisStyle)
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2))
-> ((AxisStyle -> AxisStyle)
-> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (AxisStyle -> f AxisStyle)
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2)
forall a b. (a -> b) -> a -> b
$ \AxisStyle -> AxisStyle
af ->
((LayoutAxis x -> Identity (LayoutAxis x))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Lens' (LayoutLR x y1 y2) (LayoutAxis x)
layoutlr_x_axis ((LayoutAxis x -> Identity (LayoutAxis x))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((AxisStyle -> Identity AxisStyle)
-> LayoutAxis x -> Identity (LayoutAxis x))
-> (AxisStyle -> Identity AxisStyle)
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AxisStyle -> Identity AxisStyle)
-> LayoutAxis x -> Identity (LayoutAxis x)
forall x. Lens' (LayoutAxis x) AxisStyle
laxis_style ((AxisStyle -> Identity AxisStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (AxisStyle -> AxisStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ AxisStyle -> AxisStyle
af) (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((LayoutAxis y1 -> Identity (LayoutAxis y1))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Lens' (LayoutLR x y1 y2) (LayoutAxis y1)
layoutlr_left_axis ((LayoutAxis y1 -> Identity (LayoutAxis y1))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((AxisStyle -> Identity AxisStyle)
-> LayoutAxis y1 -> Identity (LayoutAxis y1))
-> (AxisStyle -> Identity AxisStyle)
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AxisStyle -> Identity AxisStyle)
-> LayoutAxis y1 -> Identity (LayoutAxis y1)
forall x. Lens' (LayoutAxis x) AxisStyle
laxis_style ((AxisStyle -> Identity AxisStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (AxisStyle -> AxisStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ AxisStyle -> AxisStyle
af) (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((LayoutAxis y2 -> Identity (LayoutAxis y2))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Lens' (LayoutLR x y1 y2) (LayoutAxis y2)
layoutlr_right_axis ((LayoutAxis y2 -> Identity (LayoutAxis y2))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((AxisStyle -> Identity AxisStyle)
-> LayoutAxis y2 -> Identity (LayoutAxis y2))
-> (AxisStyle -> Identity AxisStyle)
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AxisStyle -> Identity AxisStyle)
-> LayoutAxis y2 -> Identity (LayoutAxis y2)
forall x. Lens' (LayoutAxis x) AxisStyle
laxis_style ((AxisStyle -> Identity AxisStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (AxisStyle -> AxisStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ AxisStyle -> AxisStyle
af)
layoutlr_axes_title_styles :: Setter' (LayoutLR x y1 y2) FontStyle
layoutlr_axes_title_styles :: (FontStyle -> f FontStyle)
-> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
layoutlr_axes_title_styles = ((FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (FontStyle -> f FontStyle)
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2)
forall (p :: * -> * -> *) (q :: * -> * -> *) (f :: * -> *) a b s t.
(Profunctor p, Profunctor q, Settable f) =>
(p a b -> q s t) -> Optical p q f s t a b
sets (((FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (FontStyle -> f FontStyle)
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2))
-> ((FontStyle -> FontStyle)
-> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (FontStyle -> f FontStyle)
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2)
forall a b. (a -> b) -> a -> b
$ \FontStyle -> FontStyle
af ->
((LayoutAxis x -> Identity (LayoutAxis x))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Lens' (LayoutLR x y1 y2) (LayoutAxis x)
layoutlr_x_axis ((LayoutAxis x -> Identity (LayoutAxis x))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((FontStyle -> Identity FontStyle)
-> LayoutAxis x -> Identity (LayoutAxis x))
-> (FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> LayoutAxis x -> Identity (LayoutAxis x)
forall x. Lens' (LayoutAxis x) FontStyle
laxis_title_style ((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((LayoutAxis y1 -> Identity (LayoutAxis y1))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Lens' (LayoutLR x y1 y2) (LayoutAxis y1)
layoutlr_left_axis ((LayoutAxis y1 -> Identity (LayoutAxis y1))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((FontStyle -> Identity FontStyle)
-> LayoutAxis y1 -> Identity (LayoutAxis y1))
-> (FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> LayoutAxis y1 -> Identity (LayoutAxis y1)
forall x. Lens' (LayoutAxis x) FontStyle
laxis_title_style ((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((LayoutAxis y2 -> Identity (LayoutAxis y2))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Lens' (LayoutLR x y1 y2) (LayoutAxis y2)
layoutlr_right_axis ((LayoutAxis y2 -> Identity (LayoutAxis y2))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((FontStyle -> Identity FontStyle)
-> LayoutAxis y2 -> Identity (LayoutAxis y2))
-> (FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> LayoutAxis y2 -> Identity (LayoutAxis y2)
forall x. Lens' (LayoutAxis x) FontStyle
laxis_title_style ((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af)
layoutlr_all_font_styles :: Setter' (LayoutLR x y1 y2) FontStyle
layoutlr_all_font_styles :: (FontStyle -> f FontStyle)
-> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
layoutlr_all_font_styles = ((FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (FontStyle -> f FontStyle)
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2)
forall (p :: * -> * -> *) (q :: * -> * -> *) (f :: * -> *) a b s t.
(Profunctor p, Profunctor q, Settable f) =>
(p a b -> q s t) -> Optical p q f s t a b
sets (((FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (FontStyle -> f FontStyle)
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2))
-> ((FontStyle -> FontStyle)
-> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (FontStyle -> f FontStyle)
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2)
forall a b. (a -> b) -> a -> b
$ \FontStyle -> FontStyle
af ->
((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Setter' (LayoutLR x y1 y2) FontStyle
layoutlr_axes_title_styles ((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((LayoutAxis x -> Identity (LayoutAxis x))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Lens' (LayoutLR x y1 y2) (LayoutAxis x)
layoutlr_x_axis ((LayoutAxis x -> Identity (LayoutAxis x))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((FontStyle -> Identity FontStyle)
-> LayoutAxis x -> Identity (LayoutAxis x))
-> (FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AxisStyle -> Identity AxisStyle)
-> LayoutAxis x -> Identity (LayoutAxis x)
forall x. Lens' (LayoutAxis x) AxisStyle
laxis_style ((AxisStyle -> Identity AxisStyle)
-> LayoutAxis x -> Identity (LayoutAxis x))
-> ((FontStyle -> Identity FontStyle)
-> AxisStyle -> Identity AxisStyle)
-> (FontStyle -> Identity FontStyle)
-> LayoutAxis x
-> Identity (LayoutAxis x)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> AxisStyle -> Identity AxisStyle
Lens' AxisStyle FontStyle
axis_label_style ((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((LayoutAxis y1 -> Identity (LayoutAxis y1))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Lens' (LayoutLR x y1 y2) (LayoutAxis y1)
layoutlr_left_axis ((LayoutAxis y1 -> Identity (LayoutAxis y1))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((FontStyle -> Identity FontStyle)
-> LayoutAxis y1 -> Identity (LayoutAxis y1))
-> (FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AxisStyle -> Identity AxisStyle)
-> LayoutAxis y1 -> Identity (LayoutAxis y1)
forall x. Lens' (LayoutAxis x) AxisStyle
laxis_style ((AxisStyle -> Identity AxisStyle)
-> LayoutAxis y1 -> Identity (LayoutAxis y1))
-> ((FontStyle -> Identity FontStyle)
-> AxisStyle -> Identity AxisStyle)
-> (FontStyle -> Identity FontStyle)
-> LayoutAxis y1
-> Identity (LayoutAxis y1)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> AxisStyle -> Identity AxisStyle
Lens' AxisStyle FontStyle
axis_label_style ((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((LayoutAxis y2 -> Identity (LayoutAxis y2))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Lens' (LayoutLR x y1 y2) (LayoutAxis y2)
layoutlr_right_axis ((LayoutAxis y2 -> Identity (LayoutAxis y2))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((FontStyle -> Identity FontStyle)
-> LayoutAxis y2 -> Identity (LayoutAxis y2))
-> (FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AxisStyle -> Identity AxisStyle)
-> LayoutAxis y2 -> Identity (LayoutAxis y2)
forall x. Lens' (LayoutAxis x) AxisStyle
laxis_style ((AxisStyle -> Identity AxisStyle)
-> LayoutAxis y2 -> Identity (LayoutAxis y2))
-> ((FontStyle -> Identity FontStyle)
-> AxisStyle -> Identity AxisStyle)
-> (FontStyle -> Identity FontStyle)
-> LayoutAxis y2
-> Identity (LayoutAxis y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> AxisStyle -> Identity AxisStyle
Lens' AxisStyle FontStyle
axis_label_style ((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((Maybe LegendStyle -> Identity (Maybe LegendStyle))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Lens' (LayoutLR x y1 y2) (Maybe LegendStyle)
layoutlr_legend ((Maybe LegendStyle -> Identity (Maybe LegendStyle))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((FontStyle -> Identity FontStyle)
-> Maybe LegendStyle -> Identity (Maybe LegendStyle))
-> (FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LegendStyle -> Identity LegendStyle)
-> Maybe LegendStyle -> Identity (Maybe LegendStyle)
forall a b. Prism (Maybe a) (Maybe b) a b
_Just ((LegendStyle -> Identity LegendStyle)
-> Maybe LegendStyle -> Identity (Maybe LegendStyle))
-> ((FontStyle -> Identity FontStyle)
-> LegendStyle -> Identity LegendStyle)
-> (FontStyle -> Identity FontStyle)
-> Maybe LegendStyle
-> Identity (Maybe LegendStyle)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FontStyle -> Identity FontStyle)
-> LegendStyle -> Identity LegendStyle
Lens' LegendStyle FontStyle
legend_label_style ((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af) (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Lens' (LayoutLR x y1 y2) FontStyle
layoutlr_title_style ((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (FontStyle -> FontStyle) -> LayoutLR x y1 y2 -> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ FontStyle -> FontStyle
af)
layoutlr_foreground :: Setter' (LayoutLR x y1 y2) (AlphaColour Double)
layoutlr_foreground :: (AlphaColour Double -> f (AlphaColour Double))
-> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
layoutlr_foreground = ((AlphaColour Double -> AlphaColour Double)
-> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (AlphaColour Double -> f (AlphaColour Double))
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2)
forall (p :: * -> * -> *) (q :: * -> * -> *) (f :: * -> *) a b s t.
(Profunctor p, Profunctor q, Settable f) =>
(p a b -> q s t) -> Optical p q f s t a b
sets (((AlphaColour Double -> AlphaColour Double)
-> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (AlphaColour Double -> f (AlphaColour Double))
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2))
-> ((AlphaColour Double -> AlphaColour Double)
-> LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (AlphaColour Double -> f (AlphaColour Double))
-> LayoutLR x y1 y2
-> f (LayoutLR x y1 y2)
forall a b. (a -> b) -> a -> b
$ \AlphaColour Double -> AlphaColour Double
af ->
((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Setter' (LayoutLR x y1 y2) FontStyle
layoutlr_all_font_styles ((FontStyle -> Identity FontStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((AlphaColour Double -> Identity (AlphaColour Double))
-> FontStyle -> Identity FontStyle)
-> (AlphaColour Double -> Identity (AlphaColour Double))
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AlphaColour Double -> Identity (AlphaColour Double))
-> FontStyle -> Identity FontStyle
Lens' FontStyle (AlphaColour Double)
font_color ((AlphaColour Double -> Identity (AlphaColour Double))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (AlphaColour Double -> AlphaColour Double)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ AlphaColour Double -> AlphaColour Double
af) (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> (LayoutLR x y1 y2 -> LayoutLR x y1 y2)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((AxisStyle -> Identity AxisStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2)
forall x y1 y2. Setter' (LayoutLR x y1 y2) AxisStyle
layoutlr_axes_styles ((AxisStyle -> Identity AxisStyle)
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> ((AlphaColour Double -> Identity (AlphaColour Double))
-> AxisStyle -> Identity AxisStyle)
-> (AlphaColour Double -> Identity (AlphaColour Double))
-> LayoutLR x y1 y2
-> Identity (LayoutLR x y1 y2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LineStyle -> Identity LineStyle)
-> AxisStyle -> Identity AxisStyle
Lens' AxisStyle LineStyle
axis_line_style ((LineStyle -> Identity LineStyle)
-> AxisStyle -> Identity AxisStyle)
-> ((AlphaColour Double -> Identity (AlphaColour Double))
-> LineStyle -> Identity LineStyle)
-> (AlphaColour Double -> Identity (AlphaColour Double))
-> AxisStyle
-> Identity AxisStyle
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AlphaColour Double -> Identity (AlphaColour Double))
-> LineStyle -> Identity LineStyle
Lens' LineStyle (AlphaColour Double)
line_color ((AlphaColour Double -> Identity (AlphaColour Double))
-> LayoutLR x y1 y2 -> Identity (LayoutLR x y1 y2))
-> (AlphaColour Double -> AlphaColour Double)
-> LayoutLR x y1 y2
-> LayoutLR x y1 y2
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ AlphaColour Double -> AlphaColour Double
af)