{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE Strict #-}

{- |
Module      : Granite.Spec
Copyright   : (c) 2025
License     : MIT
Maintainer  : mschavinda@gmail.com

Declarative Grammar-of-Graphics chart IR: data + layers + scales +
coord + facet + theme + size.
-}
module Granite.Spec (
    Chart (..),
    emptyChart,
    module Granite.Data.Frame,
    module Granite.Format,
    ColumnRef (..),
    Mapping (..),
    emptyMapping,
    AesDefaults (..),
    emptyAesDefaults,
    ColorSpec (..),
    Layer (..),
    defLayer,
    Geom (..),
    Stat (..),
    BinSpec (..),
    SmoothMethod (..),
    SummaryFun (..),
    Position (..),
    Scale (..),
    ScaleOpts (..),
    defScaleOpts,
    LogBase (..),
    BreaksSpec (..),
    Expand (..),
    Scales (..),
    defScales,
    Coord (..),
    PolarAes (..),
    PolarDir (..),
    Facet (..),
    FacetScales (..),
    Theme (..),
    defTheme,
    Size (..),
) where

import Data.Text (Text)
import Data.Word (Word8)

import Granite.Color (Color (..))
import Granite.Data.Frame
import Granite.Format

newtype ColumnRef = ColumnRef Text
    deriving (ColumnRef -> ColumnRef -> Bool
(ColumnRef -> ColumnRef -> Bool)
-> (ColumnRef -> ColumnRef -> Bool) -> Eq ColumnRef
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ColumnRef -> ColumnRef -> Bool
== :: ColumnRef -> ColumnRef -> Bool
$c/= :: ColumnRef -> ColumnRef -> Bool
/= :: ColumnRef -> ColumnRef -> Bool
Eq, Int -> ColumnRef -> ShowS
[ColumnRef] -> ShowS
ColumnRef -> String
(Int -> ColumnRef -> ShowS)
-> (ColumnRef -> String)
-> ([ColumnRef] -> ShowS)
-> Show ColumnRef
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ColumnRef -> ShowS
showsPrec :: Int -> ColumnRef -> ShowS
$cshow :: ColumnRef -> String
show :: ColumnRef -> String
$cshowList :: [ColumnRef] -> ShowS
showList :: [ColumnRef] -> ShowS
Show, ReadPrec [ColumnRef]
ReadPrec ColumnRef
Int -> ReadS ColumnRef
ReadS [ColumnRef]
(Int -> ReadS ColumnRef)
-> ReadS [ColumnRef]
-> ReadPrec ColumnRef
-> ReadPrec [ColumnRef]
-> Read ColumnRef
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ColumnRef
readsPrec :: Int -> ReadS ColumnRef
$creadList :: ReadS [ColumnRef]
readList :: ReadS [ColumnRef]
$creadPrec :: ReadPrec ColumnRef
readPrec :: ReadPrec ColumnRef
$creadListPrec :: ReadPrec [ColumnRef]
readListPrec :: ReadPrec [ColumnRef]
Read)

data Mapping = Mapping
    { Mapping -> Maybe ColumnRef
aesX :: Maybe ColumnRef
    , Mapping -> Maybe ColumnRef
aesY :: Maybe ColumnRef
    , Mapping -> Maybe ColumnRef
aesColor :: Maybe ColumnRef
    , Mapping -> Maybe ColumnRef
aesFill :: Maybe ColumnRef
    , Mapping -> Maybe ColumnRef
aesSize :: Maybe ColumnRef
    , Mapping -> Maybe ColumnRef
aesAlpha :: Maybe ColumnRef
    , Mapping -> Maybe ColumnRef
aesGroup :: Maybe ColumnRef
    , Mapping -> Maybe ColumnRef
aesYmin :: Maybe ColumnRef
    , Mapping -> Maybe ColumnRef
aesYmax :: Maybe ColumnRef
    , Mapping -> Maybe ColumnRef
aesLabel :: Maybe ColumnRef
    }
    deriving (Mapping -> Mapping -> Bool
(Mapping -> Mapping -> Bool)
-> (Mapping -> Mapping -> Bool) -> Eq Mapping
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Mapping -> Mapping -> Bool
== :: Mapping -> Mapping -> Bool
$c/= :: Mapping -> Mapping -> Bool
/= :: Mapping -> Mapping -> Bool
Eq, Int -> Mapping -> ShowS
[Mapping] -> ShowS
Mapping -> String
(Int -> Mapping -> ShowS)
-> (Mapping -> String) -> ([Mapping] -> ShowS) -> Show Mapping
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Mapping -> ShowS
showsPrec :: Int -> Mapping -> ShowS
$cshow :: Mapping -> String
show :: Mapping -> String
$cshowList :: [Mapping] -> ShowS
showList :: [Mapping] -> ShowS
Show, ReadPrec [Mapping]
ReadPrec Mapping
Int -> ReadS Mapping
ReadS [Mapping]
(Int -> ReadS Mapping)
-> ReadS [Mapping]
-> ReadPrec Mapping
-> ReadPrec [Mapping]
-> Read Mapping
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Mapping
readsPrec :: Int -> ReadS Mapping
$creadList :: ReadS [Mapping]
readList :: ReadS [Mapping]
$creadPrec :: ReadPrec Mapping
readPrec :: ReadPrec Mapping
$creadListPrec :: ReadPrec [Mapping]
readListPrec :: ReadPrec [Mapping]
Read)

emptyMapping :: Mapping
emptyMapping :: Mapping
emptyMapping =
    Mapping
        { aesX :: Maybe ColumnRef
aesX = Maybe ColumnRef
forall a. Maybe a
Nothing
        , aesY :: Maybe ColumnRef
aesY = Maybe ColumnRef
forall a. Maybe a
Nothing
        , aesColor :: Maybe ColumnRef
aesColor = Maybe ColumnRef
forall a. Maybe a
Nothing
        , aesFill :: Maybe ColumnRef
aesFill = Maybe ColumnRef
forall a. Maybe a
Nothing
        , aesSize :: Maybe ColumnRef
aesSize = Maybe ColumnRef
forall a. Maybe a
Nothing
        , aesAlpha :: Maybe ColumnRef
aesAlpha = Maybe ColumnRef
forall a. Maybe a
Nothing
        , aesGroup :: Maybe ColumnRef
aesGroup = Maybe ColumnRef
forall a. Maybe a
Nothing
        , aesYmin :: Maybe ColumnRef
aesYmin = Maybe ColumnRef
forall a. Maybe a
Nothing
        , aesYmax :: Maybe ColumnRef
aesYmax = Maybe ColumnRef
forall a. Maybe a
Nothing
        , aesLabel :: Maybe ColumnRef
aesLabel = Maybe ColumnRef
forall a. Maybe a
Nothing
        }

data AesDefaults = AesDefaults
    { AesDefaults -> Maybe ColorSpec
defColor :: Maybe ColorSpec
    , AesDefaults -> Maybe ColorSpec
defFill :: Maybe ColorSpec
    , AesDefaults -> Maybe Double
defSize :: Maybe Double
    , AesDefaults -> Maybe Double
defAlpha :: Maybe Double
    , AesDefaults -> Maybe Double
defLineWidth :: Maybe Double
    , AesDefaults -> Maybe [Double]
defLineDash :: Maybe [Double]
    }
    deriving (AesDefaults -> AesDefaults -> Bool
(AesDefaults -> AesDefaults -> Bool)
-> (AesDefaults -> AesDefaults -> Bool) -> Eq AesDefaults
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AesDefaults -> AesDefaults -> Bool
== :: AesDefaults -> AesDefaults -> Bool
$c/= :: AesDefaults -> AesDefaults -> Bool
/= :: AesDefaults -> AesDefaults -> Bool
Eq, Int -> AesDefaults -> ShowS
[AesDefaults] -> ShowS
AesDefaults -> String
(Int -> AesDefaults -> ShowS)
-> (AesDefaults -> String)
-> ([AesDefaults] -> ShowS)
-> Show AesDefaults
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AesDefaults -> ShowS
showsPrec :: Int -> AesDefaults -> ShowS
$cshow :: AesDefaults -> String
show :: AesDefaults -> String
$cshowList :: [AesDefaults] -> ShowS
showList :: [AesDefaults] -> ShowS
Show, ReadPrec [AesDefaults]
ReadPrec AesDefaults
Int -> ReadS AesDefaults
ReadS [AesDefaults]
(Int -> ReadS AesDefaults)
-> ReadS [AesDefaults]
-> ReadPrec AesDefaults
-> ReadPrec [AesDefaults]
-> Read AesDefaults
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS AesDefaults
readsPrec :: Int -> ReadS AesDefaults
$creadList :: ReadS [AesDefaults]
readList :: ReadS [AesDefaults]
$creadPrec :: ReadPrec AesDefaults
readPrec :: ReadPrec AesDefaults
$creadListPrec :: ReadPrec [AesDefaults]
readListPrec :: ReadPrec [AesDefaults]
Read)

emptyAesDefaults :: AesDefaults
emptyAesDefaults :: AesDefaults
emptyAesDefaults =
    AesDefaults
        { defColor :: Maybe ColorSpec
defColor = Maybe ColorSpec
forall a. Maybe a
Nothing
        , defFill :: Maybe ColorSpec
defFill = Maybe ColorSpec
forall a. Maybe a
Nothing
        , defSize :: Maybe Double
defSize = Maybe Double
forall a. Maybe a
Nothing
        , defAlpha :: Maybe Double
defAlpha = Maybe Double
forall a. Maybe a
Nothing
        , defLineWidth :: Maybe Double
defLineWidth = Maybe Double
forall a. Maybe a
Nothing
        , defLineDash :: Maybe [Double]
defLineDash = Maybe [Double]
forall a. Maybe a
Nothing
        }

data ColorSpec
    = NamedColor Color
    | RGB Word8 Word8 Word8
    | Hex Text
    deriving (ColorSpec -> ColorSpec -> Bool
(ColorSpec -> ColorSpec -> Bool)
-> (ColorSpec -> ColorSpec -> Bool) -> Eq ColorSpec
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ColorSpec -> ColorSpec -> Bool
== :: ColorSpec -> ColorSpec -> Bool
$c/= :: ColorSpec -> ColorSpec -> Bool
/= :: ColorSpec -> ColorSpec -> Bool
Eq, Int -> ColorSpec -> ShowS
[ColorSpec] -> ShowS
ColorSpec -> String
(Int -> ColorSpec -> ShowS)
-> (ColorSpec -> String)
-> ([ColorSpec] -> ShowS)
-> Show ColorSpec
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ColorSpec -> ShowS
showsPrec :: Int -> ColorSpec -> ShowS
$cshow :: ColorSpec -> String
show :: ColorSpec -> String
$cshowList :: [ColorSpec] -> ShowS
showList :: [ColorSpec] -> ShowS
Show, ReadPrec [ColorSpec]
ReadPrec ColorSpec
Int -> ReadS ColorSpec
ReadS [ColorSpec]
(Int -> ReadS ColorSpec)
-> ReadS [ColorSpec]
-> ReadPrec ColorSpec
-> ReadPrec [ColorSpec]
-> Read ColorSpec
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ColorSpec
readsPrec :: Int -> ReadS ColorSpec
$creadList :: ReadS [ColorSpec]
readList :: ReadS [ColorSpec]
$creadPrec :: ReadPrec ColorSpec
readPrec :: ReadPrec ColorSpec
$creadListPrec :: ReadPrec [ColorSpec]
readListPrec :: ReadPrec [ColorSpec]
Read)

data Layer = Layer
    { Layer -> Maybe DataFrame
layerData :: Maybe DataFrame
    , Layer -> Mapping
layerMapping :: Mapping
    , Layer -> Geom
layerGeom :: Geom
    , Layer -> Stat
layerStat :: Stat
    , Layer -> Position
layerPosition :: Position
    , Layer -> AesDefaults
layerAesDef :: AesDefaults
    }
    deriving (Layer -> Layer -> Bool
(Layer -> Layer -> Bool) -> (Layer -> Layer -> Bool) -> Eq Layer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Layer -> Layer -> Bool
== :: Layer -> Layer -> Bool
$c/= :: Layer -> Layer -> Bool
/= :: Layer -> Layer -> Bool
Eq, Int -> Layer -> ShowS
[Layer] -> ShowS
Layer -> String
(Int -> Layer -> ShowS)
-> (Layer -> String) -> ([Layer] -> ShowS) -> Show Layer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Layer -> ShowS
showsPrec :: Int -> Layer -> ShowS
$cshow :: Layer -> String
show :: Layer -> String
$cshowList :: [Layer] -> ShowS
showList :: [Layer] -> ShowS
Show, ReadPrec [Layer]
ReadPrec Layer
Int -> ReadS Layer
ReadS [Layer]
(Int -> ReadS Layer)
-> ReadS [Layer]
-> ReadPrec Layer
-> ReadPrec [Layer]
-> Read Layer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Layer
readsPrec :: Int -> ReadS Layer
$creadList :: ReadS [Layer]
readList :: ReadS [Layer]
$creadPrec :: ReadPrec Layer
readPrec :: ReadPrec Layer
$creadListPrec :: ReadPrec [Layer]
readListPrec :: ReadPrec [Layer]
Read)

defLayer :: Geom -> Layer
defLayer :: Geom -> Layer
defLayer Geom
g =
    Layer
        { layerData :: Maybe DataFrame
layerData = Maybe DataFrame
forall a. Maybe a
Nothing
        , layerMapping :: Mapping
layerMapping = Mapping
emptyMapping
        , layerGeom :: Geom
layerGeom = Geom
g
        , layerStat :: Stat
layerStat = Geom -> Stat
defaultStat Geom
g
        , layerPosition :: Position
layerPosition = Position
PosIdentity
        , layerAesDef :: AesDefaults
layerAesDef = AesDefaults
emptyAesDefaults
        }

defaultStat :: Geom -> Stat
defaultStat :: Geom -> Stat
defaultStat Geom
g = case Geom
g of
    Geom
GeomBar -> Stat
StatCount
    Geom
GeomBoxplot -> Stat
StatBoxplot
    Geom
GeomDensity -> Stat
StatDensity
    Geom
GeomHistogram -> BinSpec -> Stat
StatBin (Int -> BinSpec
BinByCount Int
30)
    Geom
_ -> Stat
StatIdentity

data Geom
    = GeomPoint
    | GeomLine
    | GeomBar
    | GeomCol
    | GeomRibbon
    | GeomErrorbar
    | GeomTile
    | GeomBoxplot
    | GeomDensity
    | GeomHistogram
    | GeomText
    | GeomArc
    deriving (Geom -> Geom -> Bool
(Geom -> Geom -> Bool) -> (Geom -> Geom -> Bool) -> Eq Geom
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Geom -> Geom -> Bool
== :: Geom -> Geom -> Bool
$c/= :: Geom -> Geom -> Bool
/= :: Geom -> Geom -> Bool
Eq, Int -> Geom -> ShowS
[Geom] -> ShowS
Geom -> String
(Int -> Geom -> ShowS)
-> (Geom -> String) -> ([Geom] -> ShowS) -> Show Geom
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Geom -> ShowS
showsPrec :: Int -> Geom -> ShowS
$cshow :: Geom -> String
show :: Geom -> String
$cshowList :: [Geom] -> ShowS
showList :: [Geom] -> ShowS
Show, ReadPrec [Geom]
ReadPrec Geom
Int -> ReadS Geom
ReadS [Geom]
(Int -> ReadS Geom)
-> ReadS [Geom] -> ReadPrec Geom -> ReadPrec [Geom] -> Read Geom
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Geom
readsPrec :: Int -> ReadS Geom
$creadList :: ReadS [Geom]
readList :: ReadS [Geom]
$creadPrec :: ReadPrec Geom
readPrec :: ReadPrec Geom
$creadListPrec :: ReadPrec [Geom]
readListPrec :: ReadPrec [Geom]
Read)

data Stat
    = StatIdentity
    | StatBin BinSpec
    | StatDensity
    | StatSmooth SmoothMethod
    | StatBoxplot
    | StatCount
    | StatSummary SummaryFun
    deriving (Stat -> Stat -> Bool
(Stat -> Stat -> Bool) -> (Stat -> Stat -> Bool) -> Eq Stat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Stat -> Stat -> Bool
== :: Stat -> Stat -> Bool
$c/= :: Stat -> Stat -> Bool
/= :: Stat -> Stat -> Bool
Eq, Int -> Stat -> ShowS
[Stat] -> ShowS
Stat -> String
(Int -> Stat -> ShowS)
-> (Stat -> String) -> ([Stat] -> ShowS) -> Show Stat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Stat -> ShowS
showsPrec :: Int -> Stat -> ShowS
$cshow :: Stat -> String
show :: Stat -> String
$cshowList :: [Stat] -> ShowS
showList :: [Stat] -> ShowS
Show, ReadPrec [Stat]
ReadPrec Stat
Int -> ReadS Stat
ReadS [Stat]
(Int -> ReadS Stat)
-> ReadS [Stat] -> ReadPrec Stat -> ReadPrec [Stat] -> Read Stat
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Stat
readsPrec :: Int -> ReadS Stat
$creadList :: ReadS [Stat]
readList :: ReadS [Stat]
$creadPrec :: ReadPrec Stat
readPrec :: ReadPrec Stat
$creadListPrec :: ReadPrec [Stat]
readListPrec :: ReadPrec [Stat]
Read)

data BinSpec
    = BinByCount Int
    | BinByWidth Double
    | BinByEdges [Double]
    deriving (BinSpec -> BinSpec -> Bool
(BinSpec -> BinSpec -> Bool)
-> (BinSpec -> BinSpec -> Bool) -> Eq BinSpec
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BinSpec -> BinSpec -> Bool
== :: BinSpec -> BinSpec -> Bool
$c/= :: BinSpec -> BinSpec -> Bool
/= :: BinSpec -> BinSpec -> Bool
Eq, Int -> BinSpec -> ShowS
[BinSpec] -> ShowS
BinSpec -> String
(Int -> BinSpec -> ShowS)
-> (BinSpec -> String) -> ([BinSpec] -> ShowS) -> Show BinSpec
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BinSpec -> ShowS
showsPrec :: Int -> BinSpec -> ShowS
$cshow :: BinSpec -> String
show :: BinSpec -> String
$cshowList :: [BinSpec] -> ShowS
showList :: [BinSpec] -> ShowS
Show, ReadPrec [BinSpec]
ReadPrec BinSpec
Int -> ReadS BinSpec
ReadS [BinSpec]
(Int -> ReadS BinSpec)
-> ReadS [BinSpec]
-> ReadPrec BinSpec
-> ReadPrec [BinSpec]
-> Read BinSpec
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS BinSpec
readsPrec :: Int -> ReadS BinSpec
$creadList :: ReadS [BinSpec]
readList :: ReadS [BinSpec]
$creadPrec :: ReadPrec BinSpec
readPrec :: ReadPrec BinSpec
$creadListPrec :: ReadPrec [BinSpec]
readListPrec :: ReadPrec [BinSpec]
Read)

data SmoothMethod
    = SmoothLm
    | SmoothLoess Double
    | SmoothMovingAvg Int
    deriving (SmoothMethod -> SmoothMethod -> Bool
(SmoothMethod -> SmoothMethod -> Bool)
-> (SmoothMethod -> SmoothMethod -> Bool) -> Eq SmoothMethod
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SmoothMethod -> SmoothMethod -> Bool
== :: SmoothMethod -> SmoothMethod -> Bool
$c/= :: SmoothMethod -> SmoothMethod -> Bool
/= :: SmoothMethod -> SmoothMethod -> Bool
Eq, Int -> SmoothMethod -> ShowS
[SmoothMethod] -> ShowS
SmoothMethod -> String
(Int -> SmoothMethod -> ShowS)
-> (SmoothMethod -> String)
-> ([SmoothMethod] -> ShowS)
-> Show SmoothMethod
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SmoothMethod -> ShowS
showsPrec :: Int -> SmoothMethod -> ShowS
$cshow :: SmoothMethod -> String
show :: SmoothMethod -> String
$cshowList :: [SmoothMethod] -> ShowS
showList :: [SmoothMethod] -> ShowS
Show, ReadPrec [SmoothMethod]
ReadPrec SmoothMethod
Int -> ReadS SmoothMethod
ReadS [SmoothMethod]
(Int -> ReadS SmoothMethod)
-> ReadS [SmoothMethod]
-> ReadPrec SmoothMethod
-> ReadPrec [SmoothMethod]
-> Read SmoothMethod
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS SmoothMethod
readsPrec :: Int -> ReadS SmoothMethod
$creadList :: ReadS [SmoothMethod]
readList :: ReadS [SmoothMethod]
$creadPrec :: ReadPrec SmoothMethod
readPrec :: ReadPrec SmoothMethod
$creadListPrec :: ReadPrec [SmoothMethod]
readListPrec :: ReadPrec [SmoothMethod]
Read)

data SummaryFun
    = SumMean
    | SumMedian
    | SumQuantile Double
    | SumSum
    deriving (SummaryFun -> SummaryFun -> Bool
(SummaryFun -> SummaryFun -> Bool)
-> (SummaryFun -> SummaryFun -> Bool) -> Eq SummaryFun
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SummaryFun -> SummaryFun -> Bool
== :: SummaryFun -> SummaryFun -> Bool
$c/= :: SummaryFun -> SummaryFun -> Bool
/= :: SummaryFun -> SummaryFun -> Bool
Eq, Int -> SummaryFun -> ShowS
[SummaryFun] -> ShowS
SummaryFun -> String
(Int -> SummaryFun -> ShowS)
-> (SummaryFun -> String)
-> ([SummaryFun] -> ShowS)
-> Show SummaryFun
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SummaryFun -> ShowS
showsPrec :: Int -> SummaryFun -> ShowS
$cshow :: SummaryFun -> String
show :: SummaryFun -> String
$cshowList :: [SummaryFun] -> ShowS
showList :: [SummaryFun] -> ShowS
Show, ReadPrec [SummaryFun]
ReadPrec SummaryFun
Int -> ReadS SummaryFun
ReadS [SummaryFun]
(Int -> ReadS SummaryFun)
-> ReadS [SummaryFun]
-> ReadPrec SummaryFun
-> ReadPrec [SummaryFun]
-> Read SummaryFun
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS SummaryFun
readsPrec :: Int -> ReadS SummaryFun
$creadList :: ReadS [SummaryFun]
readList :: ReadS [SummaryFun]
$creadPrec :: ReadPrec SummaryFun
readPrec :: ReadPrec SummaryFun
$creadListPrec :: ReadPrec [SummaryFun]
readListPrec :: ReadPrec [SummaryFun]
Read)

data Position
    = PosIdentity
    | PosStack
    | PosDodge Double
    | PosJitter Double Double
    | PosFill
    deriving (Position -> Position -> Bool
(Position -> Position -> Bool)
-> (Position -> Position -> Bool) -> Eq Position
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Position -> Position -> Bool
== :: Position -> Position -> Bool
$c/= :: Position -> Position -> Bool
/= :: Position -> Position -> Bool
Eq, Int -> Position -> ShowS
[Position] -> ShowS
Position -> String
(Int -> Position -> ShowS)
-> (Position -> String) -> ([Position] -> ShowS) -> Show Position
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Position -> ShowS
showsPrec :: Int -> Position -> ShowS
$cshow :: Position -> String
show :: Position -> String
$cshowList :: [Position] -> ShowS
showList :: [Position] -> ShowS
Show, ReadPrec [Position]
ReadPrec Position
Int -> ReadS Position
ReadS [Position]
(Int -> ReadS Position)
-> ReadS [Position]
-> ReadPrec Position
-> ReadPrec [Position]
-> Read Position
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Position
readsPrec :: Int -> ReadS Position
$creadList :: ReadS [Position]
readList :: ReadS [Position]
$creadPrec :: ReadPrec Position
readPrec :: ReadPrec Position
$creadListPrec :: ReadPrec [Position]
readListPrec :: ReadPrec [Position]
Read)

data LogBase = Base2 | BaseE | Base10
    deriving (LogBase -> LogBase -> Bool
(LogBase -> LogBase -> Bool)
-> (LogBase -> LogBase -> Bool) -> Eq LogBase
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LogBase -> LogBase -> Bool
== :: LogBase -> LogBase -> Bool
$c/= :: LogBase -> LogBase -> Bool
/= :: LogBase -> LogBase -> Bool
Eq, Int -> LogBase -> ShowS
[LogBase] -> ShowS
LogBase -> String
(Int -> LogBase -> ShowS)
-> (LogBase -> String) -> ([LogBase] -> ShowS) -> Show LogBase
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LogBase -> ShowS
showsPrec :: Int -> LogBase -> ShowS
$cshow :: LogBase -> String
show :: LogBase -> String
$cshowList :: [LogBase] -> ShowS
showList :: [LogBase] -> ShowS
Show, ReadPrec [LogBase]
ReadPrec LogBase
Int -> ReadS LogBase
ReadS [LogBase]
(Int -> ReadS LogBase)
-> ReadS [LogBase]
-> ReadPrec LogBase
-> ReadPrec [LogBase]
-> Read LogBase
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS LogBase
readsPrec :: Int -> ReadS LogBase
$creadList :: ReadS [LogBase]
readList :: ReadS [LogBase]
$creadPrec :: ReadPrec LogBase
readPrec :: ReadPrec LogBase
$creadListPrec :: ReadPrec [LogBase]
readListPrec :: ReadPrec [LogBase]
Read)

data Expand = Expand
    { Expand -> Double
expandMult :: Double
    , Expand -> Double
expandAdd :: Double
    }
    deriving (Expand -> Expand -> Bool
(Expand -> Expand -> Bool)
-> (Expand -> Expand -> Bool) -> Eq Expand
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Expand -> Expand -> Bool
== :: Expand -> Expand -> Bool
$c/= :: Expand -> Expand -> Bool
/= :: Expand -> Expand -> Bool
Eq, Int -> Expand -> ShowS
[Expand] -> ShowS
Expand -> String
(Int -> Expand -> ShowS)
-> (Expand -> String) -> ([Expand] -> ShowS) -> Show Expand
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Expand -> ShowS
showsPrec :: Int -> Expand -> ShowS
$cshow :: Expand -> String
show :: Expand -> String
$cshowList :: [Expand] -> ShowS
showList :: [Expand] -> ShowS
Show, ReadPrec [Expand]
ReadPrec Expand
Int -> ReadS Expand
ReadS [Expand]
(Int -> ReadS Expand)
-> ReadS [Expand]
-> ReadPrec Expand
-> ReadPrec [Expand]
-> Read Expand
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Expand
readsPrec :: Int -> ReadS Expand
$creadList :: ReadS [Expand]
readList :: ReadS [Expand]
$creadPrec :: ReadPrec Expand
readPrec :: ReadPrec Expand
$creadListPrec :: ReadPrec [Expand]
readListPrec :: ReadPrec [Expand]
Read)

data BreaksSpec
    = BreaksNice
    | BreaksCount Int
    | BreaksAt [Double]
    deriving (BreaksSpec -> BreaksSpec -> Bool
(BreaksSpec -> BreaksSpec -> Bool)
-> (BreaksSpec -> BreaksSpec -> Bool) -> Eq BreaksSpec
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BreaksSpec -> BreaksSpec -> Bool
== :: BreaksSpec -> BreaksSpec -> Bool
$c/= :: BreaksSpec -> BreaksSpec -> Bool
/= :: BreaksSpec -> BreaksSpec -> Bool
Eq, Int -> BreaksSpec -> ShowS
[BreaksSpec] -> ShowS
BreaksSpec -> String
(Int -> BreaksSpec -> ShowS)
-> (BreaksSpec -> String)
-> ([BreaksSpec] -> ShowS)
-> Show BreaksSpec
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BreaksSpec -> ShowS
showsPrec :: Int -> BreaksSpec -> ShowS
$cshow :: BreaksSpec -> String
show :: BreaksSpec -> String
$cshowList :: [BreaksSpec] -> ShowS
showList :: [BreaksSpec] -> ShowS
Show, ReadPrec [BreaksSpec]
ReadPrec BreaksSpec
Int -> ReadS BreaksSpec
ReadS [BreaksSpec]
(Int -> ReadS BreaksSpec)
-> ReadS [BreaksSpec]
-> ReadPrec BreaksSpec
-> ReadPrec [BreaksSpec]
-> Read BreaksSpec
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS BreaksSpec
readsPrec :: Int -> ReadS BreaksSpec
$creadList :: ReadS [BreaksSpec]
readList :: ReadS [BreaksSpec]
$creadPrec :: ReadPrec BreaksSpec
readPrec :: ReadPrec BreaksSpec
$creadListPrec :: ReadPrec [BreaksSpec]
readListPrec :: ReadPrec [BreaksSpec]
Read)

data ScaleOpts = ScaleOpts
    { ScaleOpts -> Maybe (Double, Double)
scaleDomain :: Maybe (Double, Double)
    , ScaleOpts -> BreaksSpec
scaleBreaks :: BreaksSpec
    , ScaleOpts -> Formatter
scaleLabels :: Formatter
    , ScaleOpts -> Expand
scaleExpand :: Expand
    , ScaleOpts -> Bool
scaleClip :: Bool
    }
    deriving (ScaleOpts -> ScaleOpts -> Bool
(ScaleOpts -> ScaleOpts -> Bool)
-> (ScaleOpts -> ScaleOpts -> Bool) -> Eq ScaleOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ScaleOpts -> ScaleOpts -> Bool
== :: ScaleOpts -> ScaleOpts -> Bool
$c/= :: ScaleOpts -> ScaleOpts -> Bool
/= :: ScaleOpts -> ScaleOpts -> Bool
Eq, Int -> ScaleOpts -> ShowS
[ScaleOpts] -> ShowS
ScaleOpts -> String
(Int -> ScaleOpts -> ShowS)
-> (ScaleOpts -> String)
-> ([ScaleOpts] -> ShowS)
-> Show ScaleOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ScaleOpts -> ShowS
showsPrec :: Int -> ScaleOpts -> ShowS
$cshow :: ScaleOpts -> String
show :: ScaleOpts -> String
$cshowList :: [ScaleOpts] -> ShowS
showList :: [ScaleOpts] -> ShowS
Show, ReadPrec [ScaleOpts]
ReadPrec ScaleOpts
Int -> ReadS ScaleOpts
ReadS [ScaleOpts]
(Int -> ReadS ScaleOpts)
-> ReadS [ScaleOpts]
-> ReadPrec ScaleOpts
-> ReadPrec [ScaleOpts]
-> Read ScaleOpts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ScaleOpts
readsPrec :: Int -> ReadS ScaleOpts
$creadList :: ReadS [ScaleOpts]
readList :: ReadS [ScaleOpts]
$creadPrec :: ReadPrec ScaleOpts
readPrec :: ReadPrec ScaleOpts
$creadListPrec :: ReadPrec [ScaleOpts]
readListPrec :: ReadPrec [ScaleOpts]
Read)

defScaleOpts :: ScaleOpts
defScaleOpts :: ScaleOpts
defScaleOpts =
    ScaleOpts
        { scaleDomain :: Maybe (Double, Double)
scaleDomain = Maybe (Double, Double)
forall a. Maybe a
Nothing
        , scaleBreaks :: BreaksSpec
scaleBreaks = BreaksSpec
BreaksNice
        , scaleLabels :: Formatter
scaleLabels = Formatter
FormatDefault
        , scaleExpand :: Expand
scaleExpand = Double -> Double -> Expand
Expand Double
0.05 Double
0
        , scaleClip :: Bool
scaleClip = Bool
False
        }

data Scale
    = SLinear ScaleOpts
    | SLog LogBase ScaleOpts
    | SSqrt ScaleOpts
    | SReverse Scale
    | SIdentity
    | SDiscrete
    | SColorContinuous [ColorSpec]
    | SColorDiscrete [ColorSpec]
    | {- | Map specific category values to specific colours (e.g.
      @[("NEW", Hex "#ce5050"), ("grown", Hex "#e0a030")]@); values
      not listed fall back to the layer\/constant colour.
      -}
      SColorManual [(Text, ColorSpec)]
    deriving (Scale -> Scale -> Bool
(Scale -> Scale -> Bool) -> (Scale -> Scale -> Bool) -> Eq Scale
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Scale -> Scale -> Bool
== :: Scale -> Scale -> Bool
$c/= :: Scale -> Scale -> Bool
/= :: Scale -> Scale -> Bool
Eq, Int -> Scale -> ShowS
[Scale] -> ShowS
Scale -> String
(Int -> Scale -> ShowS)
-> (Scale -> String) -> ([Scale] -> ShowS) -> Show Scale
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Scale -> ShowS
showsPrec :: Int -> Scale -> ShowS
$cshow :: Scale -> String
show :: Scale -> String
$cshowList :: [Scale] -> ShowS
showList :: [Scale] -> ShowS
Show, ReadPrec [Scale]
ReadPrec Scale
Int -> ReadS Scale
ReadS [Scale]
(Int -> ReadS Scale)
-> ReadS [Scale]
-> ReadPrec Scale
-> ReadPrec [Scale]
-> Read Scale
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Scale
readsPrec :: Int -> ReadS Scale
$creadList :: ReadS [Scale]
readList :: ReadS [Scale]
$creadPrec :: ReadPrec Scale
readPrec :: ReadPrec Scale
$creadListPrec :: ReadPrec [Scale]
readListPrec :: ReadPrec [Scale]
Read)

data Scales = Scales
    { Scales -> Scale
scaleX :: Scale
    , Scales -> Scale
scaleY :: Scale
    , Scales -> Maybe Scale
scaleColor :: Maybe Scale
    , Scales -> Maybe Scale
scaleFill :: Maybe Scale
    , Scales -> Maybe Scale
scaleSize :: Maybe Scale
    }
    deriving (Scales -> Scales -> Bool
(Scales -> Scales -> Bool)
-> (Scales -> Scales -> Bool) -> Eq Scales
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Scales -> Scales -> Bool
== :: Scales -> Scales -> Bool
$c/= :: Scales -> Scales -> Bool
/= :: Scales -> Scales -> Bool
Eq, Int -> Scales -> ShowS
[Scales] -> ShowS
Scales -> String
(Int -> Scales -> ShowS)
-> (Scales -> String) -> ([Scales] -> ShowS) -> Show Scales
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Scales -> ShowS
showsPrec :: Int -> Scales -> ShowS
$cshow :: Scales -> String
show :: Scales -> String
$cshowList :: [Scales] -> ShowS
showList :: [Scales] -> ShowS
Show, ReadPrec [Scales]
ReadPrec Scales
Int -> ReadS Scales
ReadS [Scales]
(Int -> ReadS Scales)
-> ReadS [Scales]
-> ReadPrec Scales
-> ReadPrec [Scales]
-> Read Scales
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Scales
readsPrec :: Int -> ReadS Scales
$creadList :: ReadS [Scales]
readList :: ReadS [Scales]
$creadPrec :: ReadPrec Scales
readPrec :: ReadPrec Scales
$creadListPrec :: ReadPrec [Scales]
readListPrec :: ReadPrec [Scales]
Read)

defScales :: Scales
defScales :: Scales
defScales =
    Scales
        { scaleX :: Scale
scaleX = ScaleOpts -> Scale
SLinear ScaleOpts
defScaleOpts
        , scaleY :: Scale
scaleY = ScaleOpts -> Scale
SLinear ScaleOpts
defScaleOpts
        , scaleColor :: Maybe Scale
scaleColor = Maybe Scale
forall a. Maybe a
Nothing
        , scaleFill :: Maybe Scale
scaleFill = Maybe Scale
forall a. Maybe a
Nothing
        , scaleSize :: Maybe Scale
scaleSize = Maybe Scale
forall a. Maybe a
Nothing
        }

data PolarAes = ThetaX | ThetaY
    deriving (PolarAes -> PolarAes -> Bool
(PolarAes -> PolarAes -> Bool)
-> (PolarAes -> PolarAes -> Bool) -> Eq PolarAes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PolarAes -> PolarAes -> Bool
== :: PolarAes -> PolarAes -> Bool
$c/= :: PolarAes -> PolarAes -> Bool
/= :: PolarAes -> PolarAes -> Bool
Eq, Int -> PolarAes -> ShowS
[PolarAes] -> ShowS
PolarAes -> String
(Int -> PolarAes -> ShowS)
-> (PolarAes -> String) -> ([PolarAes] -> ShowS) -> Show PolarAes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PolarAes -> ShowS
showsPrec :: Int -> PolarAes -> ShowS
$cshow :: PolarAes -> String
show :: PolarAes -> String
$cshowList :: [PolarAes] -> ShowS
showList :: [PolarAes] -> ShowS
Show, ReadPrec [PolarAes]
ReadPrec PolarAes
Int -> ReadS PolarAes
ReadS [PolarAes]
(Int -> ReadS PolarAes)
-> ReadS [PolarAes]
-> ReadPrec PolarAes
-> ReadPrec [PolarAes]
-> Read PolarAes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS PolarAes
readsPrec :: Int -> ReadS PolarAes
$creadList :: ReadS [PolarAes]
readList :: ReadS [PolarAes]
$creadPrec :: ReadPrec PolarAes
readPrec :: ReadPrec PolarAes
$creadListPrec :: ReadPrec [PolarAes]
readListPrec :: ReadPrec [PolarAes]
Read)

data PolarDir = PolarCW | PolarCCW
    deriving (PolarDir -> PolarDir -> Bool
(PolarDir -> PolarDir -> Bool)
-> (PolarDir -> PolarDir -> Bool) -> Eq PolarDir
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PolarDir -> PolarDir -> Bool
== :: PolarDir -> PolarDir -> Bool
$c/= :: PolarDir -> PolarDir -> Bool
/= :: PolarDir -> PolarDir -> Bool
Eq, Int -> PolarDir -> ShowS
[PolarDir] -> ShowS
PolarDir -> String
(Int -> PolarDir -> ShowS)
-> (PolarDir -> String) -> ([PolarDir] -> ShowS) -> Show PolarDir
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PolarDir -> ShowS
showsPrec :: Int -> PolarDir -> ShowS
$cshow :: PolarDir -> String
show :: PolarDir -> String
$cshowList :: [PolarDir] -> ShowS
showList :: [PolarDir] -> ShowS
Show, ReadPrec [PolarDir]
ReadPrec PolarDir
Int -> ReadS PolarDir
ReadS [PolarDir]
(Int -> ReadS PolarDir)
-> ReadS [PolarDir]
-> ReadPrec PolarDir
-> ReadPrec [PolarDir]
-> Read PolarDir
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS PolarDir
readsPrec :: Int -> ReadS PolarDir
$creadList :: ReadS [PolarDir]
readList :: ReadS [PolarDir]
$creadPrec :: ReadPrec PolarDir
readPrec :: ReadPrec PolarDir
$creadListPrec :: ReadPrec [PolarDir]
readListPrec :: ReadPrec [PolarDir]
Read)

data Coord
    = CoordCartesian
    | CoordFlip
    | CoordPolar PolarAes Double PolarDir
    deriving (Coord -> Coord -> Bool
(Coord -> Coord -> Bool) -> (Coord -> Coord -> Bool) -> Eq Coord
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Coord -> Coord -> Bool
== :: Coord -> Coord -> Bool
$c/= :: Coord -> Coord -> Bool
/= :: Coord -> Coord -> Bool
Eq, Int -> Coord -> ShowS
[Coord] -> ShowS
Coord -> String
(Int -> Coord -> ShowS)
-> (Coord -> String) -> ([Coord] -> ShowS) -> Show Coord
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Coord -> ShowS
showsPrec :: Int -> Coord -> ShowS
$cshow :: Coord -> String
show :: Coord -> String
$cshowList :: [Coord] -> ShowS
showList :: [Coord] -> ShowS
Show, ReadPrec [Coord]
ReadPrec Coord
Int -> ReadS Coord
ReadS [Coord]
(Int -> ReadS Coord)
-> ReadS [Coord]
-> ReadPrec Coord
-> ReadPrec [Coord]
-> Read Coord
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Coord
readsPrec :: Int -> ReadS Coord
$creadList :: ReadS [Coord]
readList :: ReadS [Coord]
$creadPrec :: ReadPrec Coord
readPrec :: ReadPrec Coord
$creadListPrec :: ReadPrec [Coord]
readListPrec :: ReadPrec [Coord]
Read)

data FacetScales
    = ScalesFixed
    | ScalesFreeX
    | ScalesFreeY
    | ScalesFree
    deriving (FacetScales -> FacetScales -> Bool
(FacetScales -> FacetScales -> Bool)
-> (FacetScales -> FacetScales -> Bool) -> Eq FacetScales
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FacetScales -> FacetScales -> Bool
== :: FacetScales -> FacetScales -> Bool
$c/= :: FacetScales -> FacetScales -> Bool
/= :: FacetScales -> FacetScales -> Bool
Eq, Int -> FacetScales -> ShowS
[FacetScales] -> ShowS
FacetScales -> String
(Int -> FacetScales -> ShowS)
-> (FacetScales -> String)
-> ([FacetScales] -> ShowS)
-> Show FacetScales
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FacetScales -> ShowS
showsPrec :: Int -> FacetScales -> ShowS
$cshow :: FacetScales -> String
show :: FacetScales -> String
$cshowList :: [FacetScales] -> ShowS
showList :: [FacetScales] -> ShowS
Show, ReadPrec [FacetScales]
ReadPrec FacetScales
Int -> ReadS FacetScales
ReadS [FacetScales]
(Int -> ReadS FacetScales)
-> ReadS [FacetScales]
-> ReadPrec FacetScales
-> ReadPrec [FacetScales]
-> Read FacetScales
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS FacetScales
readsPrec :: Int -> ReadS FacetScales
$creadList :: ReadS [FacetScales]
readList :: ReadS [FacetScales]
$creadPrec :: ReadPrec FacetScales
readPrec :: ReadPrec FacetScales
$creadListPrec :: ReadPrec [FacetScales]
readListPrec :: ReadPrec [FacetScales]
Read)

data Facet
    = FacetNull
    | FacetWrap ColumnRef (Maybe Int) (Maybe Int) FacetScales
    | FacetGrid [ColumnRef] [ColumnRef] FacetScales
    deriving (Facet -> Facet -> Bool
(Facet -> Facet -> Bool) -> (Facet -> Facet -> Bool) -> Eq Facet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Facet -> Facet -> Bool
== :: Facet -> Facet -> Bool
$c/= :: Facet -> Facet -> Bool
/= :: Facet -> Facet -> Bool
Eq, Int -> Facet -> ShowS
[Facet] -> ShowS
Facet -> String
(Int -> Facet -> ShowS)
-> (Facet -> String) -> ([Facet] -> ShowS) -> Show Facet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Facet -> ShowS
showsPrec :: Int -> Facet -> ShowS
$cshow :: Facet -> String
show :: Facet -> String
$cshowList :: [Facet] -> ShowS
showList :: [Facet] -> ShowS
Show, ReadPrec [Facet]
ReadPrec Facet
Int -> ReadS Facet
ReadS [Facet]
(Int -> ReadS Facet)
-> ReadS [Facet]
-> ReadPrec Facet
-> ReadPrec [Facet]
-> Read Facet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Facet
readsPrec :: Int -> ReadS Facet
$creadList :: ReadS [Facet]
readList :: ReadS [Facet]
$creadPrec :: ReadPrec Facet
readPrec :: ReadPrec Facet
$creadListPrec :: ReadPrec [Facet]
readListPrec :: ReadPrec [Facet]
Read)

data Theme = Theme
    { Theme -> [ColorSpec]
themePalette :: [ColorSpec]
    , Theme -> [ColorSpec]
themePieColors :: [ColorSpec]
    , Theme -> ColorSpec
themeAxisColor :: ColorSpec
    , Theme -> ColorSpec
themeGridColor :: ColorSpec
    , Theme -> ColorSpec
themeTextColor :: ColorSpec
    , Theme -> ColorSpec
themeBackground :: ColorSpec
    , Theme -> Double
themeFontSize :: Double
    , Theme -> Double
themeTitleSize :: Double
    , Theme -> Double
themeStrokeWidth :: Double
    , Theme -> Double
themePxPerChar :: Double
    , Theme -> Double
themePxPerLine :: Double
    }
    deriving (Theme -> Theme -> Bool
(Theme -> Theme -> Bool) -> (Theme -> Theme -> Bool) -> Eq Theme
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Theme -> Theme -> Bool
== :: Theme -> Theme -> Bool
$c/= :: Theme -> Theme -> Bool
/= :: Theme -> Theme -> Bool
Eq, Int -> Theme -> ShowS
[Theme] -> ShowS
Theme -> String
(Int -> Theme -> ShowS)
-> (Theme -> String) -> ([Theme] -> ShowS) -> Show Theme
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Theme -> ShowS
showsPrec :: Int -> Theme -> ShowS
$cshow :: Theme -> String
show :: Theme -> String
$cshowList :: [Theme] -> ShowS
showList :: [Theme] -> ShowS
Show, ReadPrec [Theme]
ReadPrec Theme
Int -> ReadS Theme
ReadS [Theme]
(Int -> ReadS Theme)
-> ReadS [Theme]
-> ReadPrec Theme
-> ReadPrec [Theme]
-> Read Theme
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Theme
readsPrec :: Int -> ReadS Theme
$creadList :: ReadS [Theme]
readList :: ReadS [Theme]
$creadPrec :: ReadPrec Theme
readPrec :: ReadPrec Theme
$creadListPrec :: ReadPrec [Theme]
readListPrec :: ReadPrec [Theme]
Read)

defTheme :: Theme
defTheme :: Theme
defTheme =
    Theme
        { themePalette :: [ColorSpec]
themePalette =
            [ Color -> ColorSpec
NamedColor Color
BrightBlue
            , Color -> ColorSpec
NamedColor Color
BrightMagenta
            , Color -> ColorSpec
NamedColor Color
BrightCyan
            , Color -> ColorSpec
NamedColor Color
BrightGreen
            , Color -> ColorSpec
NamedColor Color
BrightYellow
            , Color -> ColorSpec
NamedColor Color
BrightRed
            , Color -> ColorSpec
NamedColor Color
BrightWhite
            , Color -> ColorSpec
NamedColor Color
BrightBlack
            ]
        , themePieColors :: [ColorSpec]
themePieColors =
            [ Color -> ColorSpec
NamedColor Color
BrightRed
            , Color -> ColorSpec
NamedColor Color
BrightGreen
            , Color -> ColorSpec
NamedColor Color
BrightYellow
            , Color -> ColorSpec
NamedColor Color
BrightBlue
            , Color -> ColorSpec
NamedColor Color
BrightMagenta
            , Color -> ColorSpec
NamedColor Color
BrightCyan
            , Color -> ColorSpec
NamedColor Color
BrightWhite
            , Color -> ColorSpec
NamedColor Color
BrightBlack
            ]
        , themeAxisColor :: ColorSpec
themeAxisColor = Text -> ColorSpec
Hex Text
"#aaaaaa"
        , themeGridColor :: ColorSpec
themeGridColor = Text -> ColorSpec
Hex Text
"#eeeeee"
        , themeTextColor :: ColorSpec
themeTextColor = Text -> ColorSpec
Hex Text
"#555555"
        , themeBackground :: ColorSpec
themeBackground = Text -> ColorSpec
Hex Text
"#ffffff"
        , themeFontSize :: Double
themeFontSize = Double
11
        , themeTitleSize :: Double
themeTitleSize = Double
14
        , themeStrokeWidth :: Double
themeStrokeWidth = Double
1
        , themePxPerChar :: Double
themePxPerChar = Double
10
        , themePxPerLine :: Double
themePxPerLine = Double
16
        }

data Size
    = SizeChars Int Int
    | SizePixels Int Int
    | SizeResponsive Double
    deriving (Size -> Size -> Bool
(Size -> Size -> Bool) -> (Size -> Size -> Bool) -> Eq Size
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Size -> Size -> Bool
== :: Size -> Size -> Bool
$c/= :: Size -> Size -> Bool
/= :: Size -> Size -> Bool
Eq, Int -> Size -> ShowS
[Size] -> ShowS
Size -> String
(Int -> Size -> ShowS)
-> (Size -> String) -> ([Size] -> ShowS) -> Show Size
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Size -> ShowS
showsPrec :: Int -> Size -> ShowS
$cshow :: Size -> String
show :: Size -> String
$cshowList :: [Size] -> ShowS
showList :: [Size] -> ShowS
Show, ReadPrec [Size]
ReadPrec Size
Int -> ReadS Size
ReadS [Size]
(Int -> ReadS Size)
-> ReadS [Size] -> ReadPrec Size -> ReadPrec [Size] -> Read Size
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Size
readsPrec :: Int -> ReadS Size
$creadList :: ReadS [Size]
readList :: ReadS [Size]
$creadPrec :: ReadPrec Size
readPrec :: ReadPrec Size
$creadListPrec :: ReadPrec [Size]
readListPrec :: ReadPrec [Size]
Read)

data Chart = Chart
    { Chart -> DataFrame
chartData :: DataFrame
    , Chart -> [Layer]
chartLayers :: [Layer]
    , Chart -> Scales
chartScales :: Scales
    , Chart -> Coord
chartCoord :: Coord
    , Chart -> Facet
chartFacet :: Facet
    , Chart -> Theme
chartTheme :: Theme
    , Chart -> Maybe Text
chartTitle :: Maybe Text
    , Chart -> Size
chartSize :: Size
    }
    deriving (Chart -> Chart -> Bool
(Chart -> Chart -> Bool) -> (Chart -> Chart -> Bool) -> Eq Chart
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Chart -> Chart -> Bool
== :: Chart -> Chart -> Bool
$c/= :: Chart -> Chart -> Bool
/= :: Chart -> Chart -> Bool
Eq, Int -> Chart -> ShowS
[Chart] -> ShowS
Chart -> String
(Int -> Chart -> ShowS)
-> (Chart -> String) -> ([Chart] -> ShowS) -> Show Chart
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Chart -> ShowS
showsPrec :: Int -> Chart -> ShowS
$cshow :: Chart -> String
show :: Chart -> String
$cshowList :: [Chart] -> ShowS
showList :: [Chart] -> ShowS
Show, ReadPrec [Chart]
ReadPrec Chart
Int -> ReadS Chart
ReadS [Chart]
(Int -> ReadS Chart)
-> ReadS [Chart]
-> ReadPrec Chart
-> ReadPrec [Chart]
-> Read Chart
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Chart
readsPrec :: Int -> ReadS Chart
$creadList :: ReadS [Chart]
readList :: ReadS [Chart]
$creadPrec :: ReadPrec Chart
readPrec :: ReadPrec Chart
$creadListPrec :: ReadPrec [Chart]
readListPrec :: ReadPrec [Chart]
Read)

emptyChart :: Chart
emptyChart :: Chart
emptyChart =
    Chart
        { chartData :: DataFrame
chartData = DataFrame
emptyFrame
        , chartLayers :: [Layer]
chartLayers = []
        , chartScales :: Scales
chartScales = Scales
defScales
        , chartCoord :: Coord
chartCoord = Coord
CoordCartesian
        , chartFacet :: Facet
chartFacet = Facet
FacetNull
        , chartTheme :: Theme
chartTheme = Theme
defTheme
        , chartTitle :: Maybe Text
chartTitle = Maybe Text
forall a. Maybe a
Nothing
        , chartSize :: Size
chartSize = Int -> Int -> Size
SizeChars Int
60 Int
20
        }