Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to DynamicObj v4 #472

Merged
merged 18 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
finish trace objects dynobj v4 port, fix some sankey props
  • Loading branch information
kMutagene committed Oct 15, 2024
commit 266779cb0471be7c49e907d141307c0c6d58d912
9 changes: 4 additions & 5 deletions src/Plotly.NET/Traces/ObjectAbstractions/FinanceMarker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ type FinanceMarker() =
[<Optional; DefaultParameterValue(null)>] ?LineWidth: float,
[<Optional; DefaultParameterValue(null)>] ?LineDash: StyleParam.DrawingStyle
) =
(fun (financeMarker: FinanceMarker) ->
fun (financeMarker: FinanceMarker) ->

let line =
financeMarker.TryGetTypedPropertyValue<Line>("line")
|> Option.defaultValue(Plotly.NET.Line.init())
|> Line.style (?Color = LineColor, ?Width = LineWidth, ?Dash = LineDash)

FillColor |> DynObj.setOptionalProperty financeMarker "fillcolor"
line |> DynObj.withProperty financeMarker "line"

financeMarker)
financeMarker
|> DynObj.withOptionalProperty "fillcolor" FillColor
|> DynObj.withProperty "line" line
27 changes: 11 additions & 16 deletions src/Plotly.NET/Traces/ObjectAbstractions/Icicle.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ type IcicleRoot() =
IcicleRoot() |> IcicleRoot.style (?Color = Color)

static member style([<Optional; DefaultParameterValue(null)>] ?Color: Color) =
(fun (icicleRoot: IcicleRoot) ->

Color |> DynObj.setOptionalProperty icicleRoot "color"

icicleRoot)
fun (icicleRoot: IcicleRoot) ->
icicleRoot
|> DynObj.withOptionalProperty "color" Color

type IcicleLeaf() =
inherit DynamicObj()
Expand All @@ -26,11 +24,9 @@ type IcicleLeaf() =
IcicleLeaf() |> IcicleLeaf.style (?Opacity = Opacity)

static member style([<Optional; DefaultParameterValue(null)>] ?Opacity: float) =
(fun (icicleLeaf: IcicleLeaf) ->

Opacity |> DynObj.setOptionalProperty icicleLeaf "opacity"

icicleLeaf)
fun (icicleLeaf: IcicleLeaf) ->
icicleLeaf
|> DynObj.withOptionalProperty "opacity" Opacity

type IcicleTiling() =
inherit DynamicObj()
Expand All @@ -49,10 +45,9 @@ type IcicleTiling() =
[<Optional; DefaultParameterValue(null)>] ?Orientation: StyleParam.Orientation,
[<Optional; DefaultParameterValue(null)>] ?Pad: int
) =
(fun (icicleTiling: IcicleTiling) ->

Flip |> DynObj.setOptionalPropertyBy icicleTiling "flip" StyleParam.TilingFlip.convert
Orientation |> DynObj.setOptionalPropertyBy icicleTiling "orientation" StyleParam.Orientation.convert
Pad |> DynObj.setOptionalProperty icicleTiling "pad"
fun (icicleTiling: IcicleTiling) ->

icicleTiling)
icicleTiling
|> DynObj.withOptionalPropertyBy "flip" Flip StyleParam.TilingFlip.convert
|> DynObj.withOptionalPropertyBy "orientation" Orientation StyleParam.Orientation.convert
|> DynObj.withOptionalProperty "pad" Pad
64 changes: 30 additions & 34 deletions src/Plotly.NET/Traces/ObjectAbstractions/Indicator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,12 @@ type IndicatorBar() =
[<Optional; DefaultParameterValue(null)>] ?Line: Line,
[<Optional; DefaultParameterValue(null)>] ?Thickness: float
) =
(fun (indicatorBar: IndicatorBar) ->

Color |> DynObj.setOptionalProperty indicatorBar "color"
Line |> DynObj.setOptionalProperty indicatorBar "line"
Thickness |> DynObj.setOptionalProperty indicatorBar "thickness"

indicatorBar)
fun (indicatorBar: IndicatorBar) ->
indicatorBar
|> DynObj.withOptionalProperty "color" Color
|> DynObj.withOptionalProperty "line" Line
|> DynObj.withOptionalProperty "thickness" Thickness


type IndicatorStep() =
inherit DynamicObj()
Expand Down Expand Up @@ -190,16 +189,15 @@ type IndicatorStep() =
[<Optional; DefaultParameterValue(null)>] ?TemplateItemName: string,
[<Optional; DefaultParameterValue(null)>] ?Thickness: float
) =
(fun (indicatorSteps: IndicatorStep) ->
fun (indicatorSteps: IndicatorStep) ->

Color |> DynObj.setOptionalProperty indicatorSteps "color"
Line |> DynObj.setOptionalProperty indicatorSteps "line"
Name |> DynObj.setOptionalProperty indicatorSteps "name"
Range |> DynObj.setOptionalPropertyBy indicatorSteps "range" StyleParam.Range.convert
TemplateItemName |> DynObj.setOptionalProperty indicatorSteps "templateitemname"
Thickness |> DynObj.setOptionalProperty indicatorSteps "thickness"

indicatorSteps)
indicatorSteps
|> DynObj.withOptionalProperty "color" Color
|> DynObj.withOptionalProperty "line" Line
|> DynObj.withOptionalProperty "name" Name
|> DynObj.withOptionalPropertyBy "range" Range StyleParam.Range.convert
|> DynObj.withOptionalProperty "templateitemname" TemplateItemName
|> DynObj.withOptionalProperty "thickness" Thickness


type IndicatorThreshold() =
Expand All @@ -219,13 +217,12 @@ type IndicatorThreshold() =
[<Optional; DefaultParameterValue(null)>] ?Thickness: float,
[<Optional; DefaultParameterValue(null)>] ?Value: #IConvertible
) =
(fun (indicatorThreshold: IndicatorThreshold) ->

Line |> DynObj.setOptionalProperty indicatorThreshold "line"
Thickness |> DynObj.setOptionalProperty indicatorThreshold "thickness"
Value |> DynObj.setOptionalProperty indicatorThreshold "value"
fun (indicatorThreshold: IndicatorThreshold) ->

indicatorThreshold)
indicatorThreshold
|> DynObj.withOptionalProperty "line" Line
|> DynObj.withOptionalProperty "thickness" Thickness
|> DynObj.withOptionalProperty "value" Value


type IndicatorGauge() =
Expand Down Expand Up @@ -265,15 +262,14 @@ type IndicatorGauge() =
[<Optional; DefaultParameterValue(null)>] ?Steps: seq<IndicatorStep>,
[<Optional; DefaultParameterValue(null)>] ?Threshold: IndicatorThreshold
) =
(fun (indicatorGauge: IndicatorGauge) ->

Axis |> DynObj.setOptionalProperty indicatorGauge "axis"
Bar |> DynObj.setOptionalProperty indicatorGauge "bar"
BGColor |> DynObj.setOptionalProperty indicatorGauge "bgcolor"
BorderColor |> DynObj.setOptionalProperty indicatorGauge "bordercolor"
BorderWidth |> DynObj.setOptionalProperty indicatorGauge "borderwidth"
Shape |> DynObj.setOptionalPropertyBy indicatorGauge "shape" StyleParam.IndicatorGaugeShape.convert
Steps |> DynObj.setOptionalProperty indicatorGauge "steps"
Threshold |> DynObj.setOptionalProperty indicatorGauge "threshold"

indicatorGauge)
fun (indicatorGauge: IndicatorGauge) ->

indicatorGauge
|> DynObj.withOptionalProperty "axis" Axis
|> DynObj.withOptionalProperty "bar" Bar
|> DynObj.withOptionalProperty "bgcolor" BGColor
|> DynObj.withOptionalProperty "bordercolor" BorderColor
|> DynObj.withOptionalProperty "borderwidth" BorderWidth
|> DynObj.withOptionalPropertyBy "shape" Shape StyleParam.IndicatorGaugeShape.convert
|> DynObj.withOptionalProperty "steps" Steps
|> DynObj.withOptionalProperty "threshold" Threshold
81 changes: 37 additions & 44 deletions src/Plotly.NET/Traces/ObjectAbstractions/Sankey.fs
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,20 @@ type SankeyNodes() =
[<Optional; DefaultParameterValue(null)>] ?X: seq<#IConvertible>,
[<Optional; DefaultParameterValue(null)>] ?Y: seq<#IConvertible>
) =
(fun (sankeyNodes: SankeyNodes) ->

Color |> DynObj.setOptionalProperty sankeyNodes "color"
CustomData |> DynObj.setOptionalProperty sankeyNodes "customdata"
Groups |> DynObj.setOptionalProperty sankeyNodes "hoverinfo"
HoverInfo |> DynObj.setOptionalPropertyBy sankeyNodes "color" StyleParam.HoverInfo.convert
HoverLabel |> DynObj.setOptionalProperty sankeyNodes "hoverlabel"
(HoverTemplate, MultiHoverTemplate) |> DynObj.setOptionalSingleOrMultiProperty sankeyNodes "hovertemplate"
Label |> DynObj.setOptionalProperty sankeyNodes "label"
Line |> DynObj.setOptionalProperty sankeyNodes "line"
Pad |> DynObj.setOptionalProperty sankeyNodes "pad"
Thickness |> DynObj.setOptionalProperty sankeyNodes "thickness"
X |> DynObj.setOptionalProperty sankeyNodes "x"
Y |> DynObj.setOptionalProperty sankeyNodes "y"

sankeyNodes)
fun (sankeyNodes: SankeyNodes) ->
sankeyNodes
|> DynObj.withOptionalProperty "color" Color
|> DynObj.withOptionalProperty "customdata" CustomData
|> DynObj.withOptionalProperty "groups" Groups
|> DynObj.withOptionalPropertyBy "hoverinfo" HoverInfo StyleParam.HoverInfo.convert
|> DynObj.withOptionalProperty "hoverlabel" HoverLabel
|> DynObj.withOptionalSingleOrMultiProperty "hovertemplate" (HoverTemplate, MultiHoverTemplate)
|> DynObj.withOptionalProperty "label" Label
|> DynObj.withOptionalProperty "line" Line
|> DynObj.withOptionalProperty "pad" Pad
|> DynObj.withOptionalProperty "thickness" Thickness
|> DynObj.withOptionalProperty "x" X
|> DynObj.withOptionalProperty "y" Y

type SankeyLinkColorscale() =
inherit DynamicObj()
Expand Down Expand Up @@ -110,17 +108,15 @@ type SankeyLinkColorscale() =
[<Optional; DefaultParameterValue(null)>] ?Name: string,
[<Optional; DefaultParameterValue(null)>] ?TemplateItemName: string
) =
(fun (sankeyLinkColorscale: SankeyLinkColorscale) ->
fun (sankeyLinkColorscale: SankeyLinkColorscale) ->

CMax |> DynObj.setOptionalProperty sankeyLinkColorscale "cmax"
CMin |> DynObj.setOptionalProperty sankeyLinkColorscale "cmin"
ColorScale |> DynObj.setOptionalPropertyBy sankeyLinkColorscale "colorscale" StyleParam.Colorscale.convert
Label |> DynObj.setOptionalProperty sankeyLinkColorscale "label"
Name |> DynObj.setOptionalProperty sankeyLinkColorscale "name"
TemplateItemName |> DynObj.setOptionalProperty sankeyLinkColorscale "templateitemname"


sankeyLinkColorscale)
sankeyLinkColorscale
|> DynObj.withOptionalProperty "cmax" CMax
|> DynObj.withOptionalProperty "cmin" CMin
|> DynObj.withOptionalPropertyBy "colorscale" ColorScale StyleParam.Colorscale.convert
|> DynObj.withOptionalProperty "label" Label
|> DynObj.withOptionalProperty "name" Name
|> DynObj.withOptionalProperty "templateitemname" TemplateItemName

type SankeyLinks() =
inherit DynamicObj()
Expand Down Expand Up @@ -176,21 +172,18 @@ type SankeyLinks() =
[<Optional; DefaultParameterValue(null)>] ?Target: seq<int>,
[<Optional; DefaultParameterValue(null)>] ?Value: seq<#IConvertible>
) =
(fun (sankeyLinks: SankeyLinks) ->

ArrowLen |> DynObj.setOptionalProperty sankeyLinks "arrowlen"
Color |> DynObj.setOptionalProperty sankeyLinks "color"
ColorScales |> DynObj.setOptionalProperty sankeyLinks "colorscales"
CustomData |> DynObj.setOptionalProperty sankeyLinks "customdata"
HoverInfo |> DynObj.setOptionalPropertyBy sankeyLinks "hoverinfo" StyleParam.HoverInfo.convert
HoverLabel |> DynObj.setOptionalProperty sankeyLinks "hoverlabel"
HoverTemplate |> DynObj.setOptionalProperty sankeyLinks "hovertemplate"
MultiHoverTemplate |> DynObj.setOptionalProperty sankeyLinks "multihovertemplate"
Label |> DynObj.setOptionalProperty sankeyLinks "label"
Line |> DynObj.setOptionalProperty sankeyLinks "line"
Source |> DynObj.setOptionalProperty sankeyLinks "source"
Target |> DynObj.setOptionalProperty sankeyLinks "target"
Value |> DynObj.setOptionalProperty sankeyLinks "value"


sankeyLinks)
fun (sankeyLinks: SankeyLinks) ->

sankeyLinks
|> DynObj.withOptionalProperty "arrowlen" ArrowLen
|> DynObj.withOptionalProperty "color" Color
|> DynObj.withOptionalProperty "colorscales" ColorScales
|> DynObj.withOptionalProperty "customdata" CustomData
|> DynObj.withOptionalPropertyBy "hoverinfo" HoverInfo StyleParam.HoverInfo.convert
|> DynObj.withOptionalProperty "hoverlabel" HoverLabel
|> DynObj.withOptionalSingleOrMultiProperty "hovertemplate" (HoverTemplate, MultiHoverTemplate)
|> DynObj.withOptionalProperty "label" Label
|> DynObj.withOptionalProperty "line" Line
|> DynObj.withOptionalProperty "source" Source
|> DynObj.withOptionalProperty "target" Target

3 changes: 1 addition & 2 deletions src/Plotly.NET/Traces/ObjectAbstractions/SplomDiagonal.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ type SplomDiagonal() =

fun (splomDiagonal: SplomDiagonal) ->

Visible |> DynObj.setOptionalProperty splomDiagonal "visible"

splomDiagonal
|> DynObj.withOptionalProperty "visible" Visible