Skip to content

Commit 1d8e9e5

Browse files
committed
Add encoded subplot and domain chart roots
Add encoded-only top-level chart overloads for the remaining subplot and domain families covered by H1-G. Summary: - add encoded root overloads for ScatterPolar, ScatterGeo, ScatterMapbox, ScatterTernary, ScatterSmith, Carpet, ScatterCarpet, and ContourCarpet - add encoded root overloads for Pie, Sunburst, and Treemap - add chart-level unit coverage for subplot/domain chart-root encoded serialization - add matching Plotly.js 2.28 upstream fixtures and HTML assertions for the new chart-root constructors - replace the FSharpConsole sample with a focused encoded Treemap root demo - intentionally defer Sankey because its meaningful encoded payloads live inside nested node/link objects rather than the current top-level root signature Verification: - .\build.cmd runTestsCore - 886 tests passed
1 parent 045a2b6 commit 1d8e9e5

File tree

10 files changed

+1554
-11
lines changed

10 files changed

+1554
-11
lines changed

src/Plotly.NET/ChartAPI/ChartCarpet.fs

Lines changed: 263 additions & 0 deletions
Large diffs are not rendered by default.

src/Plotly.NET/ChartAPI/ChartDomain.fs

Lines changed: 367 additions & 0 deletions
Large diffs are not rendered by default.

src/Plotly.NET/ChartAPI/ChartMap.fs

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,115 @@ module ChartMap =
190190

191191
|> GenericChart.ofTraceObject useDefaults
192192

193+
/// <summary>
194+
/// Creates a ScatterGeo chart from encoded longitude and latitude coordinates.
195+
/// </summary>
196+
/// <param name="longitudesEncoded">Sets the longitude coordinates (in degrees East) as an encoded typed array.</param>
197+
/// <param name="latitudesEncoded">Sets the latitude coordinates (in degrees North) as an encoded typed array.</param>
198+
/// <param name="mode">Determines the drawing mode for this scatter trace.</param>
199+
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover</param>
200+
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
201+
/// <param name="Opacity">Sets the opactity of the trace</param>
202+
/// <param name="MultiOpacity">Sets the opactity of individual datum markers</param>
203+
/// <param name="Text">Sets a text associated with each datum</param>
204+
/// <param name="MultiText">Sets individual text for each datum</param>
205+
/// <param name="TextPosition">Sets the position of text associated with each datum</param>
206+
/// <param name="MultiTextPosition">Sets the position of text associated with individual datum</param>
207+
/// <param name="MarkerColor">Sets the color of the marker</param>
208+
/// <param name="MarkerColorScale">Sets the colorscale of the marker</param>
209+
/// <param name="MarkerOutline">Sets the outline of the marker</param>
210+
/// <param name="MarkerSymbol">Sets the marker symbol for each datum</param>
211+
/// <param name="MultiMarkerSymbol">Sets the marker symbol for each individual datum</param>
212+
/// <param name="Marker">Sets the marker (use this for more finegrained control than the other marker-associated arguments)</param>
213+
/// <param name="LineColor">Sets the color of the line</param>
214+
/// <param name="LineColorScale">Sets the colorscale of the line</param>
215+
/// <param name="LineWidth">Sets the width of the line</param>
216+
/// <param name="LineDash">sets the drawing style of the line</param>
217+
/// <param name="Line">Sets the line (use this for more finegrained control than the other line-associated arguments)</param>
218+
/// <param name="LocationMode">Determines the set of locations used to match entries in `locations` to regions on the map. Values "ISO-3", "USA-states", "country names" correspond to features on the base map and value "geojson-id" corresponds to features from a custom GeoJSON linked to the `geojson` attribute.</param>
219+
/// <param name="GeoJson">Sets optional GeoJSON data associated with this trace. If not given, the features on the base map are used. It can be set as a valid GeoJSON object or as a URL string. Note that we only accept GeoJSONs of type "FeatureCollection" or "Feature" with geometries of type "Polygon" or "MultiPolygon".</param>
220+
/// <param name="FeatureIdKey">Sets the key in GeoJSON features which is used as id to match the items included in the `locations` array. Only has an effect when `geojson` is set. Support nested property, for example "properties.name".</param>
221+
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
222+
[<Extension>]
223+
static member ScatterGeo
224+
(
225+
longitudesEncoded: EncodedTypedArray,
226+
latitudesEncoded: EncodedTypedArray,
227+
mode: StyleParam.Mode,
228+
?Name: string,
229+
?ShowLegend: bool,
230+
?Opacity: float,
231+
?MultiOpacity: seq<float>,
232+
?Text: #IConvertible,
233+
?MultiText: seq<#IConvertible>,
234+
?TextPosition: StyleParam.TextPosition,
235+
?MultiTextPosition: seq<StyleParam.TextPosition>,
236+
?MarkerColor: Color,
237+
?MarkerColorScale: StyleParam.Colorscale,
238+
?MarkerOutline: Line,
239+
?MarkerSymbol: StyleParam.MarkerSymbol,
240+
?MultiMarkerSymbol: seq<StyleParam.MarkerSymbol>,
241+
?Marker: Marker,
242+
?LineColor: Color,
243+
?LineColorScale: StyleParam.Colorscale,
244+
?LineWidth: float,
245+
?LineDash: StyleParam.DrawingStyle,
246+
?Line: Line,
247+
?LocationMode: StyleParam.LocationFormat,
248+
?GeoJson: obj,
249+
?FeatureIdKey: string,
250+
?UseDefaults: bool
251+
) =
252+
253+
let useDefaults =
254+
defaultArg UseDefaults true
255+
256+
let marker =
257+
Marker
258+
|> Option.defaultValue (TraceObjects.Marker.init ())
259+
|> TraceObjects.Marker.style (
260+
?Color = MarkerColor,
261+
?Outline = MarkerOutline,
262+
?Symbol = MarkerSymbol,
263+
?MultiSymbol = MultiMarkerSymbol,
264+
?Colorscale = MarkerColorScale,
265+
?MultiOpacity = MultiOpacity
266+
)
267+
268+
let line =
269+
Line
270+
|> Option.defaultValue (Plotly.NET.Line.init ())
271+
|> Plotly.NET.Line.style (
272+
?Color = LineColor,
273+
?Dash = LineDash,
274+
?Colorscale = LineColorScale,
275+
?Width = LineWidth
276+
)
277+
278+
279+
TraceGeo.initScatterGeo (
280+
TraceGeoStyle.ScatterGeo(
281+
LonEncoded = longitudesEncoded,
282+
LatEncoded = latitudesEncoded,
283+
Mode = mode,
284+
Marker = marker,
285+
Line = line,
286+
?Name = Name,
287+
?ShowLegend = ShowLegend,
288+
?Opacity = Opacity,
289+
?Text = Text,
290+
?MultiText = MultiText,
291+
?TextPosition = TextPosition,
292+
?MultiTextPosition = MultiTextPosition,
293+
?LocationMode = LocationMode,
294+
?GeoJson = GeoJson,
295+
?FeatureIdKey = FeatureIdKey
296+
297+
)
298+
)
299+
300+
|> GenericChart.ofTraceObject useDefaults
301+
193302

194303
/// <summary>
195304
/// Creates a ScatterGeo chart, where data is visualized using plotly's base geo map.
@@ -1276,6 +1385,126 @@ module ChartMap =
12761385
|> GenericChart.ofTraceObject useDefaults
12771386
|> GenericChart.addLayout (Layout.init () |> Layout.setMapbox (StyleParam.SubPlotId.Mapbox 1, mapbox))
12781387

1388+
/// <summary>
1389+
/// Creates a ScatterMapbox chart from encoded longitude and latitude coordinates.
1390+
/// </summary>
1391+
/// <param name="longitudesEncoded">Sets the longitude coordinates (in degrees East) as an encoded typed array.</param>
1392+
/// <param name="latitudesEncoded">Sets the latitude coordinates (in degrees North) as an encoded typed array.</param>
1393+
/// <param name="mode">Determines the drawing mode for this scatter trace.</param>
1394+
/// <param name="MapboxStyle">Sets the base mapbox layer. Default is `OpenStreetMap`. Note that you will need an access token for some Mapbox presets.</param>
1395+
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover</param>
1396+
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
1397+
/// <param name="Opacity">Sets the opactity of the trace</param>
1398+
/// <param name="MultiOpacity">Sets the opactity of individual datum markers</param>
1399+
/// <param name="Text">Sets a text associated with each datum</param>
1400+
/// <param name="MultiText">Sets individual text for each datum</param>
1401+
/// <param name="TextPosition">Sets the position of text associated with each datum</param>
1402+
/// <param name="MultiTextPosition">Sets the position of text associated with individual datum</param>
1403+
/// <param name="MarkerColor">Sets the color of the marker</param>
1404+
/// <param name="MarkerColorScale">Sets the colorscale of the marker</param>
1405+
/// <param name="MarkerOutline">Sets the outline of the marker</param>
1406+
/// <param name="MarkerSymbol">Sets the marker symbol for each datum</param>
1407+
/// <param name="MultiMarkerSymbol">Sets the marker symbol for each individual datum</param>
1408+
/// <param name="Marker">Sets the marker (use this for more finegrained control than the other marker-associated arguments)</param>
1409+
/// <param name="LineColor">Sets the color of the line</param>
1410+
/// <param name="LineColorScale">Sets the colorscale of the line</param>
1411+
/// <param name="LineWidth">Sets the width of the line</param>
1412+
/// <param name="LineDash">sets the drawing style of the line</param>
1413+
/// <param name="Line">Sets the line (use this for more finegrained control than the other line-associated arguments)</param>
1414+
/// <param name="Below">Determines if this scattermapbox trace's layers are to be inserted before the layer with the specified ID. By default, scattermapbox layers are inserted above all the base layers. To place the scattermapbox layers above every other layer, set `below` to "''".</param>
1415+
/// <param name="EnableClustering">Whether or not to enable clustering for points</param>
1416+
/// <param name="Cluster">Sets the clustering options (use this for more finegrained control than the other cluster-associated arguments)</param>
1417+
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
1418+
[<Extension>]
1419+
static member ScatterMapbox
1420+
(
1421+
longitudesEncoded: EncodedTypedArray,
1422+
latitudesEncoded: EncodedTypedArray,
1423+
mode: StyleParam.Mode,
1424+
?MapboxStyle: StyleParam.MapboxStyle,
1425+
?Name: string,
1426+
?ShowLegend: bool,
1427+
?Opacity: float,
1428+
?MultiOpacity: seq<float>,
1429+
?Text: #IConvertible,
1430+
?MultiText: seq<#IConvertible>,
1431+
?TextPosition: StyleParam.TextPosition,
1432+
?MultiTextPosition: seq<StyleParam.TextPosition>,
1433+
?MarkerColor: Color,
1434+
?MarkerColorScale: StyleParam.Colorscale,
1435+
?MarkerOutline: Line,
1436+
?MarkerSymbol: StyleParam.MarkerSymbol,
1437+
?MultiMarkerSymbol: seq<StyleParam.MarkerSymbol>,
1438+
?Marker: Marker,
1439+
?LineColor: Color,
1440+
?LineColorScale: StyleParam.Colorscale,
1441+
?LineWidth: float,
1442+
?LineDash: StyleParam.DrawingStyle,
1443+
?Line: Line,
1444+
?Below: string,
1445+
?EnableClustering: bool,
1446+
?Cluster: MapboxCluster,
1447+
?UseDefaults: bool
1448+
) =
1449+
1450+
1451+
let useDefaults =
1452+
defaultArg UseDefaults true
1453+
1454+
let marker =
1455+
Marker
1456+
|> Option.defaultValue (TraceObjects.Marker.init ())
1457+
|> TraceObjects.Marker.style (
1458+
?Color = MarkerColor,
1459+
?Outline = MarkerOutline,
1460+
?Symbol = MarkerSymbol,
1461+
?MultiSymbol = MultiMarkerSymbol,
1462+
?Colorscale = MarkerColorScale,
1463+
?MultiOpacity = MultiOpacity
1464+
)
1465+
1466+
let line =
1467+
Line
1468+
|> Option.defaultValue (Plotly.NET.Line.init ())
1469+
|> Plotly.NET.Line.style (
1470+
?Color = LineColor,
1471+
?Dash = LineDash,
1472+
?Colorscale = LineColorScale,
1473+
?Width = LineWidth
1474+
)
1475+
1476+
let cluster =
1477+
Cluster
1478+
|> Option.defaultValue (MapboxCluster.init ())
1479+
|> MapboxCluster.style (?Enabled = EnableClustering)
1480+
1481+
let mapboxStyle =
1482+
defaultArg MapboxStyle StyleParam.MapboxStyle.OpenStreetMap
1483+
1484+
let mapbox =
1485+
Mapbox.init (Style = mapboxStyle)
1486+
1487+
TraceMapbox.initScatterMapbox (
1488+
TraceMapboxStyle.ScatterMapbox(
1489+
LonEncoded = longitudesEncoded,
1490+
LatEncoded = latitudesEncoded,
1491+
Cluster = cluster,
1492+
Mode = mode,
1493+
Marker = marker,
1494+
Line = line,
1495+
?Name = Name,
1496+
?ShowLegend = ShowLegend,
1497+
?Opacity = Opacity,
1498+
?Text = Text,
1499+
?MultiText = MultiText,
1500+
?TextPosition = TextPosition,
1501+
?MultiTextPosition = MultiTextPosition,
1502+
?Below = Below
1503+
)
1504+
)
1505+
|> GenericChart.ofTraceObject useDefaults
1506+
|> GenericChart.addLayout (Layout.init () |> Layout.setMapbox (StyleParam.SubPlotId.Mapbox 1, mapbox))
1507+
12791508
/// <summary>
12801509
/// Creates a ScatterMapbox chart, where data is visualized on a geographic map using mapbox.
12811510
///

src/Plotly.NET/ChartAPI/ChartPolar.fs

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,107 @@ module ChartPolar =
132132

133133
Chart.renderScatterPolarTrace useDefaults useWebGL style
134134

135+
/// <summary>
136+
/// Creates a polar scatter plot from encoded radial and angular coordinates.
137+
/// </summary>
138+
/// <param name="rEncoded">Sets the radial coordinates of the plotted data as an encoded typed array.</param>
139+
/// <param name="thetaEncoded">Sets the angular coordinates of the plotted data as an encoded typed array.</param>
140+
/// <param name="mode">Determines the drawing mode for this scatter trace.</param>
141+
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover</param>
142+
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
143+
/// <param name="Opacity">Sets the opactity of the trace</param>
144+
/// <param name="MultiOpacity">Sets the opactity of individual datum markers</param>
145+
/// <param name="Text">Sets a text associated with each datum</param>
146+
/// <param name="MultiText">Sets individual text for each datum</param>
147+
/// <param name="TextPosition">Sets the position of text associated with each datum</param>
148+
/// <param name="MultiTextPosition">Sets the position of text associated with individual datum</param>
149+
/// <param name="MarkerColor">Sets the color of the marker</param>
150+
/// <param name="MarkerColorScale">Sets the colorscale of the marker</param>
151+
/// <param name="MarkerOutline">Sets the outline of the marker</param>
152+
/// <param name="MarkerSymbol">Sets the marker symbol for each datum</param>
153+
/// <param name="MultiMarkerSymbol">Sets the marker symbol for each individual datum</param>
154+
/// <param name="Marker">Sets the marker (use this for more finegrained control than the other marker-associated arguments)</param>
155+
/// <param name="LineColor">Sets the color of the line</param>
156+
/// <param name="LineColorScale">Sets the colorscale of the line</param>
157+
/// <param name="LineWidth">Sets the width of the line</param>
158+
/// <param name="LineDash">sets the drawing style of the line</param>
159+
/// <param name="Line">Sets the line (use this for more finegrained control than the other line-associated arguments)</param>
160+
/// <param name="UseWebGL">If true, plotly.js will use the WebGL engine to render this chart. use this when you want to render many objects at once.</param>
161+
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
162+
[<Extension>]
163+
static member ScatterPolar
164+
(
165+
rEncoded: EncodedTypedArray,
166+
thetaEncoded: EncodedTypedArray,
167+
mode: StyleParam.Mode,
168+
?Name: string,
169+
?ShowLegend: bool,
170+
?Opacity: float,
171+
?MultiOpacity: seq<float>,
172+
?Text: #IConvertible,
173+
?MultiText: seq<#IConvertible>,
174+
?TextPosition: StyleParam.TextPosition,
175+
?MultiTextPosition: seq<StyleParam.TextPosition>,
176+
?MarkerColor: Color,
177+
?MarkerColorScale: StyleParam.Colorscale,
178+
?MarkerOutline: Line,
179+
?MarkerSymbol: StyleParam.MarkerSymbol3D,
180+
?MultiMarkerSymbol: seq<StyleParam.MarkerSymbol3D>,
181+
?Marker: Marker,
182+
?LineColor: Color,
183+
?LineColorScale: StyleParam.Colorscale,
184+
?LineWidth: float,
185+
?LineDash: StyleParam.DrawingStyle,
186+
?Line: Line,
187+
?UseWebGL: bool,
188+
?UseDefaults: bool
189+
) =
190+
191+
let useDefaults =
192+
defaultArg UseDefaults true
193+
194+
let marker =
195+
Marker
196+
|> Option.defaultValue (TraceObjects.Marker.init ())
197+
|> TraceObjects.Marker.style (
198+
?Color = MarkerColor,
199+
?Outline = MarkerOutline,
200+
?Symbol3D = MarkerSymbol,
201+
?MultiSymbol3D = MultiMarkerSymbol,
202+
?Colorscale = MarkerColorScale,
203+
?MultiOpacity = MultiOpacity
204+
)
205+
206+
let line =
207+
Line
208+
|> Option.defaultValue (Plotly.NET.Line.init ())
209+
|> Plotly.NET.Line.style (
210+
?Color = LineColor,
211+
?Dash = LineDash,
212+
?Colorscale = LineColorScale,
213+
?Width = LineWidth
214+
)
215+
216+
let style =
217+
TracePolarStyle.ScatterPolar(
218+
REncoded = rEncoded,
219+
ThetaEncoded = thetaEncoded,
220+
Mode = mode,
221+
Marker = marker,
222+
Line = line,
223+
?Name = Name,
224+
?ShowLegend = ShowLegend,
225+
?Opacity = Opacity,
226+
?Text = Text,
227+
?MultiText = MultiText,
228+
?TextPosition = TextPosition,
229+
?MultiTextPosition = MultiTextPosition
230+
)
231+
232+
let useWebGL = defaultArg UseWebGL false
233+
234+
Chart.renderScatterPolarTrace useDefaults useWebGL style
235+
135236
/// <summary>
136237
/// Creates a polar scatter plot.
137238
///

0 commit comments

Comments
 (0)