{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE RebindableSyntax #-}
{-# OPTIONS_GHC -Wall #-}
module Chart.Surface
( SurfaceData (..),
SurfaceOptions (..),
defaultSurfaceOptions,
SurfaceStyle (..),
defaultSurfaceStyle,
mkSurfaceData,
surfaces,
surfacef,
surfacefl,
SurfaceLegendOptions (..),
defaultSurfaceLegendOptions,
)
where
import Chart.Types
import Control.Lens
import Data.Bifunctor
import Data.Colour
import Data.FormatN
import Data.Generics.Labels ()
import Data.Text (Text)
import GHC.Generics
import GHC.OverloadedLabels
import NumHask.Prelude
import NumHask.Space
data SurfaceOptions = SurfaceOptions
{
SurfaceOptions -> SurfaceStyle
soStyle :: SurfaceStyle,
SurfaceOptions -> Point Int
soGrain :: Point Int,
SurfaceOptions -> Rect Double
soRange :: Rect Double
}
deriving (Int -> SurfaceOptions -> ShowS
[SurfaceOptions] -> ShowS
SurfaceOptions -> String
(Int -> SurfaceOptions -> ShowS)
-> (SurfaceOptions -> String)
-> ([SurfaceOptions] -> ShowS)
-> Show SurfaceOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SurfaceOptions] -> ShowS
$cshowList :: [SurfaceOptions] -> ShowS
show :: SurfaceOptions -> String
$cshow :: SurfaceOptions -> String
showsPrec :: Int -> SurfaceOptions -> ShowS
$cshowsPrec :: Int -> SurfaceOptions -> ShowS
Show, SurfaceOptions -> SurfaceOptions -> Bool
(SurfaceOptions -> SurfaceOptions -> Bool)
-> (SurfaceOptions -> SurfaceOptions -> Bool) -> Eq SurfaceOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SurfaceOptions -> SurfaceOptions -> Bool
$c/= :: SurfaceOptions -> SurfaceOptions -> Bool
== :: SurfaceOptions -> SurfaceOptions -> Bool
$c== :: SurfaceOptions -> SurfaceOptions -> Bool
Eq, (forall x. SurfaceOptions -> Rep SurfaceOptions x)
-> (forall x. Rep SurfaceOptions x -> SurfaceOptions)
-> Generic SurfaceOptions
forall x. Rep SurfaceOptions x -> SurfaceOptions
forall x. SurfaceOptions -> Rep SurfaceOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SurfaceOptions x -> SurfaceOptions
$cfrom :: forall x. SurfaceOptions -> Rep SurfaceOptions x
Generic)
defaultSurfaceOptions :: SurfaceOptions
defaultSurfaceOptions :: SurfaceOptions
defaultSurfaceOptions =
SurfaceStyle -> Point Int -> Rect Double -> SurfaceOptions
SurfaceOptions SurfaceStyle
defaultSurfaceStyle (Int -> Int -> Point Int
forall a. a -> a -> Point a
Point Int
10 Int
10) Rect Double
forall a. Multiplicative a => a
one
data SurfaceStyle = SurfaceStyle
{
SurfaceStyle -> [Colour]
surfaceColors :: [Colour],
SurfaceStyle -> RectStyle
surfaceRectStyle :: RectStyle
}
deriving (Int -> SurfaceStyle -> ShowS
[SurfaceStyle] -> ShowS
SurfaceStyle -> String
(Int -> SurfaceStyle -> ShowS)
-> (SurfaceStyle -> String)
-> ([SurfaceStyle] -> ShowS)
-> Show SurfaceStyle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SurfaceStyle] -> ShowS
$cshowList :: [SurfaceStyle] -> ShowS
show :: SurfaceStyle -> String
$cshow :: SurfaceStyle -> String
showsPrec :: Int -> SurfaceStyle -> ShowS
$cshowsPrec :: Int -> SurfaceStyle -> ShowS
Show, SurfaceStyle -> SurfaceStyle -> Bool
(SurfaceStyle -> SurfaceStyle -> Bool)
-> (SurfaceStyle -> SurfaceStyle -> Bool) -> Eq SurfaceStyle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SurfaceStyle -> SurfaceStyle -> Bool
$c/= :: SurfaceStyle -> SurfaceStyle -> Bool
== :: SurfaceStyle -> SurfaceStyle -> Bool
$c== :: SurfaceStyle -> SurfaceStyle -> Bool
Eq, (forall x. SurfaceStyle -> Rep SurfaceStyle x)
-> (forall x. Rep SurfaceStyle x -> SurfaceStyle)
-> Generic SurfaceStyle
forall x. Rep SurfaceStyle x -> SurfaceStyle
forall x. SurfaceStyle -> Rep SurfaceStyle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SurfaceStyle x -> SurfaceStyle
$cfrom :: forall x. SurfaceStyle -> Rep SurfaceStyle x
Generic)
defaultSurfaceStyle :: SurfaceStyle
defaultSurfaceStyle :: SurfaceStyle
defaultSurfaceStyle =
[Colour] -> RectStyle -> SurfaceStyle
SurfaceStyle (Int -> [Colour] -> [Colour]
forall a. Int -> [a] -> [a]
take Int
2 [Colour]
palette1_) (Colour -> RectStyle
blob Colour
dark)
data SurfaceData = SurfaceData
{
SurfaceData -> Rect Double
surfaceRect :: Rect Double,
SurfaceData -> Colour
surfaceColor :: Colour
}
deriving (Int -> SurfaceData -> ShowS
[SurfaceData] -> ShowS
SurfaceData -> String
(Int -> SurfaceData -> ShowS)
-> (SurfaceData -> String)
-> ([SurfaceData] -> ShowS)
-> Show SurfaceData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SurfaceData] -> ShowS
$cshowList :: [SurfaceData] -> ShowS
show :: SurfaceData -> String
$cshow :: SurfaceData -> String
showsPrec :: Int -> SurfaceData -> ShowS
$cshowsPrec :: Int -> SurfaceData -> ShowS
Show, SurfaceData -> SurfaceData -> Bool
(SurfaceData -> SurfaceData -> Bool)
-> (SurfaceData -> SurfaceData -> Bool) -> Eq SurfaceData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SurfaceData -> SurfaceData -> Bool
$c/= :: SurfaceData -> SurfaceData -> Bool
== :: SurfaceData -> SurfaceData -> Bool
$c== :: SurfaceData -> SurfaceData -> Bool
Eq, (forall x. SurfaceData -> Rep SurfaceData x)
-> (forall x. Rep SurfaceData x -> SurfaceData)
-> Generic SurfaceData
forall x. Rep SurfaceData x -> SurfaceData
forall x. SurfaceData -> Rep SurfaceData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SurfaceData x -> SurfaceData
$cfrom :: forall x. SurfaceData -> Rep SurfaceData x
Generic)
surfaces :: RectStyle -> [SurfaceData] -> [Chart Double]
surfaces :: RectStyle -> [SurfaceData] -> [Chart Double]
surfaces RectStyle
rs [SurfaceData]
ps =
( \(SurfaceData Rect Double
r Colour
c) ->
Annotation -> [XY Double] -> Chart Double
forall a. Annotation -> [XY a] -> Chart a
Chart
(RectStyle -> Annotation
RectA (RectStyle
rs RectStyle -> (RectStyle -> RectStyle) -> RectStyle
forall a b. a -> (a -> b) -> b
& (Colour -> Identity Colour) -> RectStyle -> Identity RectStyle
forall a. IsLabel "color" a => a
forall (x :: Symbol) a. IsLabel x a => a
#color ((Colour -> Identity Colour) -> RectStyle -> Identity RectStyle)
-> Colour -> RectStyle -> RectStyle
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Colour
c))
[Rect Double -> XY Double
forall a. Rect a -> XY a
RectXY Rect Double
r]
)
(SurfaceData -> Chart Double) -> [SurfaceData] -> [Chart Double]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [SurfaceData]
ps
mkSurfaceData ::
(Point Double -> Double) ->
Rect Double ->
Grid (Rect Double) ->
[Colour] ->
([SurfaceData], Range Double)
mkSurfaceData :: (Point Double -> Double)
-> Rect Double
-> Grid (Rect Double)
-> [Colour]
-> ([SurfaceData], Range Double)
mkSurfaceData Point Double -> Double
f Rect Double
r Grid (Rect Double)
g [Colour]
cs = ((\(Rect Double
x, Double
y) -> Rect Double -> Colour -> SurfaceData
SurfaceData Rect Double
x (Double -> [Colour] -> Colour
blends Double
y [Colour]
cs)) ((Rect Double, Double) -> SurfaceData)
-> [(Rect Double, Double)] -> [SurfaceData]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(Rect Double, Double)]
ps', [Element (Range Double)] -> Range Double
forall s (f :: * -> *).
(Space s, Traversable f) =>
f (Element s) -> s
space1 [Double]
[Element (Range Double)]
rs)
where
ps :: [(Rect Double, Double)]
ps = (Point Double -> Double)
-> Rect Double -> Grid (Rect Double) -> [(Rect Double, Double)]
forall b.
(Point Double -> b)
-> Rect Double -> Grid (Rect Double) -> [(Rect Double, b)]
gridF Point Double -> Double
f Rect Double
r Grid (Rect Double)
g
rs :: [Double]
rs = (Rect Double, Double) -> Double
forall a b. (a, b) -> b
snd ((Rect Double, Double) -> Double)
-> [(Rect Double, Double)] -> [Double]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(Rect Double, Double)]
ps
rs' :: [Double]
rs' = Range Double
-> Range Double -> Element (Range Double) -> Element (Range Double)
forall s.
(Space s, Field (Element s)) =>
s -> s -> Element s -> Element s
project ([Element (Range Double)] -> Range Double
forall s (f :: * -> *).
(Space s, Traversable f) =>
f (Element s) -> s
space1 [Double]
[Element (Range Double)]
rs :: Range Double) (Double -> Double -> Range Double
forall a. a -> a -> Range a
Range Double
0 Double
1) (Double -> Double) -> [Double] -> [Double]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Double]
rs
ps' :: [(Rect Double, Double)]
ps' = [Rect Double] -> [Double] -> [(Rect Double, Double)]
forall a b. [a] -> [b] -> [(a, b)]
zip ((Rect Double, Double) -> Rect Double
forall a b. (a, b) -> a
fst ((Rect Double, Double) -> Rect Double)
-> [(Rect Double, Double)] -> [Rect Double]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(Rect Double, Double)]
ps) [Double]
rs'
surfacef :: (Point Double -> Double) -> SurfaceOptions -> ([Chart Double], Range Double)
surfacef :: (Point Double -> Double)
-> SurfaceOptions -> ([Chart Double], Range Double)
surfacef Point Double -> Double
f SurfaceOptions
cfg =
([SurfaceData] -> [Chart Double])
-> ([SurfaceData], Range Double) -> ([Chart Double], Range Double)
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first (RectStyle -> [SurfaceData] -> [Chart Double]
surfaces (SurfaceOptions
cfg SurfaceOptions
-> Getting RectStyle SurfaceOptions RectStyle -> RectStyle
forall s a. s -> Getting a s a -> a
^. (SurfaceStyle -> Const RectStyle SurfaceStyle)
-> SurfaceOptions -> Const RectStyle SurfaceOptions
forall a. IsLabel "soStyle" a => a
forall (x :: Symbol) a. IsLabel x a => a
#soStyle ((SurfaceStyle -> Const RectStyle SurfaceStyle)
-> SurfaceOptions -> Const RectStyle SurfaceOptions)
-> ((RectStyle -> Const RectStyle RectStyle)
-> SurfaceStyle -> Const RectStyle SurfaceStyle)
-> Getting RectStyle SurfaceOptions RectStyle
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RectStyle -> Const RectStyle RectStyle)
-> SurfaceStyle -> Const RectStyle SurfaceStyle
forall a. IsLabel "surfaceRectStyle" a => a
forall (x :: Symbol) a. IsLabel x a => a
#surfaceRectStyle)) (([SurfaceData], Range Double) -> ([Chart Double], Range Double))
-> ([SurfaceData], Range Double) -> ([Chart Double], Range Double)
forall a b. (a -> b) -> a -> b
$
(Point Double -> Double)
-> Rect Double
-> Grid (Rect Double)
-> [Colour]
-> ([SurfaceData], Range Double)
mkSurfaceData
Point Double -> Double
f
(SurfaceOptions
cfg SurfaceOptions
-> Getting (Rect Double) SurfaceOptions (Rect Double)
-> Rect Double
forall s a. s -> Getting a s a -> a
^. Getting (Rect Double) SurfaceOptions (Rect Double)
forall a. IsLabel "soRange" a => a
forall (x :: Symbol) a. IsLabel x a => a
#soRange)
(SurfaceOptions
cfg SurfaceOptions
-> Getting (Point Int) SurfaceOptions (Point Int) -> Point Int
forall s a. s -> Getting a s a -> a
^. Getting (Point Int) SurfaceOptions (Point Int)
forall a. IsLabel "soGrain" a => a
forall (x :: Symbol) a. IsLabel x a => a
#soGrain)
(SurfaceOptions
cfg SurfaceOptions
-> Getting [Colour] SurfaceOptions [Colour] -> [Colour]
forall s a. s -> Getting a s a -> a
^. (SurfaceStyle -> Const [Colour] SurfaceStyle)
-> SurfaceOptions -> Const [Colour] SurfaceOptions
forall a. IsLabel "soStyle" a => a
forall (x :: Symbol) a. IsLabel x a => a
#soStyle ((SurfaceStyle -> Const [Colour] SurfaceStyle)
-> SurfaceOptions -> Const [Colour] SurfaceOptions)
-> (([Colour] -> Const [Colour] [Colour])
-> SurfaceStyle -> Const [Colour] SurfaceStyle)
-> Getting [Colour] SurfaceOptions [Colour]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Colour] -> Const [Colour] [Colour])
-> SurfaceStyle -> Const [Colour] SurfaceStyle
forall a. IsLabel "surfaceColors" a => a
forall (x :: Symbol) a. IsLabel x a => a
#surfaceColors)
surfacefl :: (Point Double -> Double) -> SurfaceOptions -> SurfaceLegendOptions -> ([Chart Double], [Hud Double])
surfacefl :: (Point Double -> Double)
-> SurfaceOptions
-> SurfaceLegendOptions
-> ([Chart Double], [Hud Double])
surfacefl Point Double -> Double
f SurfaceOptions
po SurfaceLegendOptions
slo = ([Chart Double]
cs, [LegendOptions -> [Chart Double] -> Hud Double
legendHud (SurfaceLegendOptions
slo SurfaceLegendOptions
-> Getting LegendOptions SurfaceLegendOptions LegendOptions
-> LegendOptions
forall s a. s -> Getting a s a -> a
^. Getting LegendOptions SurfaceLegendOptions LegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions) (Range Double -> SurfaceLegendOptions -> [Chart Double]
surfaceLegendChart Range Double
dr SurfaceLegendOptions
slo)])
where
([Chart Double]
cs, Range Double
dr) = (Point Double -> Double)
-> SurfaceOptions -> ([Chart Double], Range Double)
surfacef Point Double -> Double
f SurfaceOptions
po
data SurfaceLegendOptions = SurfaceLegendOptions
{ SurfaceLegendOptions -> SurfaceStyle
sloStyle :: SurfaceStyle,
SurfaceLegendOptions -> Text
sloTitle :: Text,
SurfaceLegendOptions -> Double
sloWidth :: Double,
SurfaceLegendOptions -> Int
sloResolution :: Int,
SurfaceLegendOptions -> AxisOptions
sloAxisOptions :: AxisOptions,
SurfaceLegendOptions -> LegendOptions
sloLegendOptions :: LegendOptions
}
deriving (SurfaceLegendOptions -> SurfaceLegendOptions -> Bool
(SurfaceLegendOptions -> SurfaceLegendOptions -> Bool)
-> (SurfaceLegendOptions -> SurfaceLegendOptions -> Bool)
-> Eq SurfaceLegendOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SurfaceLegendOptions -> SurfaceLegendOptions -> Bool
$c/= :: SurfaceLegendOptions -> SurfaceLegendOptions -> Bool
== :: SurfaceLegendOptions -> SurfaceLegendOptions -> Bool
$c== :: SurfaceLegendOptions -> SurfaceLegendOptions -> Bool
Eq, Int -> SurfaceLegendOptions -> ShowS
[SurfaceLegendOptions] -> ShowS
SurfaceLegendOptions -> String
(Int -> SurfaceLegendOptions -> ShowS)
-> (SurfaceLegendOptions -> String)
-> ([SurfaceLegendOptions] -> ShowS)
-> Show SurfaceLegendOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SurfaceLegendOptions] -> ShowS
$cshowList :: [SurfaceLegendOptions] -> ShowS
show :: SurfaceLegendOptions -> String
$cshow :: SurfaceLegendOptions -> String
showsPrec :: Int -> SurfaceLegendOptions -> ShowS
$cshowsPrec :: Int -> SurfaceLegendOptions -> ShowS
Show, (forall x. SurfaceLegendOptions -> Rep SurfaceLegendOptions x)
-> (forall x. Rep SurfaceLegendOptions x -> SurfaceLegendOptions)
-> Generic SurfaceLegendOptions
forall x. Rep SurfaceLegendOptions x -> SurfaceLegendOptions
forall x. SurfaceLegendOptions -> Rep SurfaceLegendOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SurfaceLegendOptions x -> SurfaceLegendOptions
$cfrom :: forall x. SurfaceLegendOptions -> Rep SurfaceLegendOptions x
Generic)
surfaceAxisOptions :: AxisOptions
surfaceAxisOptions :: AxisOptions
surfaceAxisOptions =
Maybe AxisBar -> Maybe Adjustments -> Tick -> Place -> AxisOptions
AxisOptions
Maybe AxisBar
forall a. Maybe a
Nothing
Maybe Adjustments
forall a. Maybe a
Nothing
( TickStyle
-> Maybe (GlyphStyle, Double)
-> Maybe (TextStyle, Double)
-> Maybe (LineStyle, Double)
-> Tick
Tick
(FormatN -> Int -> TickExtend -> TickStyle
TickRound (Maybe Int -> FormatN
FormatPrec (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
3)) Int
4 TickExtend
NoTickExtend)
((GlyphStyle, Double) -> Maybe (GlyphStyle, Double)
forall a. a -> Maybe a
Just (GlyphStyle
defaultGlyphTick GlyphStyle -> (GlyphStyle -> GlyphStyle) -> GlyphStyle
forall a b. a -> (a -> b) -> b
& (Colour -> Identity Colour) -> GlyphStyle -> Identity GlyphStyle
forall a. IsLabel "color" a => a
forall (x :: Symbol) a. IsLabel x a => a
#color ((Colour -> Identity Colour) -> GlyphStyle -> Identity GlyphStyle)
-> Colour -> GlyphStyle -> GlyphStyle
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Colour
dark GlyphStyle -> (GlyphStyle -> GlyphStyle) -> GlyphStyle
forall a b. a -> (a -> b) -> b
& (GlyphShape -> Identity GlyphShape)
-> GlyphStyle -> Identity GlyphStyle
forall a. IsLabel "shape" a => a
forall (x :: Symbol) a. IsLabel x a => a
#shape ((GlyphShape -> Identity GlyphShape)
-> GlyphStyle -> Identity GlyphStyle)
-> GlyphShape -> GlyphStyle -> GlyphStyle
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Double -> GlyphShape
VLineGlyph Double
0.005, Double
0.01))
((TextStyle, Double) -> Maybe (TextStyle, Double)
forall a. a -> Maybe a
Just (TextStyle
defaultTextTick, Double
0.03))
Maybe (LineStyle, Double)
forall a. Maybe a
Nothing
)
Place
PlaceRight
defaultSurfaceLegendOptions :: Text -> SurfaceLegendOptions
defaultSurfaceLegendOptions :: Text -> SurfaceLegendOptions
defaultSurfaceLegendOptions Text
t =
SurfaceStyle
-> Text
-> Double
-> Int
-> AxisOptions
-> LegendOptions
-> SurfaceLegendOptions
SurfaceLegendOptions SurfaceStyle
defaultSurfaceStyle Text
t Double
0.05 Int
100 AxisOptions
surfaceAxisOptions LegendOptions
surfaceLegendOptions
surfaceLegendOptions :: LegendOptions
surfaceLegendOptions :: LegendOptions
surfaceLegendOptions =
LegendOptions
defaultLegendOptions
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& (Place -> Identity Place)
-> LegendOptions -> Identity LegendOptions
forall a. IsLabel "lplace" a => a
forall (x :: Symbol) a. IsLabel x a => a
#lplace ((Place -> Identity Place)
-> LegendOptions -> Identity LegendOptions)
-> Place -> LegendOptions -> LegendOptions
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Place
PlaceRight
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& (Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions
forall a. IsLabel "lscale" a => a
forall (x :: Symbol) a. IsLabel x a => a
#lscale ((Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions)
-> Double -> LegendOptions -> LegendOptions
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Double
0.7
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& (Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions
forall a. IsLabel "lsize" a => a
forall (x :: Symbol) a. IsLabel x a => a
#lsize ((Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions)
-> Double -> LegendOptions -> LegendOptions
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Double
0.5
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& (Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions
forall a. IsLabel "vgap" a => a
forall (x :: Symbol) a. IsLabel x a => a
#vgap ((Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions)
-> Double -> LegendOptions -> LegendOptions
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Double
0.05
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& (Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions
forall a. IsLabel "hgap" a => a
forall (x :: Symbol) a. IsLabel x a => a
#hgap ((Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions)
-> Double -> LegendOptions -> LegendOptions
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Double
0.01
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& (Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions
forall a. IsLabel "innerPad" a => a
forall (x :: Symbol) a. IsLabel x a => a
#innerPad ((Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions)
-> Double -> LegendOptions -> LegendOptions
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Double
0.05
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& (Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions
forall a. IsLabel "outerPad" a => a
forall (x :: Symbol) a. IsLabel x a => a
#outerPad ((Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions)
-> Double -> LegendOptions -> LegendOptions
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Double
0.02
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& (TextStyle -> Identity TextStyle)
-> LegendOptions -> Identity LegendOptions
forall a. IsLabel "ltext" a => a
forall (x :: Symbol) a. IsLabel x a => a
#ltext ((TextStyle -> Identity TextStyle)
-> LegendOptions -> Identity LegendOptions)
-> ((Double -> Identity Double) -> TextStyle -> Identity TextStyle)
-> (Double -> Identity Double)
-> LegendOptions
-> Identity LegendOptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> Identity Double) -> TextStyle -> Identity TextStyle
forall a. IsLabel "hsize" a => a
forall (x :: Symbol) a. IsLabel x a => a
#hsize ((Double -> Identity Double)
-> LegendOptions -> Identity LegendOptions)
-> Double -> LegendOptions -> LegendOptions
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Double
0.5
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& (Maybe RectStyle -> Identity (Maybe RectStyle))
-> LegendOptions -> Identity LegendOptions
forall a. IsLabel "legendFrame" a => a
forall (x :: Symbol) a. IsLabel x a => a
#legendFrame ((Maybe RectStyle -> Identity (Maybe RectStyle))
-> LegendOptions -> Identity LegendOptions)
-> Maybe RectStyle -> LegendOptions -> LegendOptions
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Maybe RectStyle
forall a. Maybe a
Nothing
surfaceLegendChart :: Range Double -> SurfaceLegendOptions -> [Chart Double]
surfaceLegendChart :: Range Double -> SurfaceLegendOptions -> [Chart Double]
surfaceLegendChart Range Double
dataRange SurfaceLegendOptions
l =
Double -> [Chart Double] -> [Chart Double]
padChart (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Double SurfaceLegendOptions Double -> Double
forall s a. s -> Getting a s a -> a
^. (LegendOptions -> Const Double LegendOptions)
-> SurfaceLegendOptions -> Const Double SurfaceLegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions ((LegendOptions -> Const Double LegendOptions)
-> SurfaceLegendOptions -> Const Double SurfaceLegendOptions)
-> ((Double -> Const Double Double)
-> LegendOptions -> Const Double LegendOptions)
-> Getting Double SurfaceLegendOptions Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> Const Double Double)
-> LegendOptions -> Const Double LegendOptions
forall a. IsLabel "outerPad" a => a
forall (x :: Symbol) a. IsLabel x a => a
#outerPad)
([Chart Double] -> [Chart Double])
-> ([Chart Double] -> [Chart Double])
-> [Chart Double]
-> [Chart Double]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Chart Double] -> [Chart Double])
-> (RectStyle -> [Chart Double] -> [Chart Double])
-> Maybe RectStyle
-> [Chart Double]
-> [Chart Double]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [Chart Double] -> [Chart Double]
forall a. a -> a
id (\RectStyle
x -> RectStyle -> Double -> [Chart Double] -> [Chart Double]
frameChart RectStyle
x (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Double SurfaceLegendOptions Double -> Double
forall s a. s -> Getting a s a -> a
^. (LegendOptions -> Const Double LegendOptions)
-> SurfaceLegendOptions -> Const Double SurfaceLegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions ((LegendOptions -> Const Double LegendOptions)
-> SurfaceLegendOptions -> Const Double SurfaceLegendOptions)
-> ((Double -> Const Double Double)
-> LegendOptions -> Const Double LegendOptions)
-> Getting Double SurfaceLegendOptions Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> Const Double Double)
-> LegendOptions -> Const Double LegendOptions
forall a. IsLabel "innerPad" a => a
forall (x :: Symbol) a. IsLabel x a => a
#innerPad)) (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting (Maybe RectStyle) SurfaceLegendOptions (Maybe RectStyle)
-> Maybe RectStyle
forall s a. s -> Getting a s a -> a
^. (LegendOptions -> Const (Maybe RectStyle) LegendOptions)
-> SurfaceLegendOptions
-> Const (Maybe RectStyle) SurfaceLegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions ((LegendOptions -> Const (Maybe RectStyle) LegendOptions)
-> SurfaceLegendOptions
-> Const (Maybe RectStyle) SurfaceLegendOptions)
-> ((Maybe RectStyle -> Const (Maybe RectStyle) (Maybe RectStyle))
-> LegendOptions -> Const (Maybe RectStyle) LegendOptions)
-> Getting (Maybe RectStyle) SurfaceLegendOptions (Maybe RectStyle)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe RectStyle -> Const (Maybe RectStyle) (Maybe RectStyle))
-> LegendOptions -> Const (Maybe RectStyle) LegendOptions
forall a. IsLabel "legendFrame" a => a
forall (x :: Symbol) a. IsLabel x a => a
#legendFrame)
([Chart Double] -> [Chart Double])
-> [Chart Double] -> [Chart Double]
forall a b. (a -> b) -> a -> b
$ [Chart Double]
hs
where
a :: [Chart Double]
a = SurfaceLegendOptions -> [Chart Double] -> [Chart Double]
makeSurfaceTick SurfaceLegendOptions
l [Chart Double]
pchart
pchart :: [Chart Double]
pchart
| SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Place SurfaceLegendOptions Place -> Place
forall s a. s -> Getting a s a -> a
^. (LegendOptions -> Const Place LegendOptions)
-> SurfaceLegendOptions -> Const Place SurfaceLegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions ((LegendOptions -> Const Place LegendOptions)
-> SurfaceLegendOptions -> Const Place SurfaceLegendOptions)
-> ((Place -> Const Place Place)
-> LegendOptions -> Const Place LegendOptions)
-> Getting Place SurfaceLegendOptions Place
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Place -> Const Place Place)
-> LegendOptions -> Const Place LegendOptions
forall a. IsLabel "lplace" a => a
forall (x :: Symbol) a. IsLabel x a => a
#lplace Place -> Place -> Bool
forall a. Eq a => a -> a -> Bool
== Place
PlaceBottom
Bool -> Bool -> Bool
|| SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Place SurfaceLegendOptions Place -> Place
forall s a. s -> Getting a s a -> a
^. (LegendOptions -> Const Place LegendOptions)
-> SurfaceLegendOptions -> Const Place SurfaceLegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions ((LegendOptions -> Const Place LegendOptions)
-> SurfaceLegendOptions -> Const Place SurfaceLegendOptions)
-> ((Place -> Const Place Place)
-> LegendOptions -> Const Place LegendOptions)
-> Getting Place SurfaceLegendOptions Place
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Place -> Const Place Place)
-> LegendOptions -> Const Place LegendOptions
forall a. IsLabel "lplace" a => a
forall (x :: Symbol) a. IsLabel x a => a
#lplace Place -> Place -> Bool
forall a. Eq a => a -> a -> Bool
== Place
PlaceTop =
[Chart Double]
vertGlyph
| Bool
otherwise = [Chart Double]
horiGlyph
t :: Chart Double
t = Annotation -> [XY Double] -> Chart Double
forall a. Annotation -> [XY a] -> Chart a
Chart (TextStyle -> [Text] -> Annotation
TextA (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting TextStyle SurfaceLegendOptions TextStyle -> TextStyle
forall s a. s -> Getting a s a -> a
^. (LegendOptions -> Const TextStyle LegendOptions)
-> SurfaceLegendOptions -> Const TextStyle SurfaceLegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions ((LegendOptions -> Const TextStyle LegendOptions)
-> SurfaceLegendOptions -> Const TextStyle SurfaceLegendOptions)
-> ((TextStyle -> Const TextStyle TextStyle)
-> LegendOptions -> Const TextStyle LegendOptions)
-> Getting TextStyle SurfaceLegendOptions TextStyle
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TextStyle -> Const TextStyle TextStyle)
-> LegendOptions -> Const TextStyle LegendOptions
forall a. IsLabel "ltext" a => a
forall (x :: Symbol) a. IsLabel x a => a
#ltext TextStyle -> (TextStyle -> TextStyle) -> TextStyle
forall a b. a -> (a -> b) -> b
& (Anchor -> Identity Anchor) -> TextStyle -> Identity TextStyle
forall a. IsLabel "anchor" a => a
forall (x :: Symbol) a. IsLabel x a => a
#anchor ((Anchor -> Identity Anchor) -> TextStyle -> Identity TextStyle)
-> Anchor -> TextStyle -> TextStyle
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Anchor
AnchorStart) [SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Text SurfaceLegendOptions Text -> Text
forall s a. s -> Getting a s a -> a
^. Getting Text SurfaceLegendOptions Text
forall a. IsLabel "sloTitle" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloTitle]) [XY Double
forall a. Additive a => a
zero]
hs :: [Chart Double]
hs = Double -> [[Chart Double]] -> [Chart Double]
vert (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Double SurfaceLegendOptions Double -> Double
forall s a. s -> Getting a s a -> a
^. (LegendOptions -> Const Double LegendOptions)
-> SurfaceLegendOptions -> Const Double SurfaceLegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions ((LegendOptions -> Const Double LegendOptions)
-> SurfaceLegendOptions -> Const Double SurfaceLegendOptions)
-> ((Double -> Const Double Double)
-> LegendOptions -> Const Double LegendOptions)
-> Getting Double SurfaceLegendOptions Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> Const Double Double)
-> LegendOptions -> Const Double LegendOptions
forall a. IsLabel "vgap" a => a
forall (x :: Symbol) a. IsLabel x a => a
#vgap) [[Chart Double]
a, [Chart Double
t]]
vertGlyph :: [Chart Double]
vertGlyph :: [Chart Double]
vertGlyph =
(Rect Double -> Colour -> Chart Double)
-> [Rect Double] -> [Colour] -> [Chart Double]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith
(\Rect Double
r Colour
c -> Annotation -> [XY Double] -> Chart Double
forall a. Annotation -> [XY a] -> Chart a
Chart (RectStyle -> Annotation
RectA (RectStyle -> Annotation) -> RectStyle -> Annotation
forall a b. (a -> b) -> a -> b
$ Colour -> RectStyle
blob Colour
c) [Rect Double -> XY Double
forall a. Rect a -> XY a
RectXY Rect Double
r])
( (\Range Double
xr -> Range Double -> Range Double -> Rect Double
forall a. Range a -> Range a -> Rect a
Ranges Range Double
xr (Double -> Double -> Range Double
forall a. a -> a -> Range a
Range Double
0 (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Double SurfaceLegendOptions Double -> Double
forall s a. s -> Getting a s a -> a
^. Getting Double SurfaceLegendOptions Double
forall a. IsLabel "sloWidth" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloWidth)))
(Range Double -> Rect Double) -> [Range Double] -> [Rect Double]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Double -> Grid (Range Double) -> [Range Double]
forall s. FieldSpace s => s -> Grid s -> [s]
gridSpace
Range Double
dataRange
(SurfaceLegendOptions
l SurfaceLegendOptions -> Getting Int SurfaceLegendOptions Int -> Int
forall s a. s -> Getting a s a -> a
^. Getting Int SurfaceLegendOptions Int
forall a. IsLabel "sloResolution" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloResolution)
)
( (\Double
x -> Double -> [Colour] -> Colour
blends Double
x (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting [Colour] SurfaceLegendOptions [Colour] -> [Colour]
forall s a. s -> Getting a s a -> a
^. (SurfaceStyle -> Const [Colour] SurfaceStyle)
-> SurfaceLegendOptions -> Const [Colour] SurfaceLegendOptions
forall a. IsLabel "sloStyle" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloStyle ((SurfaceStyle -> Const [Colour] SurfaceStyle)
-> SurfaceLegendOptions -> Const [Colour] SurfaceLegendOptions)
-> (([Colour] -> Const [Colour] [Colour])
-> SurfaceStyle -> Const [Colour] SurfaceStyle)
-> Getting [Colour] SurfaceLegendOptions [Colour]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Colour] -> Const [Colour] [Colour])
-> SurfaceStyle -> Const [Colour] SurfaceStyle
forall a. IsLabel "surfaceColors" a => a
forall (x :: Symbol) a. IsLabel x a => a
#surfaceColors))
(Double -> Colour) -> [Double] -> [Colour]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Pos
-> Range Double -> Grid (Range Double) -> [Element (Range Double)]
forall s. FieldSpace s => Pos -> s -> Grid s -> [Element s]
grid Pos
MidPos (Double -> Double -> Range Double
forall a. a -> a -> Range a
Range Double
0 Double
1) (SurfaceLegendOptions
l SurfaceLegendOptions -> Getting Int SurfaceLegendOptions Int -> Int
forall s a. s -> Getting a s a -> a
^. Getting Int SurfaceLegendOptions Int
forall a. IsLabel "sloResolution" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloResolution)
)
horiGlyph :: [Chart Double]
horiGlyph :: [Chart Double]
horiGlyph =
(Rect Double -> Colour -> Chart Double)
-> [Rect Double] -> [Colour] -> [Chart Double]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith
(\Rect Double
r Colour
c -> Annotation -> [XY Double] -> Chart Double
forall a. Annotation -> [XY a] -> Chart a
Chart (RectStyle -> Annotation
RectA (RectStyle -> Annotation) -> RectStyle -> Annotation
forall a b. (a -> b) -> a -> b
$ Colour -> RectStyle
blob Colour
c) [Rect Double -> XY Double
forall a. Rect a -> XY a
RectXY Rect Double
r])
( (\Range Double
yr -> Range Double -> Range Double -> Rect Double
forall a. Range a -> Range a -> Rect a
Ranges (Double -> Double -> Range Double
forall a. a -> a -> Range a
Range Double
0 (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Double SurfaceLegendOptions Double -> Double
forall s a. s -> Getting a s a -> a
^. Getting Double SurfaceLegendOptions Double
forall a. IsLabel "sloWidth" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloWidth)) Range Double
yr)
(Range Double -> Rect Double) -> [Range Double] -> [Rect Double]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Double -> Grid (Range Double) -> [Range Double]
forall s. FieldSpace s => s -> Grid s -> [s]
gridSpace
Range Double
dataRange
(SurfaceLegendOptions
l SurfaceLegendOptions -> Getting Int SurfaceLegendOptions Int -> Int
forall s a. s -> Getting a s a -> a
^. Getting Int SurfaceLegendOptions Int
forall a. IsLabel "sloResolution" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloResolution)
)
( (\Double
x -> Double -> [Colour] -> Colour
blends Double
x (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting [Colour] SurfaceLegendOptions [Colour] -> [Colour]
forall s a. s -> Getting a s a -> a
^. (SurfaceStyle -> Const [Colour] SurfaceStyle)
-> SurfaceLegendOptions -> Const [Colour] SurfaceLegendOptions
forall a. IsLabel "sloStyle" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloStyle ((SurfaceStyle -> Const [Colour] SurfaceStyle)
-> SurfaceLegendOptions -> Const [Colour] SurfaceLegendOptions)
-> (([Colour] -> Const [Colour] [Colour])
-> SurfaceStyle -> Const [Colour] SurfaceStyle)
-> Getting [Colour] SurfaceLegendOptions [Colour]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Colour] -> Const [Colour] [Colour])
-> SurfaceStyle -> Const [Colour] SurfaceStyle
forall a. IsLabel "surfaceColors" a => a
forall (x :: Symbol) a. IsLabel x a => a
#surfaceColors))
(Double -> Colour) -> [Double] -> [Colour]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Pos
-> Range Double -> Grid (Range Double) -> [Element (Range Double)]
forall s. FieldSpace s => Pos -> s -> Grid s -> [Element s]
grid Pos
MidPos (Double -> Double -> Range Double
forall a. a -> a -> Range a
Range Double
0 Double
1) (SurfaceLegendOptions
l SurfaceLegendOptions -> Getting Int SurfaceLegendOptions Int -> Int
forall s a. s -> Getting a s a -> a
^. Getting Int SurfaceLegendOptions Int
forall a. IsLabel "sloResolution" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloResolution)
)
isHori :: SurfaceLegendOptions -> Bool
isHori :: SurfaceLegendOptions -> Bool
isHori SurfaceLegendOptions
l =
SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Place SurfaceLegendOptions Place -> Place
forall s a. s -> Getting a s a -> a
^. (LegendOptions -> Const Place LegendOptions)
-> SurfaceLegendOptions -> Const Place SurfaceLegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions ((LegendOptions -> Const Place LegendOptions)
-> SurfaceLegendOptions -> Const Place SurfaceLegendOptions)
-> ((Place -> Const Place Place)
-> LegendOptions -> Const Place LegendOptions)
-> Getting Place SurfaceLegendOptions Place
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Place -> Const Place Place)
-> LegendOptions -> Const Place LegendOptions
forall a. IsLabel "lplace" a => a
forall (x :: Symbol) a. IsLabel x a => a
#lplace Place -> Place -> Bool
forall a. Eq a => a -> a -> Bool
== Place
PlaceBottom
Bool -> Bool -> Bool
|| SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Place SurfaceLegendOptions Place -> Place
forall s a. s -> Getting a s a -> a
^. (LegendOptions -> Const Place LegendOptions)
-> SurfaceLegendOptions -> Const Place SurfaceLegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions ((LegendOptions -> Const Place LegendOptions)
-> SurfaceLegendOptions -> Const Place SurfaceLegendOptions)
-> ((Place -> Const Place Place)
-> LegendOptions -> Const Place LegendOptions)
-> Getting Place SurfaceLegendOptions Place
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Place -> Const Place Place)
-> LegendOptions -> Const Place LegendOptions
forall a. IsLabel "lplace" a => a
forall (x :: Symbol) a. IsLabel x a => a
#lplace Place -> Place -> Bool
forall a. Eq a => a -> a -> Bool
== Place
PlaceTop
makeSurfaceTick :: SurfaceLegendOptions -> [Chart Double] -> [Chart Double]
makeSurfaceTick :: SurfaceLegendOptions -> [Chart Double] -> [Chart Double]
makeSurfaceTick SurfaceLegendOptions
l [Chart Double]
pchart = [Chart Double]
phud
where
r :: Rect Double
r = Rect Double -> Maybe (Rect Double) -> Rect Double
forall a. a -> Maybe a -> a
fromMaybe Rect Double
forall a. Multiplicative a => a
one ([Chart Double] -> Maybe (Rect Double)
styleBoxes [Chart Double]
pchart)
r' :: Rect Double
r' = Rect Double -> Rect Double -> Bool -> Rect Double
forall a. a -> a -> Bool -> a
bool (Double -> Double -> Double -> Double -> Rect Double
forall a. a -> a -> a -> a -> Rect a
Rect Double
0 (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Double SurfaceLegendOptions Double -> Double
forall s a. s -> Getting a s a -> a
^. Getting Double SurfaceLegendOptions Double
forall a. IsLabel "sloWidth" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloWidth) Double
0 (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Double SurfaceLegendOptions Double -> Double
forall s a. s -> Getting a s a -> a
^. (LegendOptions -> Const Double LegendOptions)
-> SurfaceLegendOptions -> Const Double SurfaceLegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions ((LegendOptions -> Const Double LegendOptions)
-> SurfaceLegendOptions -> Const Double SurfaceLegendOptions)
-> ((Double -> Const Double Double)
-> LegendOptions -> Const Double LegendOptions)
-> Getting Double SurfaceLegendOptions Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> Const Double Double)
-> LegendOptions -> Const Double LegendOptions
forall a. IsLabel "lsize" a => a
forall (x :: Symbol) a. IsLabel x a => a
#lsize)) (Double -> Double -> Double -> Double -> Rect Double
forall a. a -> a -> a -> a -> Rect a
Rect Double
0 (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Double SurfaceLegendOptions Double -> Double
forall s a. s -> Getting a s a -> a
^. (LegendOptions -> Const Double LegendOptions)
-> SurfaceLegendOptions -> Const Double SurfaceLegendOptions
forall a. IsLabel "sloLegendOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloLegendOptions ((LegendOptions -> Const Double LegendOptions)
-> SurfaceLegendOptions -> Const Double SurfaceLegendOptions)
-> ((Double -> Const Double Double)
-> LegendOptions -> Const Double LegendOptions)
-> Getting Double SurfaceLegendOptions Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> Const Double Double)
-> LegendOptions -> Const Double LegendOptions
forall a. IsLabel "lsize" a => a
forall (x :: Symbol) a. IsLabel x a => a
#lsize) Double
0 (SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting Double SurfaceLegendOptions Double -> Double
forall s a. s -> Getting a s a -> a
^. Getting Double SurfaceLegendOptions Double
forall a. IsLabel "sloWidth" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloWidth)) (SurfaceLegendOptions -> Bool
isHori SurfaceLegendOptions
l)
([Hud Double]
hs, [Chart Double]
_) =
Rect Double -> HudOptions -> ([Hud Double], [Chart Double])
makeHud
Rect Double
r
( HudOptions
forall a. Monoid a => a
mempty HudOptions -> (HudOptions -> HudOptions) -> HudOptions
forall a b. a -> (a -> b) -> b
& ([AxisOptions] -> Identity [AxisOptions])
-> HudOptions -> Identity HudOptions
forall a. IsLabel "hudAxes" a => a
forall (x :: Symbol) a. IsLabel x a => a
#hudAxes
(([AxisOptions] -> Identity [AxisOptions])
-> HudOptions -> Identity HudOptions)
-> [AxisOptions] -> HudOptions -> HudOptions
forall s t a b. ASetter s t a b -> b -> s -> t
.~ [ SurfaceLegendOptions
l SurfaceLegendOptions
-> Getting AxisOptions SurfaceLegendOptions AxisOptions
-> AxisOptions
forall s a. s -> Getting a s a -> a
^. Getting AxisOptions SurfaceLegendOptions AxisOptions
forall a. IsLabel "sloAxisOptions" a => a
forall (x :: Symbol) a. IsLabel x a => a
#sloAxisOptions
AxisOptions -> (AxisOptions -> AxisOptions) -> AxisOptions
forall a b. a -> (a -> b) -> b
& (Place -> Identity Place) -> AxisOptions -> Identity AxisOptions
forall a. IsLabel "place" a => a
forall (x :: Symbol) a. IsLabel x a => a
#place ((Place -> Identity Place) -> AxisOptions -> Identity AxisOptions)
-> Place -> AxisOptions -> AxisOptions
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Place -> Place -> Bool -> Place
forall a. a -> a -> Bool -> a
bool Place
PlaceRight Place
PlaceBottom (SurfaceLegendOptions -> Bool
isHori SurfaceLegendOptions
l)
]
)
phud :: [Chart Double]
phud = Rect Double
-> Rect Double -> [Hud Double] -> [Chart Double] -> [Chart Double]
runHudWith Rect Double
r' Rect Double
r [Hud Double]
hs [Chart Double]
pchart