{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wall #-}
module Chart.Surface
( SurfaceData (..),
SurfaceOptions (..),
defaultSurfaceOptions,
SurfaceStyle (..),
defaultSurfaceStyle,
mkSurfaceData,
surfaces,
surfacef,
surfacefl,
SurfaceLegendOptions (..),
defaultSurfaceLegendOptions,
surfaceAxisOptions,
)
where
import Chart.Data
import Chart.Hud
import Chart.Primitive
import Chart.Style
import Data.Bifunctor
import Data.Bool
import Data.Colour
import Data.Foldable
import Data.FormatN
import Data.Text (Text)
import GHC.Generics
import Optics.Core
import Prelude
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
palette1 (Int -> Colour) -> [Int] -> [Colour]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Int
0 .. Int
1]) (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]
surfaces :: RectStyle -> [SurfaceData] -> [Chart]
surfaces RectStyle
rs [SurfaceData]
ps =
( \(SurfaceData Rect Double
r Colour
c) ->
RectStyle -> [Rect Double] -> Chart
RectChart
(RectStyle
rs RectStyle -> (RectStyle -> RectStyle) -> RectStyle
forall a b. a -> (a -> b) -> b
& IsLabel
"color" (Optic A_Lens NoIx RectStyle RectStyle Colour Colour)
Optic A_Lens NoIx RectStyle RectStyle Colour Colour
#color Optic A_Lens NoIx RectStyle RectStyle Colour Colour
-> Colour -> RectStyle -> RectStyle
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Colour
c)
[Rect Double
r]
)
(SurfaceData -> Chart) -> [SurfaceData] -> [Chart]
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
mixes 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
unsafeSpace1 [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
unsafeSpace1 [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], Range Double)
surfacef :: (Point Double -> Double)
-> SurfaceOptions -> ([Chart], Range Double)
surfacef Point Double -> Double
f SurfaceOptions
cfg =
([SurfaceData] -> [Chart])
-> ([SurfaceData], Range Double) -> ([Chart], Range Double)
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first (RectStyle -> [SurfaceData] -> [Chart]
surfaces (SurfaceOptions
cfg SurfaceOptions
-> Optic' A_Lens NoIx SurfaceOptions RectStyle -> RectStyle
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"soStyle"
(Optic
A_Lens
NoIx
SurfaceOptions
SurfaceOptions
SurfaceStyle
SurfaceStyle)
Optic
A_Lens NoIx SurfaceOptions SurfaceOptions SurfaceStyle SurfaceStyle
#soStyle Optic
A_Lens NoIx SurfaceOptions SurfaceOptions SurfaceStyle SurfaceStyle
-> Optic A_Lens NoIx SurfaceStyle SurfaceStyle RectStyle RectStyle
-> Optic' A_Lens NoIx SurfaceOptions RectStyle
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"surfaceRectStyle"
(Optic A_Lens NoIx SurfaceStyle SurfaceStyle RectStyle RectStyle)
Optic A_Lens NoIx SurfaceStyle SurfaceStyle RectStyle RectStyle
#surfaceRectStyle)) (([SurfaceData], Range Double) -> ([Chart], Range Double))
-> ([SurfaceData], Range Double) -> ([Chart], 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
-> Optic' A_Lens NoIx SurfaceOptions (Rect Double) -> Rect Double
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel "soRange" (Optic' A_Lens NoIx SurfaceOptions (Rect Double))
Optic' A_Lens NoIx SurfaceOptions (Rect Double)
#soRange)
(SurfaceOptions
cfg SurfaceOptions
-> Optic' A_Lens NoIx SurfaceOptions (Point Int) -> Point Int
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel "soGrain" (Optic' A_Lens NoIx SurfaceOptions (Point Int))
Optic' A_Lens NoIx SurfaceOptions (Point Int)
#soGrain)
([Colour] -> [Colour]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList ([Colour] -> [Colour]) -> [Colour] -> [Colour]
forall a b. (a -> b) -> a -> b
$ SurfaceOptions
cfg SurfaceOptions
-> Optic' A_Lens NoIx SurfaceOptions [Colour] -> [Colour]
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"soStyle"
(Optic
A_Lens
NoIx
SurfaceOptions
SurfaceOptions
SurfaceStyle
SurfaceStyle)
Optic
A_Lens NoIx SurfaceOptions SurfaceOptions SurfaceStyle SurfaceStyle
#soStyle Optic
A_Lens NoIx SurfaceOptions SurfaceOptions SurfaceStyle SurfaceStyle
-> Optic A_Lens NoIx SurfaceStyle SurfaceStyle [Colour] [Colour]
-> Optic' A_Lens NoIx SurfaceOptions [Colour]
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"surfaceColors"
(Optic A_Lens NoIx SurfaceStyle SurfaceStyle [Colour] [Colour])
Optic A_Lens NoIx SurfaceStyle SurfaceStyle [Colour] [Colour]
#surfaceColors)
surfacefl :: (Point Double -> Double) -> SurfaceOptions -> SurfaceLegendOptions -> ([Chart], [Hud])
surfacefl :: (Point Double -> Double)
-> SurfaceOptions -> SurfaceLegendOptions -> ([Chart], [Hud])
surfacefl Point Double -> Double
f SurfaceOptions
po SurfaceLegendOptions
slo =
( [Chart]
cs,
[Double -> State HudChart ChartTree -> Hud
Hud Double
10 (LegendOptions -> ChartTree -> State HudChart ChartTree
legendHud (SurfaceLegendOptions
slo SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
-> LegendOptions
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloLegendOptions"
(Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions)
Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
#sloLegendOptions) (Range Double -> SurfaceLegendOptions -> ChartTree
surfaceLegendChart Range Double
dr SurfaceLegendOptions
slo))]
)
where
([Chart]
cs, Range Double
dr) = (Point Double -> Double)
-> SurfaceOptions -> ([Chart], 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 :: Colour -> AxisOptions
surfaceAxisOptions :: Colour -> AxisOptions
surfaceAxisOptions Colour
c =
Maybe AxisBar -> Maybe Adjustments -> Ticks -> 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)
-> Ticks
Ticks
(FormatN -> Int -> TickExtend -> TickStyle
TickRound (FStyle -> Maybe Int -> Bool -> FormatN
FormatN FStyle
FSPrec (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
3) Bool
True) 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
& IsLabel
"borderColor"
(Optic A_Lens NoIx GlyphStyle GlyphStyle Colour Colour)
Optic A_Lens NoIx GlyphStyle GlyphStyle Colour Colour
#borderColor Optic A_Lens NoIx GlyphStyle GlyphStyle Colour Colour
-> Colour -> GlyphStyle -> GlyphStyle
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Colour
c GlyphStyle -> (GlyphStyle -> GlyphStyle) -> GlyphStyle
forall a b. a -> (a -> b) -> b
& IsLabel
"color" (Optic A_Lens NoIx GlyphStyle GlyphStyle Colour Colour)
Optic A_Lens NoIx GlyphStyle GlyphStyle Colour Colour
#color Optic A_Lens NoIx GlyphStyle GlyphStyle Colour Colour
-> Colour -> GlyphStyle -> GlyphStyle
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Colour
c GlyphStyle -> (GlyphStyle -> GlyphStyle) -> GlyphStyle
forall a b. a -> (a -> b) -> b
& IsLabel
"shape"
(Optic A_Lens NoIx GlyphStyle GlyphStyle GlyphShape GlyphShape)
Optic A_Lens NoIx GlyphStyle GlyphStyle GlyphShape GlyphShape
#shape Optic A_Lens NoIx GlyphStyle GlyphStyle GlyphShape GlyphShape
-> GlyphShape -> GlyphStyle -> GlyphStyle
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ GlyphShape
VLineGlyph, Double
0.01))
((TextStyle, Double) -> Maybe (TextStyle, Double)
forall a. a -> Maybe a
Just (TextStyle
defaultTextTick TextStyle -> (TextStyle -> TextStyle) -> TextStyle
forall a b. a -> (a -> b) -> b
& IsLabel
"color" (Optic A_Lens NoIx TextStyle TextStyle Colour Colour)
Optic A_Lens NoIx TextStyle TextStyle Colour Colour
#color Optic A_Lens NoIx TextStyle TextStyle Colour Colour
-> Colour -> TextStyle -> TextStyle
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Colour
c, Double
0.03))
Maybe (LineStyle, Double)
forall a. Maybe a
Nothing
)
Place
PlaceRight
defaultSurfaceLegendOptions :: Colour -> Text -> SurfaceLegendOptions
defaultSurfaceLegendOptions :: Colour -> Text -> SurfaceLegendOptions
defaultSurfaceLegendOptions Colour
c Text
t =
SurfaceStyle
-> Text
-> Double
-> Int
-> AxisOptions
-> LegendOptions
-> SurfaceLegendOptions
SurfaceLegendOptions SurfaceStyle
defaultSurfaceStyle Text
t Double
0.05 Int
100 (Colour -> AxisOptions
surfaceAxisOptions Colour
c) LegendOptions
surfaceLegendOptions
surfaceLegendOptions :: LegendOptions
surfaceLegendOptions :: LegendOptions
surfaceLegendOptions =
LegendOptions
defaultLegendOptions
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& IsLabel
"place" (Optic A_Lens NoIx LegendOptions LegendOptions Place Place)
Optic A_Lens NoIx LegendOptions LegendOptions Place Place
#place Optic A_Lens NoIx LegendOptions LegendOptions Place Place
-> Place -> LegendOptions -> LegendOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Place
PlaceRight
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& IsLabel
"overallScale"
(Optic A_Lens NoIx LegendOptions LegendOptions Double Double)
Optic A_Lens NoIx LegendOptions LegendOptions Double Double
#overallScale Optic A_Lens NoIx LegendOptions LegendOptions Double Double
-> Double -> LegendOptions -> LegendOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Double
0.9
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& IsLabel
"size"
(Optic A_Lens NoIx LegendOptions LegendOptions Double Double)
Optic A_Lens NoIx LegendOptions LegendOptions Double Double
#size Optic A_Lens NoIx LegendOptions LegendOptions Double Double
-> Double -> LegendOptions -> LegendOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Double
0.5
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& IsLabel
"vgap"
(Optic A_Lens NoIx LegendOptions LegendOptions Double Double)
Optic A_Lens NoIx LegendOptions LegendOptions Double Double
#vgap Optic A_Lens NoIx LegendOptions LegendOptions Double Double
-> Double -> LegendOptions -> LegendOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Double
0.05
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& IsLabel
"hgap"
(Optic A_Lens NoIx LegendOptions LegendOptions Double Double)
Optic A_Lens NoIx LegendOptions LegendOptions Double Double
#hgap Optic A_Lens NoIx LegendOptions LegendOptions Double Double
-> Double -> LegendOptions -> LegendOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Double
0.01
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& IsLabel
"innerPad"
(Optic A_Lens NoIx LegendOptions LegendOptions Double Double)
Optic A_Lens NoIx LegendOptions LegendOptions Double Double
#innerPad Optic A_Lens NoIx LegendOptions LegendOptions Double Double
-> Double -> LegendOptions -> LegendOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Double
0.05
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& IsLabel
"outerPad"
(Optic A_Lens NoIx LegendOptions LegendOptions Double Double)
Optic A_Lens NoIx LegendOptions LegendOptions Double Double
#outerPad Optic A_Lens NoIx LegendOptions LegendOptions Double Double
-> Double -> LegendOptions -> LegendOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Double
0.02
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& IsLabel
"textStyle"
(Optic A_Lens NoIx LegendOptions LegendOptions TextStyle TextStyle)
Optic A_Lens NoIx LegendOptions LegendOptions TextStyle TextStyle
#textStyle Optic A_Lens NoIx LegendOptions LegendOptions TextStyle TextStyle
-> Optic A_Lens NoIx TextStyle TextStyle Double Double
-> Optic A_Lens NoIx LegendOptions LegendOptions Double Double
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"hsize" (Optic A_Lens NoIx TextStyle TextStyle Double Double)
Optic A_Lens NoIx TextStyle TextStyle Double Double
#hsize Optic A_Lens NoIx LegendOptions LegendOptions Double Double
-> Double -> LegendOptions -> LegendOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Double
0.5
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& IsLabel
"textStyle"
(Optic A_Lens NoIx LegendOptions LegendOptions TextStyle TextStyle)
Optic A_Lens NoIx LegendOptions LegendOptions TextStyle TextStyle
#textStyle Optic A_Lens NoIx LegendOptions LegendOptions TextStyle TextStyle
-> Optic A_Lens NoIx TextStyle TextStyle Double Double
-> Optic A_Lens NoIx LegendOptions LegendOptions Double Double
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"size" (Optic A_Lens NoIx TextStyle TextStyle Double Double)
Optic A_Lens NoIx TextStyle TextStyle Double Double
#size Optic A_Lens NoIx LegendOptions LegendOptions Double Double
-> Double -> LegendOptions -> LegendOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Double
0.1
LegendOptions -> (LegendOptions -> LegendOptions) -> LegendOptions
forall a b. a -> (a -> b) -> b
& IsLabel
"frame"
(Optic
A_Lens
NoIx
LegendOptions
LegendOptions
(Maybe RectStyle)
(Maybe RectStyle))
Optic
A_Lens
NoIx
LegendOptions
LegendOptions
(Maybe RectStyle)
(Maybe RectStyle)
#frame Optic
A_Lens
NoIx
LegendOptions
LegendOptions
(Maybe RectStyle)
(Maybe RectStyle)
-> Maybe RectStyle -> LegendOptions -> LegendOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Maybe RectStyle
forall a. Maybe a
Nothing
surfaceLegendChart :: Range Double -> SurfaceLegendOptions -> ChartTree
surfaceLegendChart :: Range Double -> SurfaceLegendOptions -> ChartTree
surfaceLegendChart Range Double
dataRange SurfaceLegendOptions
l =
LegendOptions -> ChartTree -> ChartTree
legendFrame (Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
-> SurfaceLegendOptions -> LegendOptions
forall k (is :: IxList) s a.
Is k A_Getter =>
Optic' k is s a -> s -> a
view IsLabel
"sloLegendOptions"
(Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions)
Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
#sloLegendOptions SurfaceLegendOptions
l) ChartTree
hs
where
a :: ChartTree
a = SurfaceLegendOptions -> ChartTree -> ChartTree
makeSurfaceTick SurfaceLegendOptions
l (Text -> [Chart] -> ChartTree
named Text
"pchart" [Chart]
pchart)
pchart :: [Chart]
pchart
| SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions Place -> Place
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloLegendOptions"
(Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions)
Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
#sloLegendOptions Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
-> Optic A_Lens NoIx LegendOptions LegendOptions Place Place
-> Optic' A_Lens NoIx SurfaceLegendOptions Place
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"place" (Optic A_Lens NoIx LegendOptions LegendOptions Place Place)
Optic A_Lens NoIx LegendOptions LegendOptions Place Place
#place Place -> Place -> Bool
forall a. Eq a => a -> a -> Bool
== Place
PlaceBottom
Bool -> Bool -> Bool
|| SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions Place -> Place
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloLegendOptions"
(Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions)
Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
#sloLegendOptions Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
-> Optic A_Lens NoIx LegendOptions LegendOptions Place Place
-> Optic' A_Lens NoIx SurfaceLegendOptions Place
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"place" (Optic A_Lens NoIx LegendOptions LegendOptions Place Place)
Optic A_Lens NoIx LegendOptions LegendOptions Place Place
#place Place -> Place -> Bool
forall a. Eq a => a -> a -> Bool
== Place
PlaceTop =
[Chart]
vertGlyph
| Bool
otherwise = [Chart]
horiGlyph
t :: Chart
t = TextStyle -> [(Text, Point Double)] -> Chart
TextChart (SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions TextStyle -> TextStyle
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloLegendOptions"
(Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions)
Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
#sloLegendOptions Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
-> Optic
A_Lens NoIx LegendOptions LegendOptions TextStyle TextStyle
-> Optic' A_Lens NoIx SurfaceLegendOptions TextStyle
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"textStyle"
(Optic A_Lens NoIx LegendOptions LegendOptions TextStyle TextStyle)
Optic A_Lens NoIx LegendOptions LegendOptions TextStyle TextStyle
#textStyle TextStyle -> (TextStyle -> TextStyle) -> TextStyle
forall a b. a -> (a -> b) -> b
& IsLabel
"anchor" (Optic A_Lens NoIx TextStyle TextStyle Anchor Anchor)
Optic A_Lens NoIx TextStyle TextStyle Anchor Anchor
#anchor Optic A_Lens NoIx TextStyle TextStyle Anchor Anchor
-> Anchor -> TextStyle -> TextStyle
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ Anchor
AnchorStart) [(SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions Text -> Text
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel "sloTitle" (Optic' A_Lens NoIx SurfaceLegendOptions Text)
Optic' A_Lens NoIx SurfaceLegendOptions Text
#sloTitle, Point Double
forall a. Additive a => a
zero)]
hs :: ChartTree
hs = Double -> [ChartTree] -> ChartTree
vert (SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions Double -> Double
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloLegendOptions"
(Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions)
Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
#sloLegendOptions Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
-> Optic A_Lens NoIx LegendOptions LegendOptions Double Double
-> Optic' A_Lens NoIx SurfaceLegendOptions Double
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"vgap"
(Optic A_Lens NoIx LegendOptions LegendOptions Double Double)
Optic A_Lens NoIx LegendOptions LegendOptions Double Double
#vgap) [ChartTree
a, [Chart] -> ChartTree
unnamed [Chart
t]]
vertGlyph :: [Chart]
vertGlyph :: [Chart]
vertGlyph =
(Rect Double -> Colour -> Chart)
-> [Rect Double] -> [Colour] -> [Chart]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith
(\Rect Double
r Colour
c -> RectStyle -> [Rect Double] -> Chart
RectChart (Colour -> RectStyle
blob Colour
c) [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
-> Optic' A_Lens NoIx SurfaceLegendOptions Double -> Double
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel "sloWidth" (Optic' A_Lens NoIx SurfaceLegendOptions Double)
Optic' A_Lens NoIx SurfaceLegendOptions Double
#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
-> Optic' A_Lens NoIx SurfaceLegendOptions Int -> Int
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloResolution" (Optic' A_Lens NoIx SurfaceLegendOptions Int)
Optic' A_Lens NoIx SurfaceLegendOptions Int
#sloResolution)
)
( (\Double
x -> Double -> [Colour] -> Colour
mixes Double
x ([Colour] -> [Colour]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList ([Colour] -> [Colour]) -> [Colour] -> [Colour]
forall a b. (a -> b) -> a -> b
$ SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions [Colour] -> [Colour]
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloStyle"
(Optic
A_Lens
NoIx
SurfaceLegendOptions
SurfaceLegendOptions
SurfaceStyle
SurfaceStyle)
Optic
A_Lens
NoIx
SurfaceLegendOptions
SurfaceLegendOptions
SurfaceStyle
SurfaceStyle
#sloStyle Optic
A_Lens
NoIx
SurfaceLegendOptions
SurfaceLegendOptions
SurfaceStyle
SurfaceStyle
-> Optic A_Lens NoIx SurfaceStyle SurfaceStyle [Colour] [Colour]
-> Optic' A_Lens NoIx SurfaceLegendOptions [Colour]
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"surfaceColors"
(Optic A_Lens NoIx SurfaceStyle SurfaceStyle [Colour] [Colour])
Optic A_Lens NoIx SurfaceStyle SurfaceStyle [Colour] [Colour]
#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
-> Optic' A_Lens NoIx SurfaceLegendOptions Int -> Int
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloResolution" (Optic' A_Lens NoIx SurfaceLegendOptions Int)
Optic' A_Lens NoIx SurfaceLegendOptions Int
#sloResolution)
)
horiGlyph :: [Chart]
horiGlyph :: [Chart]
horiGlyph =
(Rect Double -> Colour -> Chart)
-> [Rect Double] -> [Colour] -> [Chart]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith
(\Rect Double
r Colour
c -> RectStyle -> [Rect Double] -> Chart
RectChart (Colour -> RectStyle
blob Colour
c) [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
-> Optic' A_Lens NoIx SurfaceLegendOptions Double -> Double
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel "sloWidth" (Optic' A_Lens NoIx SurfaceLegendOptions Double)
Optic' A_Lens NoIx SurfaceLegendOptions Double
#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
-> Optic' A_Lens NoIx SurfaceLegendOptions Int -> Int
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloResolution" (Optic' A_Lens NoIx SurfaceLegendOptions Int)
Optic' A_Lens NoIx SurfaceLegendOptions Int
#sloResolution)
)
( (\Double
x -> Double -> [Colour] -> Colour
mixes Double
x ([Colour] -> [Colour]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList ([Colour] -> [Colour]) -> [Colour] -> [Colour]
forall a b. (a -> b) -> a -> b
$ SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions [Colour] -> [Colour]
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloStyle"
(Optic
A_Lens
NoIx
SurfaceLegendOptions
SurfaceLegendOptions
SurfaceStyle
SurfaceStyle)
Optic
A_Lens
NoIx
SurfaceLegendOptions
SurfaceLegendOptions
SurfaceStyle
SurfaceStyle
#sloStyle Optic
A_Lens
NoIx
SurfaceLegendOptions
SurfaceLegendOptions
SurfaceStyle
SurfaceStyle
-> Optic A_Lens NoIx SurfaceStyle SurfaceStyle [Colour] [Colour]
-> Optic' A_Lens NoIx SurfaceLegendOptions [Colour]
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"surfaceColors"
(Optic A_Lens NoIx SurfaceStyle SurfaceStyle [Colour] [Colour])
Optic A_Lens NoIx SurfaceStyle SurfaceStyle [Colour] [Colour]
#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
-> Optic' A_Lens NoIx SurfaceLegendOptions Int -> Int
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloResolution" (Optic' A_Lens NoIx SurfaceLegendOptions Int)
Optic' A_Lens NoIx SurfaceLegendOptions Int
#sloResolution)
)
isHori :: SurfaceLegendOptions -> Bool
isHori :: SurfaceLegendOptions -> Bool
isHori SurfaceLegendOptions
l =
SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions Place -> Place
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloLegendOptions"
(Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions)
Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
#sloLegendOptions Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
-> Optic A_Lens NoIx LegendOptions LegendOptions Place Place
-> Optic' A_Lens NoIx SurfaceLegendOptions Place
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"place" (Optic A_Lens NoIx LegendOptions LegendOptions Place Place)
Optic A_Lens NoIx LegendOptions LegendOptions Place Place
#place Place -> Place -> Bool
forall a. Eq a => a -> a -> Bool
== Place
PlaceBottom
Bool -> Bool -> Bool
|| SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions Place -> Place
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloLegendOptions"
(Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions)
Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
#sloLegendOptions Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
-> Optic A_Lens NoIx LegendOptions LegendOptions Place Place
-> Optic' A_Lens NoIx SurfaceLegendOptions Place
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"place" (Optic A_Lens NoIx LegendOptions LegendOptions Place Place)
Optic A_Lens NoIx LegendOptions LegendOptions Place Place
#place Place -> Place -> Bool
forall a. Eq a => a -> a -> Bool
== Place
PlaceTop
makeSurfaceTick :: SurfaceLegendOptions -> ChartTree -> ChartTree
makeSurfaceTick :: SurfaceLegendOptions -> ChartTree -> ChartTree
makeSurfaceTick SurfaceLegendOptions
l ChartTree
pchart = case Optic' A_Lens NoIx ChartTree (Maybe (Rect Double))
-> ChartTree -> Maybe (Rect Double)
forall k (is :: IxList) s a.
Is k A_Getter =>
Optic' k is s a -> s -> a
view Optic' A_Lens NoIx ChartTree (Maybe (Rect Double))
styleBox' ChartTree
pchart of
Maybe (Rect Double)
Nothing -> ChartTree
pchart
Just Rect Double
r' -> ChartTree
phud
where
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
-> Optic' A_Lens NoIx SurfaceLegendOptions Double -> Double
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel "sloWidth" (Optic' A_Lens NoIx SurfaceLegendOptions Double)
Optic' A_Lens NoIx SurfaceLegendOptions Double
#sloWidth) Double
0 (SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions Double -> Double
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloLegendOptions"
(Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions)
Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
#sloLegendOptions Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
-> Optic A_Lens NoIx LegendOptions LegendOptions Double Double
-> Optic' A_Lens NoIx SurfaceLegendOptions Double
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"size"
(Optic A_Lens NoIx LegendOptions LegendOptions Double Double)
Optic A_Lens NoIx LegendOptions LegendOptions Double Double
#size)) (Double -> Double -> Double -> Double -> Rect Double
forall a. a -> a -> a -> a -> Rect a
Rect Double
0 (SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions Double -> Double
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloLegendOptions"
(Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions)
Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
#sloLegendOptions Optic' A_Lens NoIx SurfaceLegendOptions LegendOptions
-> Optic A_Lens NoIx LegendOptions LegendOptions Double Double
-> Optic' A_Lens NoIx SurfaceLegendOptions Double
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% IsLabel
"size"
(Optic A_Lens NoIx LegendOptions LegendOptions Double Double)
Optic A_Lens NoIx LegendOptions LegendOptions Double Double
#size) Double
0 (SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions Double -> Double
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel "sloWidth" (Optic' A_Lens NoIx SurfaceLegendOptions Double)
Optic' A_Lens NoIx SurfaceLegendOptions Double
#sloWidth)) (SurfaceLegendOptions -> Bool
isHori SurfaceLegendOptions
l)
([Hud]
hs, Rect Double
db) = HudOptions -> Rect Double -> ([Hud], Rect Double)
toHuds (HudOptions
forall a. Monoid a => a
mempty HudOptions -> (HudOptions -> HudOptions) -> HudOptions
forall a b. a -> (a -> b) -> b
& Optic A_Lens NoIx HudOptions HudOptions ChartAspect ChartAspect
-> ChartAspect -> HudOptions -> HudOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
set IsLabel
"chartAspect"
(Optic A_Lens NoIx HudOptions HudOptions ChartAspect ChartAspect)
Optic A_Lens NoIx HudOptions HudOptions ChartAspect ChartAspect
#chartAspect ChartAspect
ChartAspect HudOptions -> (HudOptions -> HudOptions) -> HudOptions
forall a b. a -> (a -> b) -> b
& Optic
A_Lens
NoIx
HudOptions
HudOptions
[(Double, AxisOptions)]
[(Double, AxisOptions)]
-> [(Double, AxisOptions)] -> HudOptions -> HudOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
set IsLabel
"axes"
(Optic
A_Lens
NoIx
HudOptions
HudOptions
[(Double, AxisOptions)]
[(Double, AxisOptions)])
Optic
A_Lens
NoIx
HudOptions
HudOptions
[(Double, AxisOptions)]
[(Double, AxisOptions)]
#axes [(Double
9, SurfaceLegendOptions
l SurfaceLegendOptions
-> Optic' A_Lens NoIx SurfaceLegendOptions AxisOptions
-> AxisOptions
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. IsLabel
"sloAxisOptions"
(Optic' A_Lens NoIx SurfaceLegendOptions AxisOptions)
Optic' A_Lens NoIx SurfaceLegendOptions AxisOptions
#sloAxisOptions AxisOptions -> (AxisOptions -> AxisOptions) -> AxisOptions
forall a b. a -> (a -> b) -> b
& IsLabel
"place" (Optic A_Lens NoIx AxisOptions AxisOptions Place Place)
Optic A_Lens NoIx AxisOptions AxisOptions Place Place
#place Optic A_Lens NoIx AxisOptions AxisOptions Place Place
-> Place -> AxisOptions -> AxisOptions
forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is 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))]) Rect Double
r'
phud :: ChartTree
phud = Rect Double -> Rect Double -> [Hud] -> ChartTree -> ChartTree
runHudWith Rect Double
r'' Rect Double
db [Hud]
hs ChartTree
pchart