{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module Graphics.Vega.VegaLite.Configuration
( ConfigurationProperty(..)
, FieldTitleProperty(..)
, ViewConfig(..)
, CompositionConfig(..)
, ScaleConfig(..)
, RangeConfig(..)
, AxisConfig(..)
, AxisChoice(..)
, LegendConfig(..)
, TitleConfig(..)
, TitleFrame(..)
, configuration
, title
) where
import qualified Data.Aeson as A
import qualified Data.Text as T
import Data.Aeson ((.=), object)
#if !(MIN_VERSION_base(4, 12, 0))
import Data.Monoid ((<>))
#endif
import Graphics.Vega.VegaLite.Core
( AxisProperty
, axisProperty
, schemeProperty
)
import Graphics.Vega.VegaLite.Foundation
( Angle
, Color
, StyleLabel
, CompositionAlignment
, DashStyle
, DashOffset
, APosition
, FontWeight
, Opacity
, Orientation
, OverlapStrategy
, Side
, StrokeCap
, StrokeJoin
, Symbol
, HAlign
, VAlign
, BandAlign
, Padding
, Autosize
, ZIndex
, HeaderProperty
, ViewBackground
, Cursor
, fromT
, fromColor
, fromDS
, splitOnNewline
, header_
, anchorLabel
, fontWeightSpec
, orientationSpec
, hAlignLabel
, vAlignLabel
, bandAlignLabel
, strokeCapLabel
, strokeJoinLabel
, sideLabel
, overlapStrategyLabel
, symbolLabel
, compositionAlignmentSpec
, paddingSpec
, autosizeProperty
, viewBackgroundSpec
, cursorLabel
)
import Graphics.Vega.VegaLite.Geometry
( ProjectionProperty
, projectionProperty
)
import Graphics.Vega.VegaLite.Legend
( LegendLayout
, LegendOrientation
, legendOrientLabel
, legendLayoutSpec
)
import Graphics.Vega.VegaLite.Mark
( MarkProperty
, mprops_
)
import Graphics.Vega.VegaLite.Scale
( ScaleNice
, scaleNiceSpec
)
import Graphics.Vega.VegaLite.Selection
( Selection
, SelectionProperty
, selectionProperties
, selectionLabel
)
import Graphics.Vega.VegaLite.Specification
( VLSpec
, VLProperty(VLTitle)
, ConfigureSpec(..)
, BuildConfigureSpecs
, LabelledSpec
, PropertySpec
)
{-# DEPRECATED Autosize "Please change Autosize to AutosizeStyle" #-}
{-# DEPRECATED Background "Please change Background to BackgroundStyle" #-}
{-# DEPRECATED CountTitle "Please change CountTitle to CountTitleStyle" #-}
{-# DEPRECATED FieldTitle "Please change FieldTitle to FieldTitleStyle" #-}
{-# DEPRECATED Legend "Please change Legend to LegendStyle" #-}
{-# DEPRECATED NumberFormat "Please change NumberFormat to NumberFormatStyle" #-}
{-# DEPRECATED Padding "Please change Padding to PaddingStyle" #-}
{-# DEPRECATED Projection "Please change Projection to ProjectionStyle" #-}
{-# DEPRECATED Range "Please change Range to RangeStyle" #-}
{-# DEPRECATED Scale "Please change Scale to ScaleStyle" #-}
{-# DEPRECATED TimeFormat "Please change TimeFormat to TimeFormatStyle" #-}
{-# DEPRECATED View "Please change View to ViewStyle" #-}
{-# DEPRECATED NamedStyle "Please change Legend to MarkNamedStyles" #-}
{-# DEPRECATED NamedStyles "Please change Legend to MarkNamedStyles" #-}
data ConfigurationProperty
= ArcStyle [MarkProperty]
| AreaStyle [MarkProperty]
| AriaStyle Bool
| AutosizeStyle [Autosize]
| Axis [AxisConfig]
| AxisBand AxisChoice [AxisConfig]
| AxisBottom [AxisConfig]
| AxisDiscrete AxisChoice [AxisConfig]
| AxisLeft [AxisConfig]
| AxisPoint AxisChoice [AxisConfig]
| AxisQuantitative AxisChoice [AxisConfig]
| AxisRight [AxisConfig]
| AxisTemporal AxisChoice [AxisConfig]
| AxisTop [AxisConfig]
| AxisX [AxisConfig]
| AxisY [AxisConfig]
| AxisNamedStyles [(StyleLabel, [AxisProperty])]
| BackgroundStyle Color
| BarStyle [MarkProperty]
| BoxplotStyle [MarkProperty]
| CircleStyle [MarkProperty]
| ConcatStyle [CompositionConfig]
| CountTitleStyle T.Text
| CustomFormatStyle Bool
| ErrorBandStyle [MarkProperty]
| ErrorBarStyle [MarkProperty]
| FacetStyle [CompositionConfig]
| FieldTitleStyle FieldTitleProperty
| FontStyle T.Text
| GeoshapeStyle [MarkProperty]
| [HeaderProperty]
| HeaderColumnStyle [HeaderProperty]
| [HeaderProperty]
| [HeaderProperty]
| ImageStyle [MarkProperty]
| LegendStyle [LegendConfig]
| LineStyle [MarkProperty]
| LineBreakStyle T.Text
| MarkStyle [MarkProperty]
| MarkNamedStyles [(StyleLabel, [MarkProperty])]
| NumberFormatStyle T.Text
| PaddingStyle Padding
| PointStyle [MarkProperty]
| ProjectionStyle [ProjectionProperty]
| RangeStyle [RangeConfig]
| RectStyle [MarkProperty]
| RepeatStyle [CompositionConfig]
| RuleStyle [MarkProperty]
| ScaleStyle [ScaleConfig]
| SelectionStyle [(Selection, [SelectionProperty])]
| SquareStyle [MarkProperty]
| TextStyle [MarkProperty]
| TickStyle [MarkProperty]
| TimeFormatStyle T.Text
| TitleStyle [TitleConfig]
| TrailStyle [MarkProperty]
| ViewStyle [ViewConfig]
| Autosize [Autosize]
| Background Color
| CountTitle T.Text
| FieldTitle FieldTitleProperty
| Legend [LegendConfig]
| NumberFormat T.Text
| Padding Padding
| Projection [ProjectionProperty]
| Range [RangeConfig]
| Scale [ScaleConfig]
| TimeFormat T.Text
| View [ViewConfig]
| NamedStyle StyleLabel [MarkProperty]
| NamedStyles [(StyleLabel, [MarkProperty])]
data AxisChoice
= AxXY
| AxX
| AxY
toAxis :: T.Text -> [AxisConfig] -> LabelledSpec
toAxis :: Text -> [AxisConfig] -> LabelledSpec
toAxis Text
lbl [AxisConfig]
acs = (Text
"axis" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
lbl) Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((AxisConfig -> LabelledSpec) -> [AxisConfig] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map AxisConfig -> LabelledSpec
axisConfigProperty [AxisConfig]
acs)
toAxisChoice :: AxisChoice -> T.Text -> [AxisConfig] -> LabelledSpec
toAxisChoice :: AxisChoice -> Text -> [AxisConfig] -> LabelledSpec
toAxisChoice AxisChoice
AxXY Text
lbl = Text -> [AxisConfig] -> LabelledSpec
toAxis Text
lbl
toAxisChoice AxisChoice
AxX Text
lbl = Text -> [AxisConfig] -> LabelledSpec
toAxis (Text
"X" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
lbl)
toAxisChoice AxisChoice
AxY Text
lbl = Text -> [AxisConfig] -> LabelledSpec
toAxis (Text
"Y" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
lbl)
aprops_ :: T.Text -> [AxisProperty] -> LabelledSpec
aprops_ :: Text -> [AxisProperty] -> LabelledSpec
aprops_ Text
f [AxisProperty]
mps = Text
f Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((AxisProperty -> LabelledSpec) -> [AxisProperty] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map AxisProperty -> LabelledSpec
axisProperty [AxisProperty]
mps)
configProperty :: ConfigurationProperty -> LabelledSpec
configProperty :: ConfigurationProperty -> LabelledSpec
configProperty (ArcStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"arc" [MarkProperty]
mps
configProperty (AreaStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"area" [MarkProperty]
mps
configProperty (AriaStyle Bool
b) = Text
"aria" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
configProperty (AutosizeStyle [Autosize]
aus) = Text
"autosize" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((Autosize -> LabelledSpec) -> [Autosize] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map Autosize -> LabelledSpec
autosizeProperty [Autosize]
aus)
configProperty (Axis [AxisConfig]
acs) = Text -> [AxisConfig] -> LabelledSpec
toAxis Text
"" [AxisConfig]
acs
configProperty (AxisBand AxisChoice
c [AxisConfig]
acs) = AxisChoice -> Text -> [AxisConfig] -> LabelledSpec
toAxisChoice AxisChoice
c Text
"Band" [AxisConfig]
acs
configProperty (AxisBottom [AxisConfig]
acs) = Text -> [AxisConfig] -> LabelledSpec
toAxis Text
"Bottom" [AxisConfig]
acs
configProperty (AxisDiscrete AxisChoice
c [AxisConfig]
acs) = AxisChoice -> Text -> [AxisConfig] -> LabelledSpec
toAxisChoice AxisChoice
c Text
"Discrete" [AxisConfig]
acs
configProperty (AxisLeft [AxisConfig]
acs) = Text -> [AxisConfig] -> LabelledSpec
toAxis Text
"Left" [AxisConfig]
acs
configProperty (AxisPoint AxisChoice
c [AxisConfig]
acs) = AxisChoice -> Text -> [AxisConfig] -> LabelledSpec
toAxisChoice AxisChoice
c Text
"Point" [AxisConfig]
acs
configProperty (AxisQuantitative AxisChoice
c [AxisConfig]
acs) = AxisChoice -> Text -> [AxisConfig] -> LabelledSpec
toAxisChoice AxisChoice
c Text
"Quantitative" [AxisConfig]
acs
configProperty (AxisRight [AxisConfig]
acs) = Text -> [AxisConfig] -> LabelledSpec
toAxis Text
"Right" [AxisConfig]
acs
configProperty (AxisTemporal AxisChoice
c [AxisConfig]
acs) = AxisChoice -> Text -> [AxisConfig] -> LabelledSpec
toAxisChoice AxisChoice
c Text
"Temporal" [AxisConfig]
acs
configProperty (AxisTop [AxisConfig]
acs) = Text -> [AxisConfig] -> LabelledSpec
toAxis Text
"Top" [AxisConfig]
acs
configProperty (AxisX [AxisConfig]
acs) = Text -> [AxisConfig] -> LabelledSpec
toAxis Text
"X" [AxisConfig]
acs
configProperty (AxisY [AxisConfig]
acs) = Text -> [AxisConfig] -> LabelledSpec
toAxis Text
"Y" [AxisConfig]
acs
configProperty (AxisNamedStyles [(Text, [AxisProperty])]
styles) =
let toStyle :: (Text, [AxisProperty]) -> LabelledSpec
toStyle = (Text -> [AxisProperty] -> LabelledSpec)
-> (Text, [AxisProperty]) -> LabelledSpec
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Text -> [AxisProperty] -> LabelledSpec
aprops_
in Text
"style" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object (((Text, [AxisProperty]) -> LabelledSpec)
-> [(Text, [AxisProperty])] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map (Text, [AxisProperty]) -> LabelledSpec
toStyle [(Text, [AxisProperty])]
styles)
configProperty (BackgroundStyle Text
bg) = Text
"background" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
bg
configProperty (BarStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"bar" [MarkProperty]
mps
configProperty (BoxplotStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"boxplot" [MarkProperty]
mps
configProperty (CircleStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"circle" [MarkProperty]
mps
configProperty (ConcatStyle [CompositionConfig]
cps) = Text
"concat" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((CompositionConfig -> LabelledSpec)
-> [CompositionConfig] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map CompositionConfig -> LabelledSpec
compConfigProperty [CompositionConfig]
cps)
configProperty (CountTitleStyle Text
ttl) = Text
"countTitle" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
ttl
configProperty (CustomFormatStyle Bool
b) = Text
"customFormatTypes" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
configProperty (ErrorBandStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"errorband" [MarkProperty]
mps
configProperty (ErrorBarStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"errorbar" [MarkProperty]
mps
configProperty (FacetStyle [CompositionConfig]
cps) = Text
"facet" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((CompositionConfig -> LabelledSpec)
-> [CompositionConfig] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map CompositionConfig -> LabelledSpec
compConfigProperty [CompositionConfig]
cps)
configProperty (FieldTitleStyle FieldTitleProperty
ftp) = Text
"fieldTitle" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= FieldTitleProperty -> Text
fieldTitleLabel FieldTitleProperty
ftp
configProperty (FontStyle Text
font) = Text
"font" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
font
configProperty (GeoshapeStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"geoshape" [MarkProperty]
mps
configProperty (HeaderStyle [HeaderProperty]
hps) = Text -> [HeaderProperty] -> LabelledSpec
header_ Text
"" [HeaderProperty]
hps
configProperty (HeaderColumnStyle [HeaderProperty]
hps) = Text -> [HeaderProperty] -> LabelledSpec
header_ Text
"Column" [HeaderProperty]
hps
configProperty (HeaderFacetStyle [HeaderProperty]
hps) = Text -> [HeaderProperty] -> LabelledSpec
header_ Text
"Facet" [HeaderProperty]
hps
configProperty (HeaderRowStyle [HeaderProperty]
hps) = Text -> [HeaderProperty] -> LabelledSpec
header_ Text
"Row" [HeaderProperty]
hps
configProperty (ImageStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"image" [MarkProperty]
mps
configProperty (LegendStyle [LegendConfig]
lcs) = Text
"legend" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((LegendConfig -> LabelledSpec) -> [LegendConfig] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map LegendConfig -> LabelledSpec
legendConfigProperty [LegendConfig]
lcs)
configProperty (LineStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"line" [MarkProperty]
mps
configProperty (LineBreakStyle Text
s) = Text
"lineBreak" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s
configProperty (MarkStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"mark" [MarkProperty]
mps
configProperty (MarkNamedStyles [(Text, [MarkProperty])]
styles) =
let toStyle :: (Text, [MarkProperty]) -> LabelledSpec
toStyle = (Text -> [MarkProperty] -> LabelledSpec)
-> (Text, [MarkProperty]) -> LabelledSpec
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Text -> [MarkProperty] -> LabelledSpec
mprops_
in Text
"style" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object (((Text, [MarkProperty]) -> LabelledSpec)
-> [(Text, [MarkProperty])] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map (Text, [MarkProperty]) -> LabelledSpec
toStyle [(Text, [MarkProperty])]
styles)
configProperty (NumberFormatStyle Text
fmt) = Text
"numberFormat" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fmt
configProperty (PaddingStyle Padding
pad) = Text
"padding" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Padding -> Value
paddingSpec Padding
pad
configProperty (PointStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"point" [MarkProperty]
mps
configProperty (ProjectionStyle [ProjectionProperty]
pps) = Text
"projection" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((ProjectionProperty -> LabelledSpec)
-> [ProjectionProperty] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map ProjectionProperty -> LabelledSpec
projectionProperty [ProjectionProperty]
pps)
configProperty (RangeStyle [RangeConfig]
rcs) = Text
"range" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((RangeConfig -> LabelledSpec) -> [RangeConfig] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map RangeConfig -> LabelledSpec
rangeConfigProperty [RangeConfig]
rcs)
configProperty (RectStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"rect" [MarkProperty]
mps
configProperty (RepeatStyle [CompositionConfig]
cps) = Text
"repeat" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((CompositionConfig -> LabelledSpec)
-> [CompositionConfig] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map CompositionConfig -> LabelledSpec
compConfigProperty [CompositionConfig]
cps)
configProperty (RuleStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"rule" [MarkProperty]
mps
configProperty (ScaleStyle [ScaleConfig]
scs) = [ScaleConfig] -> LabelledSpec
scaleConfig_ [ScaleConfig]
scs
configProperty (SelectionStyle [(Selection, [SelectionProperty])]
selConfig) =
let selProp :: (Selection, t SelectionProperty) -> kv
selProp (Selection
sel, t SelectionProperty
sps) = Selection -> Text
selectionLabel Selection
sel Text -> Value -> kv
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((SelectionProperty -> [LabelledSpec])
-> t SelectionProperty -> [LabelledSpec]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap SelectionProperty -> [LabelledSpec]
selectionProperties t SelectionProperty
sps)
in Text
"selection" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object (((Selection, [SelectionProperty]) -> LabelledSpec)
-> [(Selection, [SelectionProperty])] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map (Selection, [SelectionProperty]) -> LabelledSpec
forall kv (t :: * -> *).
(KeyValue kv, Foldable t) =>
(Selection, t SelectionProperty) -> kv
selProp [(Selection, [SelectionProperty])]
selConfig)
configProperty (SquareStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"square" [MarkProperty]
mps
configProperty (TextStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"text" [MarkProperty]
mps
configProperty (TickStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"tick" [MarkProperty]
mps
configProperty (TimeFormatStyle Text
fmt) = Text
"timeFormat" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fmt
configProperty (TitleStyle [TitleConfig]
tcs) = Text
"title" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((TitleConfig -> LabelledSpec) -> [TitleConfig] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map TitleConfig -> LabelledSpec
titleConfigSpec [TitleConfig]
tcs)
configProperty (TrailStyle [MarkProperty]
mps) = Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
"trail" [MarkProperty]
mps
configProperty (ViewStyle [ViewConfig]
vcs) = Text
"view" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((ViewConfig -> [LabelledSpec]) -> [ViewConfig] -> [LabelledSpec]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap ViewConfig -> [LabelledSpec]
viewConfigProperties [ViewConfig]
vcs)
configProperty (Autosize [Autosize]
aus) = Text
"autosize" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((Autosize -> LabelledSpec) -> [Autosize] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map Autosize -> LabelledSpec
autosizeProperty [Autosize]
aus)
configProperty (Background Text
bg) = Text
"background" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
bg
configProperty (CountTitle Text
ttl) = Text
"countTitle" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
ttl
configProperty (FieldTitle FieldTitleProperty
ftp) = Text
"fieldTitle" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= FieldTitleProperty -> Text
fieldTitleLabel FieldTitleProperty
ftp
configProperty (Legend [LegendConfig]
lcs) = Text
"legend" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((LegendConfig -> LabelledSpec) -> [LegendConfig] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map LegendConfig -> LabelledSpec
legendConfigProperty [LegendConfig]
lcs)
configProperty (NumberFormat Text
fmt) = Text
"numberFormat" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fmt
configProperty (Padding Padding
pad) = Text
"padding" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Padding -> Value
paddingSpec Padding
pad
configProperty (Projection [ProjectionProperty]
pps) = Text
"projection" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((ProjectionProperty -> LabelledSpec)
-> [ProjectionProperty] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map ProjectionProperty -> LabelledSpec
projectionProperty [ProjectionProperty]
pps)
configProperty (Range [RangeConfig]
rcs) = Text
"range" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((RangeConfig -> LabelledSpec) -> [RangeConfig] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map RangeConfig -> LabelledSpec
rangeConfigProperty [RangeConfig]
rcs)
configProperty (Scale [ScaleConfig]
scs) = [ScaleConfig] -> LabelledSpec
scaleConfig_ [ScaleConfig]
scs
configProperty (TimeFormat Text
fmt) = Text
"timeFormat" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fmt
configProperty (View [ViewConfig]
vcs) = Text
"view" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((ViewConfig -> [LabelledSpec]) -> [ViewConfig] -> [LabelledSpec]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap ViewConfig -> [LabelledSpec]
viewConfigProperties [ViewConfig]
vcs)
configProperty (NamedStyle Text
nme [MarkProperty]
mps) = Text
"style" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object [Text -> [MarkProperty] -> LabelledSpec
mprops_ Text
nme [MarkProperty]
mps]
configProperty (NamedStyles [(Text, [MarkProperty])]
styles) =
let toStyle :: (Text, [MarkProperty]) -> LabelledSpec
toStyle = (Text -> [MarkProperty] -> LabelledSpec)
-> (Text, [MarkProperty]) -> LabelledSpec
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Text -> [MarkProperty] -> LabelledSpec
mprops_
in Text
"style" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object (((Text, [MarkProperty]) -> LabelledSpec)
-> [(Text, [MarkProperty])] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map (Text, [MarkProperty]) -> LabelledSpec
toStyle [(Text, [MarkProperty])]
styles)
data ScaleConfig
= SCBandPaddingInner Double
| SCBandPaddingOuter Double
| SCBarBandPaddingInner Double
| SCBarBandPaddingOuter Double
| SCRectBandPaddingInner Double
| SCRectBandPaddingOuter Double
| SCClamp Bool
| SCMaxBandSize Double
| SCMinBandSize Double
| SCMaxFontSize Double
| SCMinFontSize Double
| SCMaxOpacity Opacity
| SCMinOpacity Opacity
| SCMaxSize Double
| SCMinSize Double
| SCMaxStrokeWidth Double
| SCMinStrokeWidth Double
| SCPointPadding Double
| SCRound Bool
| SCUseUnaggregatedDomain Bool
| SCXReverse Bool
scaleConfig_ :: [ScaleConfig] -> LabelledSpec
scaleConfig_ :: [ScaleConfig] -> LabelledSpec
scaleConfig_ [ScaleConfig]
scs = Text
"scale" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((ScaleConfig -> LabelledSpec) -> [ScaleConfig] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map ScaleConfig -> LabelledSpec
scaleConfigProperty [ScaleConfig]
scs)
data FieldTitleProperty
= Verbal
| Function
| Plain
fieldTitleLabel :: FieldTitleProperty -> T.Text
fieldTitleLabel :: FieldTitleProperty -> Text
fieldTitleLabel FieldTitleProperty
Verbal = Text
"verbal"
fieldTitleLabel FieldTitleProperty
Function = Text
"functional"
fieldTitleLabel FieldTitleProperty
Plain = Text
"plain"
data LegendConfig
= LeAria Bool
| LeAriaDescription T.Text
| LeClipHeight Double
| LeColumnPadding Double
| LeColumns Int
| LeCornerRadius Double
| LeDirection Orientation
| LeDisable Bool
| LeFillColor Color
| LeGradientDirection Orientation
| LeGradientHorizontalMaxLength Double
| LeGradientHorizontalMinLength Double
| LeGradientLabelLimit Double
| LeGradientLabelOffset Double
| LeGradientLength Double
| LeGradientOpacity Opacity
| LeGradientStrokeColor Color
| LeGradientStrokeWidth Double
| LeGradientThickness Double
| LeGradientVerticalMaxLength Double
| LeGradientVerticalMinLength Double
| LeGridAlign CompositionAlignment
| LeLabelAlign HAlign
| LeLabelBaseline VAlign
| LeLabelColor Color
| LeLabelFont T.Text
| LeLabelFontSize Double
| LeLabelFontStyle T.Text
| LeLabelFontWeight FontWeight
| LeLabelLimit Double
| LeLabelOffset Double
| LeLabelOpacity Opacity
| LeLabelOverlap OverlapStrategy
| LeLabelPadding Double
| LeLabelSeparation Double
| LeLayout [LegendLayout]
| LeLeX Double
| LeLeY Double
| LeOffset Double
| LeOrient LegendOrientation
| LePadding Double
| LeRowPadding Double
| LeStrokeColor Color
| LeStrokeDash DashStyle
| LeStrokeWidth Double
| LeSymbolBaseFillColor Color
| LeSymbolBaseStrokeColor Color
| LeSymbolDash DashStyle
| LeSymbolDashOffset DashOffset
| LeSymbolDirection Orientation
| LeSymbolFillColor Color
| LeSymbolLimit Int
| LeSymbolOffset Double
| LeSymbolOpacity Opacity
| LeSymbolSize Double
| LeSymbolStrokeColor Color
| LeSymbolStrokeWidth Double
| LeSymbolType Symbol
| LeTickCount Int
| LeTickCountTime ScaleNice
| LeNoTitle
| LeTitleAlign HAlign
| LeTitleAnchor APosition
| LeTitleBaseline VAlign
| LeTitleColor Color
| LeTitleFont T.Text
| LeTitleFontSize Double
| LeTitleFontStyle T.Text
| LeTitleFontWeight FontWeight
| LeTitleLimit Double
| LeTitleLineHeight Double
| LeTitleOpacity Opacity
| LeTitleOrient Side
| LeTitlePadding Double
| LeUnselectedOpacity Opacity
| LeZIndex ZIndex
legendConfigProperty :: LegendConfig -> LabelledSpec
legendConfigProperty :: LegendConfig -> LabelledSpec
legendConfigProperty (LeAria Bool
b) = Text
"bool" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
legendConfigProperty (LeAriaDescription Text
t) = Text
"description" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
t
legendConfigProperty (LeClipHeight Double
x) = Text
"clipHeight" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeColumnPadding Double
x) = Text
"columnPadding" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeColumns Int
n) = Text
"columns" Text -> Int -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int
n
legendConfigProperty (LeCornerRadius Double
x) = Text
"cornerRadius" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeDirection Orientation
o) = Text
"direction" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Orientation -> Value
orientationSpec Orientation
o
legendConfigProperty (LeDisable Bool
b) = Text
"disable" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
legendConfigProperty (LeFillColor Text
s) = Text
"fillColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
s
legendConfigProperty (LeGradientDirection Orientation
o) = Text
"gradientDirection" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Orientation -> Value
orientationSpec Orientation
o
legendConfigProperty (LeGradientHorizontalMaxLength Double
x) = Text
"gradientHorizontalMaxLength" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeGradientHorizontalMinLength Double
x) = Text
"gradientHorizontalMinLength" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeGradientLabelLimit Double
x) = Text
"gradientLabelLimit" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeGradientLabelOffset Double
x) = Text
"gradientLabelOffset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeGradientLength Double
x) = Text
"gradientLength" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeGradientOpacity Double
x) = Text
"gradientOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeGradientStrokeColor Text
s) = Text
"gradientStrokeColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
s
legendConfigProperty (LeGradientStrokeWidth Double
x) = Text
"gradientStrokeWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeGradientThickness Double
x) = Text
"gradientThickness" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeGradientVerticalMaxLength Double
x) = Text
"gradientVerticalMaxLength" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeGradientVerticalMinLength Double
x) = Text
"gradientVerticalMinLength" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeGridAlign CompositionAlignment
ga) = Text
"gridAlign" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= CompositionAlignment -> Value
compositionAlignmentSpec CompositionAlignment
ga
legendConfigProperty (LeLabelAlign HAlign
ha) = Text
"labelAlign" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= HAlign -> Text
hAlignLabel HAlign
ha
legendConfigProperty (LeLabelBaseline VAlign
va) = Text
"labelBaseline" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= VAlign -> Text
vAlignLabel VAlign
va
legendConfigProperty (LeLabelColor Text
s) = Text
"labelColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
s
legendConfigProperty (LeLabelFont Text
s) = Text
"labelFont" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s
legendConfigProperty (LeLabelFontSize Double
x) = Text
"labelFontSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeLabelFontStyle Text
s) = Text
"labelFontStyle" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s
legendConfigProperty (LeLabelFontWeight FontWeight
fw) = Text
"labelFontWeight" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= FontWeight -> Value
fontWeightSpec FontWeight
fw
legendConfigProperty (LeLabelLimit Double
x) = Text
"labelLimit" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeLabelOffset Double
x) = Text
"labelOffset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeLabelOpacity Double
x) = Text
"labelOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeLabelOverlap OverlapStrategy
olap) = Text
"labelOverlap" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= OverlapStrategy -> Value
overlapStrategyLabel OverlapStrategy
olap
legendConfigProperty (LeLabelPadding Double
x) = Text
"labelPadding" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeLabelSeparation Double
x) = Text
"labelSeparation" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeLayout [LegendLayout]
ll) = Text
"layout" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object ((LegendLayout -> LabelledSpec) -> [LegendLayout] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map LegendLayout -> LabelledSpec
legendLayoutSpec [LegendLayout]
ll)
legendConfigProperty (LeLeX Double
x) = Text
"legendX" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeLeY Double
x) = Text
"legendY" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeOffset Double
x) = Text
"offset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeOrient LegendOrientation
orl) = Text
"orient" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= LegendOrientation -> Text
legendOrientLabel LegendOrientation
orl
legendConfigProperty (LePadding Double
x) = Text
"padding" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeRowPadding Double
x) = Text
"rowPadding" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeStrokeColor Text
s) = Text
"strokeColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
s
legendConfigProperty (LeStrokeDash DashStyle
xs) = Text
"strokeDash" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= DashStyle -> Value
fromDS DashStyle
xs
legendConfigProperty (LeStrokeWidth Double
x) = Text
"strokeWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeSymbolBaseFillColor Text
s) = Text
"symbolBaseFillColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
s
legendConfigProperty (LeSymbolBaseStrokeColor Text
s) = Text
"symbolBaseStrokeColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
s
legendConfigProperty (LeSymbolDash DashStyle
xs) = Text
"symbolDash" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= DashStyle -> Value
fromDS DashStyle
xs
legendConfigProperty (LeSymbolDashOffset Double
x) = Text
"symbolDashOffset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeSymbolDirection Orientation
o) = Text
"symbolDirection" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Orientation -> Value
orientationSpec Orientation
o
legendConfigProperty (LeSymbolFillColor Text
s) = Text
"symbolFillColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
s
legendConfigProperty (LeSymbolLimit Int
n) = Text
"symbolLimit" Text -> Int -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int
n
legendConfigProperty (LeSymbolOffset Double
x) = Text
"symbolOffset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeSymbolOpacity Double
x) = Text
"symbolOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeSymbolSize Double
x) = Text
"symbolSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeSymbolStrokeColor Text
s) = Text
"symbolStrokeColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
s
legendConfigProperty (LeSymbolStrokeWidth Double
x) = Text
"symbolStrokeWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeSymbolType Symbol
s) = Text
"symbolType" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Symbol -> Text
symbolLabel Symbol
s
legendConfigProperty (LeTickCount Int
n) = Text
"tickCount" Text -> Int -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int
n
legendConfigProperty (LeTickCountTime ScaleNice
sn) = Text
"tickCount" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= ScaleNice -> Value
scaleNiceSpec ScaleNice
sn
legendConfigProperty LegendConfig
LeNoTitle = Text
"title" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Value
A.Null
legendConfigProperty (LeTitleAlign HAlign
ha) = Text
"titleAlign" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= HAlign -> Text
hAlignLabel HAlign
ha
legendConfigProperty (LeTitleAnchor APosition
anc) = Text
"titleAnchor" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= APosition -> Text
anchorLabel APosition
anc
legendConfigProperty (LeTitleBaseline VAlign
va) = Text
"titleBaseline" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= VAlign -> Text
vAlignLabel VAlign
va
legendConfigProperty (LeTitleColor Text
s) = Text
"titleColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
s
legendConfigProperty (LeTitleFont Text
s) = Text
"titleFont" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s
legendConfigProperty (LeTitleFontSize Double
x) = Text
"titleFontSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeTitleFontStyle Text
s) = Text
"titleFontStyle" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s
legendConfigProperty (LeTitleFontWeight FontWeight
fw) = Text
"titleFontWeight" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= FontWeight -> Value
fontWeightSpec FontWeight
fw
legendConfigProperty (LeTitleLimit Double
x) = Text
"titleLimit" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeTitleLineHeight Double
x) = Text
"titleLineHeight" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeTitleOpacity Double
x) = Text
"titleOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeTitleOrient Side
orient) = Text
"titleOrient" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Side -> Text
sideLabel Side
orient
legendConfigProperty (LeTitlePadding Double
x) = Text
"titlePadding" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeUnselectedOpacity Double
x) = Text
"unselectedOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
legendConfigProperty (LeZIndex ZIndex
z) = Text
"zindex" Text -> ZIndex -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= ZIndex
z
data RangeConfig
= RCategory T.Text
| RDiverging T.Text
| RHeatmap T.Text
| ROrdinal T.Text
| RRamp T.Text
| RSymbol T.Text
rangeConfigProperty :: RangeConfig -> LabelledSpec
rangeConfigProperty :: RangeConfig -> LabelledSpec
rangeConfigProperty RangeConfig
rangeCfg =
let (Text
l, Text
n) = case RangeConfig
rangeCfg of
RCategory Text
nme -> (Text
"category", Text
nme)
RDiverging Text
nme -> (Text
"diverging", Text
nme)
RHeatmap Text
nme -> (Text
"heatmap", Text
nme)
ROrdinal Text
nme -> (Text
"ordinal", Text
nme)
RRamp Text
nme -> (Text
"ramp", Text
nme)
RSymbol Text
nme -> (Text
"symbol", Text
nme)
in Text
l Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [LabelledSpec] -> Value
object [Text -> DashStyle -> LabelledSpec
schemeProperty Text
n []]
scaleConfigProperty :: ScaleConfig -> LabelledSpec
scaleConfigProperty :: ScaleConfig -> LabelledSpec
scaleConfigProperty (SCBandPaddingInner Double
x) = Text
"bandPaddingInner" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCBandPaddingOuter Double
x) = Text
"bandPaddingOuter" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCBarBandPaddingInner Double
x) = Text
"barBandPaddingInner" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCBarBandPaddingOuter Double
x) = Text
"barBandPaddingOuter" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCRectBandPaddingInner Double
x) = Text
"rectBandPaddingInner" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCRectBandPaddingOuter Double
x) = Text
"rectBandPaddingOuter" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCClamp Bool
b) = Text
"clamp" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
scaleConfigProperty (SCMaxBandSize Double
x) = Text
"maxBandSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCMinBandSize Double
x) = Text
"minBandSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCMaxFontSize Double
x) = Text
"maxFontSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCMinFontSize Double
x) = Text
"minFontSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCMaxOpacity Double
x) = Text
"maxOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCMinOpacity Double
x) = Text
"minOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCMaxSize Double
x) = Text
"maxSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCMinSize Double
x) = Text
"minSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCMaxStrokeWidth Double
x) = Text
"maxStrokeWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCMinStrokeWidth Double
x) = Text
"minStrokeWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCPointPadding Double
x) = Text
"pointPadding" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
scaleConfigProperty (SCRound Bool
b) = Text
"round" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
scaleConfigProperty (SCUseUnaggregatedDomain Bool
b) = Text
"useUnaggregatedDomain" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
scaleConfigProperty (SCXReverse Bool
b) = Text
"xReverse" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
{-# DEPRECATED ViewWidth "Please change ViewWidth to ViewContinuousWidth" #-}
{-# DEPRECATED ViewHeight "Please change ViewHeight to ViewContinuousHeight" #-}
data ViewConfig
= ViewBackgroundStyle [ViewBackground]
| ViewClip Bool
| ViewContinuousWidth Double
| ViewContinuousHeight Double
| ViewCornerRadius Double
| ViewCursor Cursor
| ViewDiscreteWidth Double
| ViewDiscreteHeight Double
| ViewFill Color
| ViewNoFill
| ViewFillOpacity Opacity
| ViewOpacity Opacity
| ViewStep Double
| ViewStroke Color
| ViewNoStroke
| ViewStrokeCap StrokeCap
| ViewStrokeDash DashStyle
| ViewStrokeDashOffset DashOffset
| ViewStrokeJoin StrokeJoin
| ViewStrokeMiterLimit Double
| ViewStrokeOpacity Opacity
| ViewStrokeWidth Double
| ViewWidth Double
| ViewHeight Double
viewConfigProperties :: ViewConfig -> [LabelledSpec]
viewConfigProperties :: ViewConfig -> [LabelledSpec]
viewConfigProperties (ViewBackgroundStyle [ViewBackground]
bs) = (ViewBackground -> LabelledSpec)
-> [ViewBackground] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map ViewBackground -> LabelledSpec
viewBackgroundSpec [ViewBackground]
bs
viewConfigProperties (ViewClip Bool
b) = [Text
"clip" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b]
viewConfigProperties (ViewWidth Double
x) = [Text
"continuousWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewHeight Double
x) = [Text
"continuousHeight" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewContinuousWidth Double
x) = [Text
"continuousWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewContinuousHeight Double
x) = [Text
"continuousHeight" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewCornerRadius Double
x) = [Text
"cornerRadius" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewCursor Cursor
c) = [Text
"cursor" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Cursor -> Text
cursorLabel Cursor
c]
viewConfigProperties (ViewDiscreteWidth Double
x) = [Text
"discreteWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewDiscreteHeight Double
x) = [Text
"discreteHeight" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewFill Text
ms) = [Text
"fill" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
ms]
viewConfigProperties ViewConfig
ViewNoFill = [Text
"fill" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Value
A.Null]
viewConfigProperties (ViewFillOpacity Double
x) = [Text
"fillOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewOpacity Double
x) = [Text
"opacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewStep Double
x) = [Text
"step" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewStroke Text
ms) = [Text
"stroke" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
ms]
viewConfigProperties ViewConfig
ViewNoStroke = [Text
"stroke" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Value
A.Null]
viewConfigProperties (ViewStrokeCap StrokeCap
sc) = [Text
"strokeCap" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= StrokeCap -> Text
strokeCapLabel StrokeCap
sc]
viewConfigProperties (ViewStrokeDash DashStyle
xs) = [Text
"strokeDash" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= DashStyle -> Value
fromDS DashStyle
xs]
viewConfigProperties (ViewStrokeDashOffset Double
x) = [Text
"strokeDashOffset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewStrokeJoin StrokeJoin
sj) = [Text
"strokeJoin" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= StrokeJoin -> Text
strokeJoinLabel StrokeJoin
sj]
viewConfigProperties (ViewStrokeMiterLimit Double
x) = [Text
"strokeMiterLimit" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewStrokeOpacity Double
x) = [Text
"strokeOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
viewConfigProperties (ViewStrokeWidth Double
x) = [Text
"strokeWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x]
data AxisConfig
= Aria Bool
| AriaDescription T.Text
| AStyle [StyleLabel]
| BandPosition Double
| Disable Bool
| Domain Bool
| DomainCap StrokeCap
| DomainColor Color
| DomainDash DashStyle
| DomainDashOffset DashOffset
| DomainOpacity Opacity
| DomainWidth Double
| Format T.Text
| FormatAsNum
| FormatAsTemporal
| FormatAsCustom T.Text
| Grid Bool
| GridCap StrokeCap
| GridColor Color
| GridDash DashStyle
| GridDashOffset DashOffset
| GridOpacity Opacity
| GridWidth Double
| Labels Bool
| LabelAlign HAlign
| LabelAngle Angle
| LabelBaseline VAlign
| LabelNoBound
| LabelBound
| LabelBoundValue Double
| LabelColor Color
| LabelNoFlush
| LabelFlush
| LabelFlushValue Double
| LabelFlushOffset Double
| LabelFont T.Text
| LabelFontSize Double
| LabelFontStyle T.Text
| LabelFontWeight FontWeight
| LabelLimit Double
| LabelLineHeight Double
| LabelOffset Double
| LabelOpacity Opacity
| LabelOverlap OverlapStrategy
| LabelPadding Double
| LabelSeparation Double
| MaxExtent Double
| MinExtent Double
| NoTitle
| Orient Side
| Ticks Bool
| TickBand BandAlign
| TickCap StrokeCap
| TickColor Color
| TickCount Int
| TickCountTime ScaleNice
| TickDash DashStyle
| TickDashOffset DashOffset
| Bool
| TickOffset Double
| TickOpacity Opacity
| TickRound Bool
| TickSize Double
| TickWidth Double
| TitleAlign HAlign
| TitleAnchor APosition
| TitleAngle Angle
| TitleBaseline VAlign
| TitleColor Color
| TitleFont T.Text
| TitleFontSize Double
| TitleFontStyle T.Text
| TitleFontWeight FontWeight
| TitleLimit Double
| TitleLineHeight Double
| TitleOpacity Opacity
| TitlePadding Double
| TitleX Double
| TitleY Double
| TranslateOffset Double
axisConfigProperty :: AxisConfig -> LabelledSpec
axisConfigProperty :: AxisConfig -> LabelledSpec
axisConfigProperty (AStyle [Text
s]) = Text
"style" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s
axisConfigProperty (AStyle [Text]
s) = Text
"style" Text -> [Text] -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [Text]
s
axisConfigProperty (Aria Bool
b) = Text
"aria" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
axisConfigProperty (AriaDescription Text
t) = Text
"description" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
t
axisConfigProperty (BandPosition Double
x) = Text
"bandPosition" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (Disable Bool
b) = Text
"disable" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
axisConfigProperty (Domain Bool
b) = Text
"domain" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
axisConfigProperty (DomainCap StrokeCap
c) = Text
"domainCap" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= StrokeCap -> Text
strokeCapLabel StrokeCap
c
axisConfigProperty (DomainColor Text
c) = Text
"domainColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
c
axisConfigProperty (DomainDash DashStyle
ds) = Text
"domainDash" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= DashStyle -> Value
fromDS DashStyle
ds
axisConfigProperty (DomainDashOffset Double
x) = Text
"domainDashOffset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (DomainOpacity Double
x) = Text
"domainOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (DomainWidth Double
w) = Text
"domainWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
w
axisConfigProperty (Format Text
fmt) = Text
"format" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fmt
axisConfigProperty AxisConfig
FormatAsNum = Text
"formatNum" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromT Text
"number"
axisConfigProperty AxisConfig
FormatAsTemporal = Text
"formatNum" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromT Text
"type"
axisConfigProperty (FormatAsCustom Text
c) = Text
"formatType" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
c
axisConfigProperty (Grid Bool
b) = Text
"grid" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
axisConfigProperty (GridCap StrokeCap
c) = Text
"gridCap" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= StrokeCap -> Text
strokeCapLabel StrokeCap
c
axisConfigProperty (GridColor Text
c) = Text
"gridColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
c
axisConfigProperty (GridDash DashStyle
ds) = Text
"gridDash" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= DashStyle -> Value
fromDS DashStyle
ds
axisConfigProperty (GridDashOffset Double
x) = Text
"gridDashOffset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (GridOpacity Double
o) = Text
"gridOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
o
axisConfigProperty (GridWidth Double
x) = Text
"gridWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (LabelAlign HAlign
ha) = Text
"labelAlign" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= HAlign -> Text
hAlignLabel HAlign
ha
axisConfigProperty (LabelAngle Double
angle) = Text
"labelAngle" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
angle
axisConfigProperty (LabelBaseline VAlign
va) = Text
"labelBaseline" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= VAlign -> Text
vAlignLabel VAlign
va
axisConfigProperty AxisConfig
LabelNoBound = Text
"labelBound" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
False
axisConfigProperty AxisConfig
LabelBound = Text
"labelBound" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
True
axisConfigProperty (LabelBoundValue Double
x) = Text
"labelBound" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (LabelColor Text
c) = Text
"labelColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
c
axisConfigProperty AxisConfig
LabelNoFlush = Text
"labelFlush" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
False
axisConfigProperty AxisConfig
LabelFlush = Text
"labelFlush" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
True
axisConfigProperty (LabelFlushValue Double
x) = Text
"labelFlush" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (LabelFlushOffset Double
x) = Text
"labelFlushOffset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (LabelFont Text
f) = Text
"labelFont" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
f
axisConfigProperty (LabelFontSize Double
x) = Text
"labelFontSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (LabelFontStyle Text
s) = Text
"labelFontStyle" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s
axisConfigProperty (LabelFontWeight FontWeight
fw) = Text
"labelFontWeight" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= FontWeight -> Value
fontWeightSpec FontWeight
fw
axisConfigProperty (LabelLimit Double
x) = Text
"labelLimit" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (LabelLineHeight Double
x) = Text
"labelLineHeight" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (LabelOffset Double
x) = Text
"labelOffset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (LabelOpacity Double
x) = Text
"labelOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (LabelOverlap OverlapStrategy
strat) = Text
"labelOverlap" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= OverlapStrategy -> Value
overlapStrategyLabel OverlapStrategy
strat
axisConfigProperty (LabelPadding Double
pad) = Text
"labelPadding" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
pad
axisConfigProperty (LabelSeparation Double
x) = Text
"labelSeparation" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (Labels Bool
b) = Text
"labels" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
axisConfigProperty (MaxExtent Double
n) = Text
"maxExtent" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
n
axisConfigProperty (MinExtent Double
n) = Text
"minExtent" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
n
axisConfigProperty (Orient Side
orient) = Text
"orient" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Side -> Text
sideLabel Side
orient
axisConfigProperty (TickBand BandAlign
band) = Text
"tickBand" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= BandAlign -> Text
bandAlignLabel BandAlign
band
axisConfigProperty (TickCap StrokeCap
c) = Text
"tickCap" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= StrokeCap -> Text
strokeCapLabel StrokeCap
c
axisConfigProperty (TickColor Text
c) = Text
"tickColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
c
axisConfigProperty (TickCount Int
n) = Text
"tickCount" Text -> Int -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int
n
axisConfigProperty (TickCountTime ScaleNice
sn) = Text
"tickCount" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= ScaleNice -> Value
scaleNiceSpec ScaleNice
sn
axisConfigProperty (TickDash DashStyle
ds) = Text
"tickDash" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= DashStyle -> Value
fromDS DashStyle
ds
axisConfigProperty (TickDashOffset Double
x) = Text
"tickDashOffset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TickExtra Bool
b) = Text
"tickExtra" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
axisConfigProperty (TickOffset Double
x) = Text
"tickOffset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TickOpacity Double
x) = Text
"tickOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TickRound Bool
b) = Text
"tickRound" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
axisConfigProperty (TickSize Double
x) = Text
"tickSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TickWidth Double
x) = Text
"tickWidth" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (Ticks Bool
b) = Text
"ticks" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
axisConfigProperty AxisConfig
NoTitle = Text
"title" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Value
A.Null
axisConfigProperty (TitleAlign HAlign
algn) = Text
"titleAlign" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= HAlign -> Text
hAlignLabel HAlign
algn
axisConfigProperty (TitleAnchor APosition
a) = Text
"titleAnchor" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= APosition -> Text
anchorLabel APosition
a
axisConfigProperty (TitleAngle Double
x) = Text
"titleAngle" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TitleBaseline VAlign
va) = Text
"titleBaseline" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= VAlign -> Text
vAlignLabel VAlign
va
axisConfigProperty (TitleColor Text
c) = Text
"titleColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
c
axisConfigProperty (TitleFont Text
f) = Text
"titleFont" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
f
axisConfigProperty (TitleFontSize Double
x) = Text
"titleFontSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TitleFontStyle Text
s) = Text
"titleFontStyle" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s
axisConfigProperty (TitleFontWeight FontWeight
w) = Text
"titleFontWeight" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= FontWeight -> Value
fontWeightSpec FontWeight
w
axisConfigProperty (TitleLimit Double
x) = Text
"titleLimit" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TitleLineHeight Double
x) = Text
"titleLineHeight" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TitleOpacity Double
x) = Text
"titleOpacity" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TitlePadding Double
x) = Text
"titlePadding" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TitleX Double
x) = Text
"titleX" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TitleY Double
x) = Text
"titleY" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
axisConfigProperty (TranslateOffset Double
x) = Text
"translate" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
data TitleFrame
= FrBounds
| FrGroup
titleFrameSpec :: TitleFrame -> VLSpec
titleFrameSpec :: TitleFrame -> Value
titleFrameSpec TitleFrame
FrBounds = Value
"bounds"
titleFrameSpec TitleFrame
FrGroup = Value
"group"
data TitleConfig
= TAlign HAlign
| TAnchor APosition
| TAngle Angle
| TAria Bool
| TBaseline VAlign
| TColor Color
| TdX Double
| TdY Double
| TFont T.Text
| TFontSize Double
| TFontStyle T.Text
| TFontWeight FontWeight
| TFrame TitleFrame
| TLimit Double
| TLineHeight Double
| TOffset Double
| TOrient Side
| TStyle [StyleLabel]
| TSubtitle T.Text
| TSubtitleColor Color
| TSubtitleFont T.Text
| TSubtitleFontSize Double
| TSubtitleFontStyle T.Text
| TSubtitleFontWeight FontWeight
| TSubtitleLineHeight Double
| TSubtitlePadding Double
| TZIndex ZIndex
titleConfigSpec :: TitleConfig -> LabelledSpec
titleConfigSpec :: TitleConfig -> LabelledSpec
titleConfigSpec (TAlign HAlign
ha) = Text
"align" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= HAlign -> Text
hAlignLabel HAlign
ha
titleConfigSpec (TAnchor APosition
an) = Text
"anchor" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= APosition -> Text
anchorLabel APosition
an
titleConfigSpec (TAngle Double
x) = Text
"angle" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
titleConfigSpec (TAria Bool
b) = Text
"aria" Text -> Bool -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Bool
b
titleConfigSpec (TBaseline VAlign
va) = Text
"baseline" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= VAlign -> Text
vAlignLabel VAlign
va
titleConfigSpec (TColor Text
clr) = Text
"color" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
clr
titleConfigSpec (TdX Double
x) = Text
"dx" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
titleConfigSpec (TdY Double
x) = Text
"dy" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
titleConfigSpec (TFont Text
fnt) = Text
"font" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fnt
titleConfigSpec (TFontSize Double
x) = Text
"fontSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
titleConfigSpec (TFontStyle Text
s) = Text
"fontStyle" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s
titleConfigSpec (TFontWeight FontWeight
w) = Text
"fontWeight" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= FontWeight -> Value
fontWeightSpec FontWeight
w
titleConfigSpec (TFrame TitleFrame
tf) = Text
"frame" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= TitleFrame -> Value
titleFrameSpec TitleFrame
tf
titleConfigSpec (TLimit Double
x) = Text
"limit" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
titleConfigSpec (TLineHeight Double
x) = Text
"lineHeight" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
titleConfigSpec (TOffset Double
x) = Text
"offset" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
titleConfigSpec (TOrient Side
sd) = Text
"orient" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Side -> Text
sideLabel Side
sd
titleConfigSpec (TStyle [Text
style]) = Text
"style" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
style
titleConfigSpec (TStyle [Text]
styles) = Text
"style" Text -> [Text] -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [Text]
styles
titleConfigSpec (TSubtitle Text
s) = Text
"subtitle" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
splitOnNewline Text
s
titleConfigSpec (TSubtitleColor Text
s) = Text
"subtitleColor" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
fromColor Text
s
titleConfigSpec (TSubtitleFont Text
s) = Text
"subtitleFont" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s
titleConfigSpec (TSubtitleFontSize Double
x) = Text
"subtitleFontSize" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
titleConfigSpec (TSubtitleFontStyle Text
s) = Text
"subtitleFontStyle" Text -> Text -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s
titleConfigSpec (TSubtitleFontWeight FontWeight
fw) = Text
"subtitleFontWeight" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= FontWeight -> Value
fontWeightSpec FontWeight
fw
titleConfigSpec (TSubtitleLineHeight Double
x) = Text
"subtitleLineHeight" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
titleConfigSpec (TSubtitlePadding Double
x) = Text
"subtitlePadding" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
titleConfigSpec (TZIndex ZIndex
z) = Text
"zindex" Text -> ZIndex -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= ZIndex
z
data CompositionConfig
= CompColumns Int
| CompSpacing Double
compConfigProperty :: CompositionConfig -> LabelledSpec
compConfigProperty :: CompositionConfig -> LabelledSpec
compConfigProperty (CompColumns Int
n) = Text
"columns" Text -> Int -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int
n
compConfigProperty (CompSpacing Double
x) = Text
"spacing" Text -> Double -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Double
x
configuration ::
ConfigurationProperty
-> BuildConfigureSpecs
configuration :: ConfigurationProperty -> BuildConfigureSpecs
configuration ConfigurationProperty
cfg [ConfigureSpec]
ols = LabelledSpec -> ConfigureSpec
CS (ConfigurationProperty -> LabelledSpec
configProperty ConfigurationProperty
cfg) ConfigureSpec -> BuildConfigureSpecs
forall a. a -> [a] -> [a]
: [ConfigureSpec]
ols
title ::
T.Text
-> [TitleConfig]
-> PropertySpec
title :: Text -> [TitleConfig] -> PropertySpec
title Text
s [] =
(VLProperty
VLTitle, Text -> Value
splitOnNewline Text
s)
title Text
s [TitleConfig]
topts =
(VLProperty
VLTitle,
[LabelledSpec] -> Value
object (Text
"text" Text -> Value -> LabelledSpec
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text -> Value
splitOnNewline Text
s LabelledSpec -> [LabelledSpec] -> [LabelledSpec]
forall a. a -> [a] -> [a]
: (TitleConfig -> LabelledSpec) -> [TitleConfig] -> [LabelledSpec]
forall a b. (a -> b) -> [a] -> [b]
map TitleConfig -> LabelledSpec
titleConfigSpec [TitleConfig]
topts))