diff --git a/docs/08_0_polar_line-scatter-plots.fsx b/docs/08_0_polar_line-scatter-plots.fsx index 3fab7881e..3e82520ff 100644 --- a/docs/08_0_polar_line-scatter-plots.fsx +++ b/docs/08_0_polar_line-scatter-plots.fsx @@ -98,7 +98,7 @@ let splinePolar = Chart.SplinePolar( radial, theta, - Labels=["one";"two";"three";"four";"five";"six";"seven"], + MultiText=["one";"two";"three";"four";"five";"six";"seven"], TextPosition=StyleParam.TextPosition.TopCenter, ShowMarkers=true ) diff --git a/docs/08_1_polar_bar_charts.fsx b/docs/08_1_polar_bar_charts.fsx index dfc321113..0c6e59ef9 100644 --- a/docs/08_1_polar_bar_charts.fsx +++ b/docs/08_1_polar_bar_charts.fsx @@ -53,11 +53,12 @@ of how wind speed and direction are typically distributed at a particular locati open Plotly.NET.LayoutObjects let windrose1 = + [ - Chart.BarPolar (r , t, Name="11-14 m/s") - Chart.BarPolar (r2, t, Name="8-11 m/s") - Chart.BarPolar (r3, t, Name="5-8 m/s") - Chart.BarPolar (r4, t, Name="< 5 m/s") + Chart.BarPolar (r , t, Name="11-14 m/s", MarkerPatternShape = StyleParam.PatternShape.Checked) + Chart.BarPolar (r2, t, Name="8-11 m/s" , MarkerPatternShape = StyleParam.PatternShape.DiagonalChecked) + Chart.BarPolar (r3, t, Name="5-8 m/s" , MarkerPatternShape = StyleParam.PatternShape.VerticalLines) + Chart.BarPolar (r4, t, Name="< 5 m/s" , MarkerPatternShape = StyleParam.PatternShape.HorizontalLines) ] |> Chart.combine |> Chart.withAngularAxis( diff --git a/src/Plotly.NET/ChartAPI/ChartPolar.fs b/src/Plotly.NET/ChartAPI/ChartPolar.fs index f6790ced2..c68bccb7b 100644 --- a/src/Plotly.NET/ChartAPI/ChartPolar.fs +++ b/src/Plotly.NET/ChartAPI/ChartPolar.fs @@ -30,34 +30,70 @@ module ChartPolar = [] static member ScatterPolar ( - r, theta, mode, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Dash, - [] ?Width, - [] ?UseWebGL, - [] ?UseDefaults : bool + r : seq<#IConvertible>, + theta : seq<#IConvertible>, + mode : StyleParam.Mode, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?LineColor : Color, + [] ?LineColorScale : StyleParam.Colorscale, + [] ?LineWidth : float, + [] ?LineDash : StyleParam.DrawingStyle, + [] ?Line : Line, + [] ?UseWebGL : bool, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true + + let marker = + Marker + |> Option.defaultValue (TraceObjects.Marker.init()) + |> TraceObjects.Marker.style( + ?Color = MarkerColor, + ?Outline = MarkerOutline, + ?Symbol3D = MarkerSymbol, + ?MultiSymbol3D = MultiMarkerSymbol, + ?Colorscale = MarkerColorScale + ) + + let line = + Line + |> Option.defaultValue (Plotly.NET.Line.init()) + |> Plotly.NET.Line.style( + ?Color = LineColor, + ?Dash = LineDash, + ?Colorscale = LineColorScale, + ?Width = LineWidth + ) let style = TracePolarStyle.ScatterPolar( - R = r, - Theta = theta, - Mode = mode + R = r , + Theta = theta , + Mode = mode , + Marker = marker , + Line = line , + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition ) - >> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - >> TraceStyle.Line(?Color=Color,?Dash=Dash,?Width=Width) - >> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) - >> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - + let useWebGL = defaultArg UseWebGL false Chart.renderScatterPolarTrace useDefaults useWebGL style @@ -66,69 +102,108 @@ module ChartPolar = [] static member ScatterPolar ( - rtheta, mode, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Dash, - [] ?Width, - [] ?UseWebGL, - [] ?UseDefaults : bool + rTheta : seq<#IConvertible * #IConvertible>, + mode : StyleParam.Mode, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?LineColor : Color, + [] ?LineColorScale : StyleParam.Colorscale, + [] ?LineWidth : float, + [] ?LineDash : StyleParam.DrawingStyle, + [] ?Line : Line, + [] ?UseWebGL : bool, + [] ?UseDefaults : bool ) = - let r,t = Seq.unzip rtheta + let r,t = Seq.unzip rTheta Chart.ScatterPolar( r, t, mode, - ?Name=Name, - ?ShowLegend=ShowLegend, - ?MarkerSymbol=MarkerSymbol, - ?Color=Color, - ?Opacity=Opacity, - ?Labels=Labels, - ?TextPosition=TextPosition, - ?TextFont=TextFont, - ?Dash=Dash, - ?Width=Width, - ?UseWebGL = UseWebGL, - ?UseDefaults = UseDefaults + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerSymbol = MarkerSymbol , + ?MultiMarkerSymbol = MultiMarkerSymbol, + ?Marker = Marker , + ?LineColor = LineColor , + ?LineColorScale = LineColorScale , + ?LineWidth = LineWidth , + ?LineDash = LineDash , + ?Line = Line , + ?UseWebGL = UseWebGL , + ?UseDefaults = UseDefaults ) /// [] static member PointPolar ( - r, theta, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?UseWebGL, - [] ?UseDefaults : bool + r : seq<#IConvertible>, + theta : seq<#IConvertible>, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?UseWebGL : bool, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true - let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || MultiTextPosition.IsSome) + let marker = + Marker + |> Option.defaultValue (TraceObjects.Marker.init()) + |> TraceObjects.Marker.style( + ?Color = MarkerColor, + ?Outline = MarkerOutline, + ?Symbol3D = MarkerSymbol, + ?MultiSymbol3D = MultiMarkerSymbol, + ?Colorscale = MarkerColorScale + ) + let style = TracePolarStyle.ScatterPolar( - R = r, - Theta = theta, - Mode = changeMode StyleParam.Mode.Markers + R = r , + Theta = theta , + Mode = changeMode StyleParam.Mode.Markers, + Marker = marker , + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition ) - >> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - >> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) - >> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) let useWebGL = defaultArg UseWebGL false @@ -138,53 +213,73 @@ module ChartPolar = [] static member PointPolar ( - rTheta, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?UseWebGL, - [] ?UseDefaults : bool + rTheta : seq<#IConvertible * #IConvertible>, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?UseWebGL : bool, + [] ?UseDefaults : bool ) = let r,t = Seq.unzip rTheta Chart.PointPolar( r, t, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?MarkerSymbol = MarkerSymbol, - ?Color = Color, - ?Opacity = Opacity, - ?Labels = Labels, - ?TextPosition = TextPosition, - ?TextFont = TextFont, - ?UseWebGL = UseWebGL, - ?UseDefaults = UseDefaults + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerSymbol = MarkerSymbol , + ?MultiMarkerSymbol = MultiMarkerSymbol, + ?Marker = Marker , + ?UseWebGL = UseWebGL , + ?UseDefaults = UseDefaults + ) /// [] static member LinePolar ( - r, theta, - [] ?Name, - [] ?ShowLegend, - [] ?ShowMarkers, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Dash, - [] ?Width, - [] ?UseWebGL, - [] ?UseDefaults : bool + r : seq<#IConvertible>, + theta : seq<#IConvertible>, + [] ?ShowMarkers : bool, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?LineColor : Color, + [] ?LineColorScale : StyleParam.Colorscale, + [] ?LineWidth : float, + [] ?LineDash : StyleParam.DrawingStyle, + [] ?Line : Line, + [] ?UseWebGL : bool, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true @@ -193,19 +288,45 @@ module ChartPolar = match ShowMarkers with | Some isShow -> isShow | Option.None -> false - StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + StyleParam.ModeUtils.showText (TextPosition.IsSome || MultiTextPosition.IsSome) >> StyleParam.ModeUtils.showMarker (isShowMarker) - let style = + let marker = + Marker + |> Option.defaultValue (TraceObjects.Marker.init()) + |> TraceObjects.Marker.style( + ?Color = MarkerColor, + ?Outline = MarkerOutline, + ?Symbol3D = MarkerSymbol, + ?MultiSymbol3D = MultiMarkerSymbol, + ?Colorscale = MarkerColorScale + ) + + let line = + Line + |> Option.defaultValue (Plotly.NET.Line.init()) + |> Plotly.NET.Line.style( + ?Color = LineColor, + ?Dash = LineDash, + ?Colorscale = LineColorScale, + ?Width = LineWidth + ) + + let style = TracePolarStyle.ScatterPolar( - R = r, - Theta = theta, - Mode = changeMode StyleParam.Mode.Lines + R = r , + Theta = theta , + Mode = changeMode StyleParam.Mode.Lines, + Marker = marker , + Line = line , + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition ) - >> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - >> TraceStyle.Line(?Color=Color,?Dash=Dash,?Width=Width) - >> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) - >> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) let useWebGL = defaultArg UseWebGL false @@ -215,60 +336,86 @@ module ChartPolar = [] static member LinePolar ( - rTheta, - [] ?Name, - [] ?ShowLegend, - [] ?ShowMarkers, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Dash, - [] ?Width, - [] ?UseWebGL, - [] ?UseDefaults : bool + rTheta : seq<#IConvertible * #IConvertible>, + [] ?ShowMarkers : bool, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?LineColor : Color, + [] ?LineColorScale : StyleParam.Colorscale, + [] ?LineWidth : float, + [] ?LineDash : StyleParam.DrawingStyle, + [] ?Line : Line, + [] ?UseWebGL : bool, + [] ?UseDefaults : bool ) = let r,t = Seq.unzip rTheta Chart.LinePolar( r, t, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?ShowMarkers = ShowMarkers, - ?MarkerSymbol = MarkerSymbol, - ?Color = Color, - ?Opacity = Opacity, - ?Labels = Labels, - ?TextPosition = TextPosition, - ?TextFont = TextFont, - ?Dash = Dash, - ?Width = Width, - ?UseWebGL = UseWebGL, - ?UseDefaults = UseDefaults + ?ShowMarkers = ShowMarkers , + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerSymbol = MarkerSymbol , + ?MultiMarkerSymbol = MultiMarkerSymbol, + ?Marker = Marker , + ?LineColor = LineColor , + ?LineColorScale = LineColorScale , + ?LineWidth = LineWidth , + ?LineDash = LineDash , + ?Line = Line , + ?UseWebGL = UseWebGL , + ?UseDefaults = UseDefaults + ) /// [] static member SplinePolar ( - r, theta, - [] ?Name, - [] ?ShowLegend, - [] ?ShowMarkers, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Smoothing, - [] ?Dash, - [] ?Width, - [] ?UseWebGL, - [] ?UseDefaults : bool + r : seq<#IConvertible>, + theta : seq<#IConvertible>, + [] ?ShowMarkers : bool, + [] ?Smoothing : float, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?LineColor : Color, + [] ?LineColorScale : StyleParam.Colorscale, + [] ?LineWidth : float, + [] ?LineDash : StyleParam.DrawingStyle, + [] ?Line : Line, + [] ?UseWebGL : bool, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true @@ -277,94 +424,163 @@ module ChartPolar = match ShowMarkers with | Some isShow -> isShow | Option.None -> false - StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + StyleParam.ModeUtils.showText (TextPosition.IsSome || MultiTextPosition.IsSome) >> StyleParam.ModeUtils.showMarker (isShowMarker) - let style = + let marker = + Marker + |> Option.defaultValue (TraceObjects.Marker.init()) + |> TraceObjects.Marker.style( + ?Color = MarkerColor, + ?Outline = MarkerOutline, + ?Symbol3D = MarkerSymbol, + ?MultiSymbol3D = MultiMarkerSymbol, + ?Colorscale = MarkerColorScale + ) + + let line = + Line + |> Option.defaultValue (Plotly.NET.Line.init()) + |> Plotly.NET.Line.style( + ?Color = LineColor, + ?Dash = LineDash, + ?Colorscale = LineColorScale, + ?Width = LineWidth, + ?Smoothing = Smoothing, + Shape = StyleParam.Shape.Spline + ) + + let style = TracePolarStyle.ScatterPolar( - R = r, - Theta = theta, - Mode = changeMode StyleParam.Mode.Lines + R = r , + Theta = theta , + Mode = changeMode StyleParam.Mode.Lines, + Marker = marker , + Line = line , + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition ) - >> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - >> TraceStyle.Line(?Color=Color,?Dash=Dash,?Width=Width, Shape=StyleParam.Shape.Spline, ?Smoothing=Smoothing) - >> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) - >> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - - let useWebGL = defaultArg UseWebGL false + let useWebGL = defaultArg UseWebGL false + Chart.renderScatterPolarTrace useDefaults useWebGL style /// [] static member SplinePolar ( - rTheta, - [] ?Name, - [] ?ShowLegend, - [] ?ShowMarkers, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Smoothing, - [] ?Dash, - [] ?Width, - [] ?UseWebGL, - [] ?UseDefaults : bool + rTheta : seq<#IConvertible * #IConvertible>, + [] ?ShowMarkers : bool, + [] ?Smoothing : float, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?LineColor : Color, + [] ?LineColorScale : StyleParam.Colorscale, + [] ?LineWidth : float, + [] ?LineDash : StyleParam.DrawingStyle, + [] ?Line : Line, + [] ?UseWebGL : bool, + [] ?UseDefaults : bool ) = let r,t = Seq.unzip rTheta Chart.SplinePolar( r, t, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?ShowMarkers = ShowMarkers, - ?MarkerSymbol = MarkerSymbol, - ?Color = Color, - ?Opacity = Opacity, - ?Labels = Labels, - ?TextPosition = TextPosition, - ?TextFont = TextFont, - ?Smoothing = Smoothing, - ?Dash = Dash, - ?Width = Width, - ?UseWebGL = UseWebGL, - ?UseDefaults = UseDefaults + ?ShowMarkers = ShowMarkers , + ?Smoothing = Smoothing , + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerSymbol = MarkerSymbol , + ?MultiMarkerSymbol = MultiMarkerSymbol, + ?Marker = Marker , + ?LineColor = LineColor , + ?LineColorScale = LineColorScale , + ?LineWidth = LineWidth , + ?LineDash = LineDash , + ?Line = Line , + ?UseWebGL = UseWebGL , + ?UseDefaults = UseDefaults + ) /// [] static member BubblePolar ( - r, theta, sizes:seq<#IConvertible>, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?UseWebGL, - [] ?UseDefaults : bool + r : seq<#IConvertible>, + theta : seq<#IConvertible>, + sizes : seq, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?UseWebGL : bool, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true - let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || MultiTextPosition.IsSome) + let marker = + Marker + |> Option.defaultValue (TraceObjects.Marker.init()) + |> TraceObjects.Marker.style( + ?Color = MarkerColor, + ?Outline = MarkerOutline, + ?Symbol3D = MarkerSymbol, + ?MultiSymbol3D = MultiMarkerSymbol, + ?Colorscale = MarkerColorScale, + MultiSize = sizes + ) + let style = TracePolarStyle.ScatterPolar( - R = r, - Theta = theta, - Mode = changeMode StyleParam.Mode.Markers + R = r , + Theta = theta , + Mode = StyleParam.Mode.Markers, + Marker = marker , + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition ) - >> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - >> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol,MultiSize=sizes) - >> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) let useWebGL = defaultArg UseWebGL false @@ -374,60 +590,150 @@ module ChartPolar = [] static member BubblePolar ( - rThetaSizes:seq<#IConvertible*#IConvertible*#IConvertible>, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?UseWebGL, - [] ?UseDefaults : bool + rThetaSizes:seq<#IConvertible*#IConvertible*int>, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?UseWebGL : bool, + [] ?UseDefaults : bool ) = let r,t,sizes = Seq.unzip3 rThetaSizes Chart.BubblePolar( r, t, sizes, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?MarkerSymbol = MarkerSymbol, - ?Color = Color, - ?Opacity = Opacity, - ?Labels = Labels, - ?TextPosition = TextPosition, - ?TextFont = TextFont, - ?UseWebGL = UseWebGL, - ?UseDefaults = UseDefaults + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerSymbol = MarkerSymbol , + ?MultiMarkerSymbol = MultiMarkerSymbol, + ?Marker = Marker , + ?UseWebGL = UseWebGL , + ?UseDefaults = UseDefaults + ) /// [] static member BarPolar ( - r, theta, - [] ?Name, - [] ?ShowLegend, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Dash, - [] ?LineWidth, - [] ?UseDefaults : bool + r : seq<#IConvertible>, + theta : seq<#IConvertible>, + [] ?Name : string , + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?MultiOpacity : seq, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?MarkerColor : Color , + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerPatternShape : StyleParam.PatternShape, + [] ?MultiMarkerPatternShape : seq, + [] ?MarkerPattern : Pattern, + [] ?Marker : Marker, + [] ?Base : #IConvertible, + [] ?Width : #IConvertible, + [] ?MultiWidth : seq<#IConvertible>, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true + + let pattern = + MarkerPattern + |> Option.defaultValue (TraceObjects.Pattern.init()) + |> TraceObjects.Pattern.style( + ?Shape = MarkerPatternShape, + ?MultiShape = MultiMarkerPatternShape + ) + let marker = + Marker + |> Option.defaultValue (TraceObjects.Marker.init()) + |> TraceObjects.Marker.style( + ?Color = MarkerColor, + Pattern = pattern, + ?MultiOpacity = MultiOpacity, + ?Colorscale = MarkerColorScale, + ?Outline = MarkerOutline + ) + TracePolar.initBarPolar( TracePolarStyle.BarPolar( - R = r, Theta = theta + R = r, Theta = theta, + Marker = marker, + ?Name = Name , + ?ShowLegend = ShowLegend, + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?Base = Base , + ?Width = Width , + ?MultiWidth = MultiWidth ) ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> TraceStyle.Line(?Color=Color,?Dash=Dash,?Width=LineWidth) - |> TraceStyle.Marker(?Color=Color) - |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject useDefaults \ No newline at end of file + |> GenericChart.ofTraceObject useDefaults + + [] + static member BarPolar + ( + rTheta : seq<#IConvertible * #IConvertible>, + [] ?Name : string , + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?MultiOpacity : seq, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?MarkerColor : Color , + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerPatternShape : StyleParam.PatternShape, + [] ?MultiMarkerPatternShape : seq, + [] ?MarkerPattern : Pattern, + [] ?Marker : Marker, + [] ?Base : #IConvertible, + [] ?Width : #IConvertible, + [] ?MultiWidth : seq<#IConvertible>, + [] ?UseDefaults : bool + ) = + + let r, theta = Seq.unzip rTheta + + Chart.BarPolar( + r, theta, + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?MultiOpacity = MultiOpacity , + ?Text = Text , + ?MultiText = MultiText , + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerPatternShape = MarkerPatternShape , + ?MultiMarkerPatternShape = MultiMarkerPatternShape, + ?MarkerPattern = MarkerPattern , + ?Marker = Marker , + ?Base = Base , + ?Width = Width , + ?MultiWidth = MultiWidth , + ?UseDefaults = UseDefaults + + ) \ No newline at end of file diff --git a/src/Plotly.NET/Traces/TracePolar.fs b/src/Plotly.NET/Traces/TracePolar.fs index 4bfd3b379..17e298e1c 100644 --- a/src/Plotly.NET/Traces/TracePolar.fs +++ b/src/Plotly.NET/Traces/TracePolar.fs @@ -62,15 +62,20 @@ type TracePolarStyle() = [] ?Theta0 : #IConvertible, [] ?DTheta : #IConvertible, [] ?ThetaUnit : StyleParam.AngularUnit, - [] ?Text : seq<#IConvertible>, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, [] ?TextPosition : StyleParam.TextPosition, - [] ?TextTemplate : seq<#IConvertible>, - [] ?HoverText : seq<#IConvertible>, - [] ?HoverInfo : string, - [] ?HoverTemplate : seq<#IConvertible>, + [] ?MultiTextPosition : seq, + [] ?TextTemplate : string, + [] ?MultiTextTemplate : seq, + [] ?HoverText : string, + [] ?MultiHoverText : seq, + [] ?HoverInfo : StyleParam.HoverInfo, + [] ?HoverTemplate : string, + [] ?MultiHoverTemplate : seq, [] ?Meta : seq<#IConvertible>, [] ?CustomData : seq<#IConvertible>, - [] ?Subplot : string, + [] ?Subplot : StyleParam.SubPlotId, [] ?Marker : Marker, [] ?Line : Line, [] ?TextFont : Font, @@ -87,44 +92,44 @@ type TracePolarStyle() = ) = (fun (trace:('T :> Trace)) -> - Name |> DynObj.setValueOpt trace "name" - Visible |> DynObj.setValueOptBy trace "visible" StyleParam.Visible.convert - ShowLegend |> DynObj.setValueOpt trace "showlegend" - LegendRank |> DynObj.setValueOpt trace "legendrank" - LegendGroup |> DynObj.setValueOpt trace "legendgroup" - LegendGroupTitle |> DynObj.setValueOpt trace "legendgrouptitle" - Opacity |> DynObj.setValueOpt trace "opacity" - Mode |> DynObj.setValueOptBy trace "mode" StyleParam.Mode.convert - Ids |> DynObj.setValueOpt trace "ids" - R |> DynObj.setValueOpt trace "r" - R0 |> DynObj.setValueOpt trace "r0" - DR |> DynObj.setValueOpt trace "dr" - Theta |> DynObj.setValueOpt trace "theta" - Theta0 |> DynObj.setValueOpt trace "theta0" - DTheta |> DynObj.setValueOpt trace "dtheta" - ThetaUnit |> DynObj.setValueOptBy trace "thetaunit" StyleParam.AngularUnit.convert - Text |> DynObj.setValueOpt trace "text" - TextPosition |> DynObj.setValueOptBy trace "textposition" StyleParam.TextPosition.convert - TextTemplate |> DynObj.setValueOpt trace "texttemplate" - HoverText |> DynObj.setValueOpt trace "hovertext" - HoverInfo |> DynObj.setValueOpt trace "hoverinfo" - HoverTemplate |> DynObj.setValueOpt trace "hovertemplate" - Meta |> DynObj.setValueOpt trace "meta" - CustomData |> DynObj.setValueOpt trace "customdata" - Subplot |> DynObj.setValueOpt trace "subplot" - Marker |> DynObj.setValueOpt trace "marker" - Line |> DynObj.setValueOpt trace "line" - TextFont |> DynObj.setValueOpt trace "textfont" - SelectedPoints |> DynObj.setValueOpt trace "selectedpoints" - Selected |> DynObj.setValueOpt trace "selected" - Unselected |> DynObj.setValueOpt trace "unselected" - ClipOnAxis |> DynObj.setValueOpt trace "cliponaxis" - ConnectGaps |> DynObj.setValueOpt trace "connectgaps" - Fill |> DynObj.setValueOptBy trace "fill" StyleParam.Fill.convert - FillColor |> DynObj.setValueOpt trace "fillcolor" - HoverLabel |> DynObj.setValueOpt trace "hoverlabel" - HoverOn |> DynObj.setValueOpt trace "hoveron" - UIRevision |> DynObj.setValueOpt trace "uirevision" + Name |> DynObj.setValueOpt trace "name" + Visible |> DynObj.setValueOptBy trace "visible" StyleParam.Visible.convert + ShowLegend |> DynObj.setValueOpt trace "showlegend" + LegendRank |> DynObj.setValueOpt trace "legendrank" + LegendGroup |> DynObj.setValueOpt trace "legendgroup" + LegendGroupTitle |> DynObj.setValueOpt trace "legendgrouptitle" + Opacity |> DynObj.setValueOpt trace "opacity" + Mode |> DynObj.setValueOptBy trace "mode" StyleParam.Mode.convert + Ids |> DynObj.setValueOpt trace "ids" + R |> DynObj.setValueOpt trace "r" + R0 |> DynObj.setValueOpt trace "r0" + DR |> DynObj.setValueOpt trace "dr" + Theta |> DynObj.setValueOpt trace "theta" + Theta0 |> DynObj.setValueOpt trace "theta0" + DTheta |> DynObj.setValueOpt trace "dtheta" + ThetaUnit |> DynObj.setValueOptBy trace "thetaunit" StyleParam.AngularUnit.convert + (Text, MultiText) |> DynObj.setSingleOrMultiOpt trace "text" + (TextPosition, MultiTextPosition) |> DynObj.setSingleOrMultiOptBy trace "textposition" StyleParam.TextPosition.convert + (TextTemplate, MultiTextTemplate) |> DynObj.setSingleOrMultiOpt trace "texttemplate" + (HoverText, MultiHoverText) |> DynObj.setSingleOrMultiOpt trace "hovertext" + HoverInfo |> DynObj.setValueOptBy trace "hoverinfo" StyleParam.HoverInfo.convert + (HoverTemplate, MultiHoverTemplate) |> DynObj.setSingleOrMultiOpt trace "hovertemplate" + Meta |> DynObj.setValueOpt trace "meta" + CustomData |> DynObj.setValueOpt trace "customdata" + Subplot |> DynObj.setValueOptBy trace "subplot" StyleParam.SubPlotId.convert + Marker |> DynObj.setValueOpt trace "marker" + Line |> DynObj.setValueOpt trace "line" + TextFont |> DynObj.setValueOpt trace "textfont" + SelectedPoints |> DynObj.setValueOpt trace "selectedpoints" + Selected |> DynObj.setValueOpt trace "selected" + Unselected |> DynObj.setValueOpt trace "unselected" + ClipOnAxis |> DynObj.setValueOpt trace "cliponaxis" + ConnectGaps |> DynObj.setValueOpt trace "connectgaps" + Fill |> DynObj.setValueOptBy trace "fill" StyleParam.Fill.convert + FillColor |> DynObj.setValueOpt trace "fillcolor" + HoverLabel |> DynObj.setValueOpt trace "hoverlabel" + HoverOn |> DynObj.setValueOpt trace "hoveron" + UIRevision |> DynObj.setValueOpt trace "uirevision" trace ) @@ -148,14 +153,18 @@ type TracePolarStyle() = [] ?DTheta : #IConvertible, [] ?ThetaUnit : StyleParam.AngularUnit, [] ?Width : #IConvertible, + [] ?MultiWidth : seq<#IConvertible>, [] ?Offset : #IConvertible, - [] ?Text : seq<#IConvertible>, - [] ?HoverText : seq<#IConvertible>, - [] ?HoverInfo : string, - [] ?HoverTemplate : seq<#IConvertible>, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?HoverText : string, + [] ?MultiHoverText : seq, + [] ?HoverInfo : StyleParam.HoverInfo, + [] ?HoverTemplate : string, + [] ?MultiHoverTemplate : seq, [] ?Meta : seq<#IConvertible>, [] ?CustomData : seq<#IConvertible>, - [] ?Subplot : string, + [] ?Subplot : StyleParam.SubPlotId, [] ?Marker : Marker, [] ?SelectedPoints : seq<#IConvertible>, [] ?Selected : Selection, @@ -165,37 +174,37 @@ type TracePolarStyle() = ) = (fun (trace:('T :> Trace)) -> - Name |> DynObj.setValueOpt trace "name" - Visible |> DynObj.setValueOptBy trace "visible" StyleParam.Visible.convert - ShowLegend |> DynObj.setValueOpt trace "showlegend" - LegendRank |> DynObj.setValueOpt trace "legendrank" - LegendGroup |> DynObj.setValueOpt trace "legendgroup" - LegendGroupTitle |> DynObj.setValueOpt trace "legendgrouptitle" - Opacity |> DynObj.setValueOpt trace "opacity" - Ids |> DynObj.setValueOpt trace "ids" - Base |> DynObj.setValueOpt trace "base" - R |> DynObj.setValueOpt trace "r" - R0 |> DynObj.setValueOpt trace "r0" - DR |> DynObj.setValueOpt trace "dr" - Theta |> DynObj.setValueOpt trace "theta" - Theta0 |> DynObj.setValueOpt trace "theta0" - DTheta |> DynObj.setValueOpt trace "dtheta" - ThetaUnit |> DynObj.setValueOptBy trace "thetaunit" StyleParam.AngularUnit.convert - Width |> DynObj.setValueOpt trace "width" - Offset |> DynObj.setValueOpt trace "offset" - Text |> DynObj.setValueOpt trace "text" - HoverText |> DynObj.setValueOpt trace "hovertext" - HoverInfo |> DynObj.setValueOpt trace "hoverinfo" - HoverTemplate |> DynObj.setValueOpt trace "hovertemplate" - Meta |> DynObj.setValueOpt trace "meta" - CustomData |> DynObj.setValueOpt trace "customdata" - Subplot |> DynObj.setValueOpt trace "subplot" - Marker |> DynObj.setValueOpt trace "marker" - SelectedPoints |> DynObj.setValueOpt trace "selectedpoints" - Selected |> DynObj.setValueOpt trace "selected" - Unselected |> DynObj.setValueOpt trace "unselected" - HoverLabel |> DynObj.setValueOpt trace "hoverlabel" - UIRevision |> DynObj.setValueOpt trace "uirevision" + Name |> DynObj.setValueOpt trace "name" + Visible |> DynObj.setValueOptBy trace "visible" StyleParam.Visible.convert + ShowLegend |> DynObj.setValueOpt trace "showlegend" + LegendRank |> DynObj.setValueOpt trace "legendrank" + LegendGroup |> DynObj.setValueOpt trace "legendgroup" + LegendGroupTitle |> DynObj.setValueOpt trace "legendgrouptitle" + Opacity |> DynObj.setValueOpt trace "opacity" + Ids |> DynObj.setValueOpt trace "ids" + Base |> DynObj.setValueOpt trace "base" + R |> DynObj.setValueOpt trace "r" + R0 |> DynObj.setValueOpt trace "r0" + DR |> DynObj.setValueOpt trace "dr" + Theta |> DynObj.setValueOpt trace "theta" + Theta0 |> DynObj.setValueOpt trace "theta0" + DTheta |> DynObj.setValueOpt trace "dtheta" + ThetaUnit |> DynObj.setValueOptBy trace "thetaunit" StyleParam.AngularUnit.convert + (Width, MultiWidth) |> DynObj.setSingleOrMultiOpt trace "width" + Offset |> DynObj.setValueOpt trace "offset" + (Text, MultiText) |> DynObj.setSingleOrMultiOpt trace "text" + (HoverText, MultiHoverText) |> DynObj.setSingleOrMultiOpt trace "hovertext" + HoverInfo |> DynObj.setValueOptBy trace "hoverinfo" StyleParam.HoverInfo.convert + (HoverTemplate, MultiHoverTemplate) |> DynObj.setSingleOrMultiOpt trace "hovertemplate" + Meta |> DynObj.setValueOpt trace "meta" + CustomData |> DynObj.setValueOpt trace "customdata" + Subplot |> DynObj.setValueOptBy trace "subplot" StyleParam.SubPlotId.convert + Marker |> DynObj.setValueOpt trace "marker" + SelectedPoints |> DynObj.setValueOpt trace "selectedpoints" + Selected |> DynObj.setValueOpt trace "selected" + Unselected |> DynObj.setValueOpt trace "unselected" + HoverLabel |> DynObj.setValueOpt trace "hoverlabel" + UIRevision |> DynObj.setValueOpt trace "uirevision" trace ) \ No newline at end of file diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/PolarCharts.fs b/tests/Plotly.NET.Tests/HtmlCodegen/PolarCharts.fs index 2434b491b..5b079eeb1 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/PolarCharts.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/PolarCharts.fs @@ -25,12 +25,34 @@ let splinePolar = Chart.SplinePolar( radial, theta, - Labels=["one";"two";"three";"four";"five";"six";"seven"], + MultiText=["one";"two";"three";"four";"five";"six";"seven"], TextPosition=StyleParam.TextPosition.TopCenter, ShowMarkers=true, UseDefaults = false ) +let barPolar = + let r = [77.5; 72.5; 70.0; 45.0; 22.5; 42.5; 40.0; 62.5] + let r2 = [57.5; 50.0; 45.0; 35.0; 20.0; 22.5; 37.5; 55.0] + let r3 = [40.0; 30.0; 30.0; 35.0; 7.5; 7.5; 32.5; 40.0] + let r4 = [20.0; 7.5; 15.0; 22.5; 2.5; 2.5; 12.5; 22.5] + + let t = ["North"; "N-E"; "East"; "S-E"; "South"; "S-W"; "West"; "N-W"] + + [ + Chart.BarPolar (r , t, Name="11-14 m/s" , MarkerPatternShape = StyleParam.PatternShape.Checked , UseDefaults = false) + Chart.BarPolar (r2, t, Name="8-11 m/s" , MarkerPatternShape = StyleParam.PatternShape.DiagonalChecked, UseDefaults = false) + Chart.BarPolar (r3, t, Name="5-8 m/s" , MarkerPatternShape = StyleParam.PatternShape.VerticalLines , UseDefaults = false) + Chart.BarPolar (r4, t, Name="< 5 m/s" , MarkerPatternShape = StyleParam.PatternShape.HorizontalLines, UseDefaults = false) + ] + |> Chart.combine + |> Chart.withAngularAxis( + AngularAxis.init( + CategoryOrder = StyleParam.CategoryOrder.Array, + CategoryArray = (["East"; "N-E"; "North"; "N-W"; "West"; "S-W"; "South"; "S-E";]) // set the order of the categorical axis + ) + ) + [] let ``Polar charts`` = testList "PolarCharts.Polar charts" [ @@ -42,18 +64,26 @@ let ``Polar charts`` = emptyLayout pointPolar ); testCase "Polar Line data" ( fun () -> - """var data = [{"type":"scatterpolar","mode":"lines","r":[1,2,3,4,5,6,7],"theta":[0,45,90,135,200,320,184],"line":{"color":"purple","dash":"dashdot"},"marker":{}}];""" + """var data = [{"type":"scatterpolar","mode":"lines","r":[1,2,3,4,5,6,7],"theta":[0,45,90,135,200,320,184],"marker":{},"line":{"color":"purple","dash":"dashdot"}}];""" |> chartGeneratedContains linePolar ); testCase "Polar Line layout" ( fun () -> emptyLayout linePolar ); testCase "Polar Spline data" ( fun () -> - """var data = [{"type":"scatterpolar","mode":"lines+markers+text","r":[1,2,3,4,5,6,7],"theta":[0,45,90,135,200,320,184],"line":{"shape":"spline"},"marker":{},"text":["one","two","three","four","five","six","seven"],"textposition":"top center"}];""" + """var data = [{"type":"scatterpolar","mode":"lines+markers+text","r":[1,2,3,4,5,6,7],"theta":[0,45,90,135,200,320,184],"text":["one","two","three","four","five","six","seven"],"textposition":"top center","marker":{},"line":{"shape":"spline"}}];""" |> chartGeneratedContains splinePolar ); testCase "Polar Spline layout" ( fun () -> emptyLayout splinePolar + ); + testCase "Polar Bar data" ( fun () -> + """var data = [{"type":"barpolar","name":"11-14 m/s","r":[77.5,72.5,70.0,45.0,22.5,42.5,40.0,62.5],"theta":["North","N-E","East","S-E","South","S-W","West","N-W"],"marker":{"pattern":{"shape":"+"}}},{"type":"barpolar","name":"8-11 m/s","r":[57.5,50.0,45.0,35.0,20.0,22.5,37.5,55.0],"theta":["North","N-E","East","S-E","South","S-W","West","N-W"],"marker":{"pattern":{"shape":"x"}}},{"type":"barpolar","name":"5-8 m/s","r":[40.0,30.0,30.0,35.0,7.5,7.5,32.5,40.0],"theta":["North","N-E","East","S-E","South","S-W","West","N-W"],"marker":{"pattern":{"shape":"|"}}},{"type":"barpolar","name":"< 5 m/s","r":[20.0,7.5,15.0,22.5,2.5,2.5,12.5,22.5],"theta":["North","N-E","East","S-E","South","S-W","West","N-W"],"marker":{"pattern":{"shape":"-"}}}];""" + |> chartGeneratedContains barPolar + ); + testCase "Polar Bar layout" ( fun () -> + """var layout = {"polar":{"angularaxis":{"categoryorder":"array","categoryarray":["East","N-E","North","N-W","West","S-W","South","S-E"]}}};""" + |> chartGeneratedContains barPolar ); ]