Skip to content

Commit 10c426f

Browse files
committed
Add BarPolar chart and related polar layout styles
1 parent e10dbb2 commit 10c426f

File tree

2 files changed

+33
-18
lines changed

2 files changed

+33
-18
lines changed

src/Plotly.NET/Chart.fs

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,23 +1578,30 @@ type Chart =
15781578
?UseWebGL = UseWebGL
15791579
)
15801580

1581-
//static member WindRose(r, t,
1582-
// [<Optional;DefaultParameterValue(null)>] ?Name,
1583-
// [<Optional;DefaultParameterValue(null)>] ?Showlegend,
1584-
// [<Optional;DefaultParameterValue(null)>] ?Color,
1585-
// [<Optional;DefaultParameterValue(null)>] ?Opacity,
1586-
// [<Optional;DefaultParameterValue(null)>] ?Labels,
1587-
// [<Optional;DefaultParameterValue(null)>] ?TextPosition,
1588-
// [<Optional;DefaultParameterValue(null)>] ?TextFont,
1589-
// [<Optional;DefaultParameterValue(null)>] ?Dash,
1590-
// [<Optional;DefaultParameterValue(null)>] ?Width) =
1591-
// Trace.initWindRose (
1592-
// TraceStyle.Scatter(R = r,T = t) )
1593-
// |> TraceStyle.TraceInfo(?Name=Name,?Showlegend=Showlegend,?Opacity=Opacity)
1594-
// |> TraceStyle.Line(?Color=Color,?Dash=Dash,?Width=Width)
1595-
// |> TraceStyle.Marker(?Color=Color)
1596-
// |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont)
1597-
// |> GenericChart.ofTraceObject
1581+
///
1582+
static member BarPolar
1583+
(
1584+
r, theta,
1585+
[<Optional;DefaultParameterValue(null)>] ?Name,
1586+
[<Optional;DefaultParameterValue(null)>] ?Showlegend,
1587+
[<Optional;DefaultParameterValue(null)>] ?Color,
1588+
[<Optional;DefaultParameterValue(null)>] ?Opacity,
1589+
[<Optional;DefaultParameterValue(null)>] ?Labels,
1590+
[<Optional;DefaultParameterValue(null)>] ?TextPosition,
1591+
[<Optional;DefaultParameterValue(null)>] ?TextFont,
1592+
[<Optional;DefaultParameterValue(null)>] ?Dash,
1593+
[<Optional;DefaultParameterValue(null)>] ?LineWidth
1594+
) =
1595+
Trace.initBarPolar(
1596+
TraceStyle.BarPolar(
1597+
R = r, Theta = theta
1598+
)
1599+
)
1600+
|> TraceStyle.TraceInfo(?Name=Name,?Showlegend=Showlegend,?Opacity=Opacity)
1601+
|> TraceStyle.Line(?Color=Color,?Dash=Dash,?Width=LineWidth)
1602+
|> TraceStyle.Marker(?Color=Color)
1603+
|> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont)
1604+
|> GenericChart.ofTraceObject
15981605

15991606
/// Computes a histogram with auto-determined the bin size.
16001607
static member Histogram(data,

src/Plotly.NET/Polar.fs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ type Polar () =
4949
/// <param name="AngularAxis">Sets the angular axis of the polar subplot.</param>
5050
/// <param name="GridShape">Determines if the radial axis grid lines and angular axis line are drawn as "circular" sectors or as "linear" (polygon) sectors. Has an effect only when the angular axis has `type` "category". Note that `radialaxis.angle` is snapped to the angle of the closest vertex when `gridshape` is "circular" (so that radial axis scale is the same as the data scale).</param>
5151
/// <param name="UIRevision">Controls persistence of user-driven changes in axis attributes, if not overridden in the individual axes. Defaults to `layout.uirevision`.</param>
52+
/// <param name="BarMode">Determines how bars at the same location coordinate are displayed on the graph. With "stack", the bars are stacked on top of one another With "relative", the bars are stacked on top of one another, with negative values below the axis, positive values above With "group", the bars are plotted next to one another centered around the shared location. With "overlay", the bars are plotted over one another, you might need to an "opacity" to see multiple bars.</param>
53+
/// <param name="BarGap">Sets the gap (in plot fraction) between bars of adjacent location coordinates.</param>
5254
static member style
5355
(
5456
?Domain : Domain,
@@ -58,7 +60,11 @@ type Polar () =
5860
?RadialAxis : Axis.RadialAxis,
5961
?AngularAxis: Axis.AngularAxis,
6062
?GridShape : StyleParam.PolarGridShape,
61-
?UIRevision : string
63+
?UIRevision : string,
64+
//these are not documented in the official reference but seem to be the only way to make this work?!
65+
?BarMode : StyleParam.Barmode,
66+
?BarGap : float
67+
6268
) =
6369
(fun (polar:Polar) ->
6470

@@ -70,6 +76,8 @@ type Polar () =
7076
AngularAxis |> DynObj.setValueOpt polar "angularaxis"
7177
GridShape |> DynObj.setValueOptBy polar "gridshape" StyleParam.PolarGridShape.convert
7278
UIRevision |> DynObj.setValueOpt polar "uirevision"
79+
BarMode |> DynObj.setValueOptBy polar "barmode" StyleParam.Barmode.convert
80+
BarGap |> DynObj.setValueOpt polar "bargap"
7381

7482
polar
7583
)

0 commit comments

Comments
 (0)