Skip to content

Commit 4e2475a

Browse files
committed
Make labels optional for pie/doughnut charts
1 parent c14a2ed commit 4e2475a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/Plotly.NET/ChartAPI/ChartDomain.fs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module ChartDomain =
2323
static member Pie
2424
(
2525
values : seq<#IConvertible>,
26-
labels : seq<#IConvertible>,
26+
[<Optional;DefaultParameterValue(null)>] ?Labels : seq<#IConvertible>,
2727
[<Optional;DefaultParameterValue(null)>] ?Name : string,
2828
[<Optional;DefaultParameterValue(null)>] ?TextLabels : seq<#IConvertible>,
2929
[<Optional;DefaultParameterValue(null)>] ?TextPosition : StyleParam.TextPosition,
@@ -37,7 +37,7 @@ module ChartDomain =
3737
TraceDomain.initPie(
3838
TraceDomainStyle.Pie(
3939
Values = values,
40-
Labels = labels,
40+
?Labels = Labels,
4141
?Name = Name,
4242
?Text = TextLabels,
4343
?TextPosition = TextPosition,
@@ -49,7 +49,7 @@ module ChartDomain =
4949
)
5050
)
5151
|> TraceStyle.Marker(?Colors=SectionColors)
52-
|> TraceStyle.TextLabel(Text=(TextLabels |> Option.defaultValue labels),?Textposition=TextPosition)
52+
|> TraceStyle.TextLabel(?Text=(if TextLabels.IsSome then TextLabels else Labels),?Textposition=TextPosition)
5353
|> GenericChart.ofTraceObject
5454

5555
/// Shows how proportions of data, shown as pie-shaped pieces, contribute to the data.
@@ -70,7 +70,7 @@ module ChartDomain =
7070
let values,labels = Seq.unzip valuesLabels
7171
Chart.Pie(
7272
values,
73-
labels,
73+
Labels = labels,
7474
?Name = Name ,
7575
?TextLabels = TextLabels ,
7676
?TextPosition = TextPosition ,
@@ -88,7 +88,7 @@ module ChartDomain =
8888
static member Doughnut
8989
(
9090
values : seq<#IConvertible>,
91-
labels : seq<#IConvertible>,
91+
[<Optional;DefaultParameterValue(null)>] ?Labels : seq<#IConvertible>,
9292
[<Optional;DefaultParameterValue(null)>] ?Hole : float,
9393
[<Optional;DefaultParameterValue(null)>] ?Name : string,
9494
[<Optional;DefaultParameterValue(null)>] ?TextLabels : seq<#IConvertible>,
@@ -104,7 +104,7 @@ module ChartDomain =
104104
TraceDomain.initPie(
105105
TraceDomainStyle.Pie(
106106
Values = values,
107-
Labels = labels,
107+
?Labels = Labels,
108108
?Name = Name,
109109
?Text = TextLabels,
110110
?TextPosition = TextPosition,
@@ -117,7 +117,7 @@ module ChartDomain =
117117
)
118118
)
119119
|> TraceStyle.Marker(?Colors=SectionColors)
120-
|> TraceStyle.TextLabel(Text=(TextLabels |> Option.defaultValue labels),?Textposition=TextPosition)
120+
|> TraceStyle.TextLabel(?Text=(if TextLabels.IsSome then TextLabels else Labels),?Textposition=TextPosition)
121121
|> GenericChart.ofTraceObject
122122

123123

@@ -140,7 +140,7 @@ module ChartDomain =
140140
let values,labels = Seq.unzip valuesLabels
141141
Chart.Doughnut(
142142
values,
143-
labels,
143+
Labels = labels,
144144
?Name = Name ,
145145
?TextLabels = TextLabels ,
146146
?TextPosition = TextPosition ,

0 commit comments

Comments
 (0)