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