Skip to content

Commit fef0bbb

Browse files
authored
Merge pull request #267 from plotly/#266-title-alignment
2 parents 0630664 + 2e8a1ca commit fef0bbb

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/Plotly.NET/ChartAPI/Chart.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,12 @@ type Chart =
16721672

16731673
GenericChart.addLayout layout ch)
16741674

1675+
// Set the title of a Chart
1676+
[<CompiledName("WithTitle")>]
1677+
static member withTitle(title) =
1678+
(fun (ch: GenericChart) ->
1679+
let layout = Layout() |> Layout.style (Title = title)
1680+
GenericChart.addLayout layout ch)
16751681

16761682
// Set showLegend of a Chart
16771683
[<CompiledName("WithLegend")>]

src/Plotly.NET/CommonAbstractions/StyleParams.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2636,13 +2636,15 @@ module StyleParam =
26362636
[<RequireQualifiedAccess>]
26372637
type Side =
26382638
| Top
2639+
| TopLeft
26392640
| Bottom
26402641
| Left
26412642
| Right
26422643

26432644
static member toString =
26442645
function
26452646
| Top -> "top"
2647+
| TopLeft -> "top left"
26462648
| Bottom -> "bottom"
26472649
| Left -> "left"
26482650
| Right -> "right"

src/Plotly.NET/CommonAbstractions/Title.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type Title() =
3232
Text |> DynObj.setValueOpt title "text"
3333
Font |> DynObj.setValueOpt title "font"
3434
Standoff |> DynObj.setValueOpt title "standoff"
35-
Side |> DynObj.setValueOpt title "side"
35+
Side |> DynObj.setValueOptBy title "side" StyleParam.Side.convert
3636
X |> DynObj.setValueOpt title "x"
3737
Y |> DynObj.setValueOpt title "y"
3838

0 commit comments

Comments
 (0)