From f9e14fb616b1815487f002ebc35ad8bbde3b110f Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Sun, 9 Jul 2023 13:07:32 +0200 Subject: [PATCH] plotly.js v2.19.0: Add LabelAlias to various axes(plotly/plotly.js#6481) --- src/Plotly.NET/CommonAbstractions/ColorBar.fs | 6 ++ .../ObjectAbstractions/Common/LinearAxis.fs | 15 +++ .../ObjectAbstractions/Polar/AngularAxis.fs | 6 ++ .../ObjectAbstractions/Polar/RadialAxis.fs | 6 ++ .../ObjectAbstractions/Smith/ImaginaryAxis.fs | 6 ++ .../ObjectAbstractions/Smith/RealAxis.fs | 6 ++ .../TestCharts/UpstreamFeatures/2.19.fs | 73 ++++++++++++- tests/ConsoleApps/FSharpConsole/Program.fs | 100 ++++++++++++------ .../CoreTests/UpstreamFeatures/2.19.fs | 70 ++++++++++++ 9 files changed, 252 insertions(+), 36 deletions(-) diff --git a/src/Plotly.NET/CommonAbstractions/ColorBar.fs b/src/Plotly.NET/CommonAbstractions/ColorBar.fs index 22a9ceba5..34e6b0c35 100644 --- a/src/Plotly.NET/CommonAbstractions/ColorBar.fs +++ b/src/Plotly.NET/CommonAbstractions/ColorBar.fs @@ -17,6 +17,7 @@ type ColorBar() = /// Sets the width (in px) or the border enclosing this color bar. /// Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to "log" and "date" axes. If the axis `type` is "log", then ticks are set every 10^(n"dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. "log" has several special values; "L<f>", where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = "L0.5" will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use "D1" (all digits) or "D2" (only 2 and 5). `tick0` is ignored for "D1" and "D2". If the axis `type` is "date", then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. "date" also has special values "M<n>" gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to "2000-01-15" and `dtick` to "M3". To set ticks every 4 years, set `dtick` to "M48" /// Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If "none", it appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If "power", 1x10^9 (with 9 in a super script). If "SI", 1G. If "B", 1B. + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends. /// Determines whether this color bar's length (i.e. the measure in the color variation direction) is set in units of plot "fraction" or in "pixels. Use `len` to set the value. /// Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is "SI" or "B". @@ -61,6 +62,7 @@ type ColorBar() = [] ?BorderWidth: float, [] ?DTick: IConvertible, [] ?ExponentFormat: StyleParam.ExponentFormat, + [] ?LabelAlias: DynamicObj, [] ?Len: float, [] ?LenMode: StyleParam.UnitMode, [] ?MinExponent: float, @@ -107,6 +109,7 @@ type ColorBar() = ?BorderWidth = BorderWidth, ?DTick = DTick, ?ExponentFormat = ExponentFormat, + ?LabelAlias = LabelAlias, ?Len = Len, ?LenMode = LenMode, ?MinExponent = MinExponent, @@ -156,6 +159,7 @@ type ColorBar() = /// Sets the width (in px) or the border enclosing this color bar. /// Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to "log" and "date" axes. If the axis `type` is "log", then ticks are set every 10^(n"dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. "log" has several special values; "L<f>", where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = "L0.5" will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use "D1" (all digits) or "D2" (only 2 and 5). `tick0` is ignored for "D1" and "D2". If the axis `type` is "date", then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. "date" also has special values "M<n>" gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to "2000-01-15" and `dtick` to "M3". To set ticks every 4 years, set `dtick` to "M48" /// Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If "none", it appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If "power", 1x10^9 (with 9 in a super script). If "SI", 1G. If "B", 1B. + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends. /// Determines whether this color bar's length (i.e. the measure in the color variation direction) is set in units of plot "fraction" or in "pixels. Use `len` to set the value. /// Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is "SI" or "B". @@ -200,6 +204,7 @@ type ColorBar() = [] ?BorderWidth: float, [] ?DTick: IConvertible, [] ?ExponentFormat: StyleParam.ExponentFormat, + [] ?LabelAlias: DynamicObj, [] ?Len: float, [] ?LenMode: StyleParam.UnitMode, [] ?MinExponent: float, @@ -247,6 +252,7 @@ type ColorBar() = BorderWidth |> DynObj.setValueOpt colorBar "borderwidth" DTick |> DynObj.setValueOpt colorBar "dtick" ExponentFormat |> DynObj.setValueOptBy colorBar "exponentformat" StyleParam.ExponentFormat.convert + LabelAlias |> DynObj.setValueOpt colorBar "labelalias" Len |> DynObj.setValueOpt colorBar "len" LenMode |> DynObj.setValueOptBy colorBar "lenmode" StyleParam.UnitMode.convert MinExponent |> DynObj.setValueOpt colorBar "min3xponent" diff --git a/src/Plotly.NET/Layout/ObjectAbstractions/Common/LinearAxis.fs b/src/Plotly.NET/Layout/ObjectAbstractions/Common/LinearAxis.fs index eca8e0374..09949990c 100644 --- a/src/Plotly.NET/Layout/ObjectAbstractions/Common/LinearAxis.fs +++ b/src/Plotly.NET/Layout/ObjectAbstractions/Common/LinearAxis.fs @@ -83,6 +83,7 @@ type LinearAxis() = /// If set to an opposite-letter axis id (e.g. `x2`, `y`), this axis is bound to the corresponding opposite-letter axis. If set to "free", this axis' position is determined by `position`. /// Determines whether a x (y) axis is positioned at the "bottom" ("left") or "top" ("right") of the plotting area. /// If set a same-letter axis id, this axis is overlaid on top of the corresponding same-letter axis, with traces and axes visible for both axes. If "false", this axis does not overlay any same-letter axes. In this case, for axes with overlapping domains only the highest-numbered axis will be visible. + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the layer on which this axis is displayed. If "above traces", this axis is displayed above all the subplot's traces If "below traces", this axis is displayed below all the subplot's traces, but above the grid lines. Useful when used together with scatter-like traces with `cliponaxis` set to "false" to show markers and/or text nodes above this axis. /// Sets the domain of this axis (in plot fraction). /// Sets the position of this axis in the plotting space (in normalized coordinates). Only has an effect if `anchor` is set to "free". @@ -167,6 +168,7 @@ type LinearAxis() = [] ?Anchor: StyleParam.LinearAxisId, [] ?Side: StyleParam.Side, [] ?Overlaying: StyleParam.LinearAxisId, + [] ?LabelAlias: DynamicObj, [] ?Layer: StyleParam.Layer, [] ?Domain: StyleParam.Range, [] ?Position: float, @@ -252,6 +254,7 @@ type LinearAxis() = ?Anchor = Anchor, ?Side = Side, ?Overlaying = Overlaying, + ?LabelAlias = LabelAlias, ?Layer = Layer, ?Domain = Domain, ?Position = Position, @@ -338,6 +341,7 @@ type LinearAxis() = /// If set to an opposite-letter axis id (e.g. `x2`, `y`), this axis is bound to the corresponding opposite-letter axis. If set to "free", this axis' position is determined by `position`. /// Determines whether a x (y) axis is positioned at the "bottom" ("left") or "top" ("right") of the plotting area. /// If set a same-letter axis id, this axis is overlaid on top of the corresponding same-letter axis, with traces and axes visible for both axes. If "false", this axis does not overlay any same-letter axes. In this case, for axes with overlapping domains only the highest-numbered axis will be visible. + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the layer on which this axis is displayed. If "above traces", this axis is displayed above all the subplot's traces If "below traces", this axis is displayed below all the subplot's traces, but above the grid lines. Useful when used together with scatter-like traces with `cliponaxis` set to "false" to show markers and/or text nodes above this axis. /// Sets the domain of this axis (in plot fraction). /// Sets the position of this axis in the plotting space (in normalized coordinates). Only has an effect if `anchor` is set to "free". @@ -418,6 +422,7 @@ type LinearAxis() = [] ?Anchor: StyleParam.LinearAxisId, [] ?Side: StyleParam.Side, [] ?Overlaying: StyleParam.LinearAxisId, + [] ?LabelAlias: DynamicObj, [] ?Layer: StyleParam.Layer, [] ?Domain: StyleParam.Range, [] ?Position: float, @@ -500,6 +505,7 @@ type LinearAxis() = ?Anchor = Anchor, ?Side = Side, ?Overlaying = Overlaying, + ?LabelAlias = LabelAlias, ?Layer = Layer, ?Domain = Domain, ?Position = Position, @@ -556,6 +562,7 @@ type LinearAxis() = /// Determines whether or not a line is drawn at along the final value of this axis. If "true", the end line is drawn on top of the grid lines. /// Sets the line color of the end line. /// Sets the width (in px) of the end line. + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Extra padding between label and the axis /// Sets a axis label prefix. /// Sets a axis label suffix. @@ -612,6 +619,7 @@ type LinearAxis() = [] ?EndLine: bool, [] ?EndLineColor: Color, [] ?EndLineWidth: int, + [] ?LabelAlias: DynamicObj, [] ?LabelPadding: int, [] ?LabelPrefix: string, [] ?LabelSuffix: string, @@ -669,6 +677,7 @@ type LinearAxis() = ?EndLine = EndLine, ?EndLineColor = EndLineColor, ?EndLineWidth = EndLineWidth, + ?LabelAlias = LabelAlias, ?LabelPadding = LabelPadding, ?LabelPrefix = LabelPrefix, ?LabelSuffix = LabelSuffix, @@ -701,6 +710,7 @@ type LinearAxis() = /// Same as `showtickprefix` but for tick suffixes. /// Sets a tick label suffix. /// If "all", all exponents are shown besides their significands. If "first", only the exponent of the first tick is shown. If "last", only the exponent of the last tick is shown. If "none", no exponents appear. + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If "none", it appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If "power", 1x10^9 (with 9 in a super script). If "SI", 1G. If "B", 1B. /// Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `TickFormat` is "SI" or "B". /// If "true", even 4-digit integers are separated @@ -713,6 +723,7 @@ type LinearAxis() = static member initIndicatorGauge ( [] ?DTick: #IConvertible, + [] ?LabelAlias: DynamicObj, [] ?ExponentFormat: StyleParam.ExponentFormat, [] ?MinExponent: float, [] ?NTicks: int, @@ -741,6 +752,7 @@ type LinearAxis() = LinearAxis() |> LinearAxis.style ( ?DTick = DTick, + ?LabelAlias = LabelAlias, ?ExponentFormat = ExponentFormat, ?MinExponent = MinExponent, ?NTicks = NTicks, @@ -841,6 +853,7 @@ type LinearAxis() = /// If set to an opposite-letter axis id (e.g. `x2`, `y`), this axis is bound to the corresponding opposite-letter axis. If set to "free", this axis' position is determined by `position`. /// Determines whether a x (y) axis is positioned at the "bottom" ("left") or "top" ("right") of the plotting area. /// If set a same-letter axis id, this axis is overlaid on top of the corresponding same-letter axis, with traces and axes visible for both axes. If "false", this axis does not overlay any same-letter axes. In this case, for axes with overlapping domains only the highest-numbered axis will be visible. + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the layer on which this axis is displayed. If "above traces", this axis is displayed above all the subplot's traces If "below traces", this axis is displayed below all the subplot's traces, but above the grid lines. Useful when used together with scatter-like traces with `cliponaxis` set to "false" to show markers and/or text nodes above this axis. /// Sets the domain of this axis (in plot fraction). /// Sets the position of this axis in the plotting space (in normalized coordinates). Only has an effect if `anchor` is set to "free". @@ -942,6 +955,7 @@ type LinearAxis() = [] ?Anchor: StyleParam.LinearAxisId, [] ?Side: StyleParam.Side, [] ?Overlaying: StyleParam.LinearAxisId, + [] ?LabelAlias: DynamicObj, [] ?Layer: StyleParam.Layer, [] ?Domain: StyleParam.Range, [] ?Position: float, @@ -1044,6 +1058,7 @@ type LinearAxis() = Anchor |> DynObj.setValueOptBy axis "anchor" StyleParam.LinearAxisId.convert Side |> DynObj.setValueOptBy axis "side" StyleParam.Side.convert Overlaying |> DynObj.setValueOptBy axis "overlaying" StyleParam.LinearAxisId.convert + LabelAlias |> DynObj.setValueOpt axis "labelalias" Layer |> DynObj.setValueOptBy axis "layer" StyleParam.Layer.convert Domain |> DynObj.setValueOptBy axis "domain" StyleParam.Range.convert Position |> DynObj.setValueOpt axis "position" diff --git a/src/Plotly.NET/Layout/ObjectAbstractions/Polar/AngularAxis.fs b/src/Plotly.NET/Layout/ObjectAbstractions/Polar/AngularAxis.fs index 5d08823fe..8d885cf98 100644 --- a/src/Plotly.NET/Layout/ObjectAbstractions/Polar/AngularAxis.fs +++ b/src/Plotly.NET/Layout/ObjectAbstractions/Polar/AngularAxis.fs @@ -56,6 +56,7 @@ type AngularAxis() = /// Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format. And for dates see: https://github.com/d3/d3-time-format#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with TickFormat "%H~%M~%S.%2f" would display "09~15~23.46" /// Set rules for customizing TickFormat on different zoom levels /// Sets the spacing between tick labels as compared to the spacing between ticks. A value of 1 (default) means each tick gets a label. A value of 2 means shows every 2nd label. A larger value n means only every nth tick is labeled. `tick0` determines which labels are shown. Not implemented for axes with `type` "log" or "multicategory", or when `tickmode` is "array". + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the layer on which this axis is displayed. If "above traces", this axis is displayed above all the subplot's traces If "below traces", this axis is displayed below all the subplot's traces, but above the grid lines. Useful when used together with scatter-like traces with `cliponaxis` set to "false" to show markers and/or text nodes above this axis. static member init ( @@ -102,6 +103,7 @@ type AngularAxis() = [] ?TickFormat: string, [] ?TickFormatStops: seq, [] ?TickLabelStep: int, + [] ?LabelAlias: DynamicObj, [] ?Layer: StyleParam.Layer ) = AngularAxis() @@ -149,6 +151,7 @@ type AngularAxis() = ?TickFormat = TickFormat, ?TickFormatStops = TickFormatStops, ?TickLabelStep = TickLabelStep, + ?LabelAlias = LabelAlias, ?Layer = Layer ) @@ -198,6 +201,7 @@ type AngularAxis() = /// Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format. And for dates see: https://github.com/d3/d3-time-format#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with TickFormat "%H~%M~%S.%2f" would display "09~15~23.46" /// Set rules for customizing TickFormat on different zoom levels /// Sets the spacing between tick labels as compared to the spacing between ticks. A value of 1 (default) means each tick gets a label. A value of 2 means shows every 2nd label. A larger value n means only every nth tick is labeled. `tick0` determines which labels are shown. Not implemented for axes with `type` "log" or "multicategory", or when `tickmode` is "array". + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the layer on which this axis is displayed. If "above traces", this axis is displayed above all the subplot's traces If "below traces", this axis is displayed below all the subplot's traces, but above the grid lines. Useful when used together with scatter-like traces with `cliponaxis` set to "false" to show markers and/or text nodes above this axis. static member style ( @@ -244,6 +248,7 @@ type AngularAxis() = [] ?TickFormat: string, [] ?TickFormatStops: seq, [] ?TickLabelStep: int, + [] ?LabelAlias: DynamicObj, [] ?Layer: StyleParam.Layer ) = fun (angularAxis: AngularAxis) -> @@ -291,6 +296,7 @@ type AngularAxis() = TickFormat |> DynObj.setValueOpt angularAxis "tickformat" TickFormatStops |> DynObj.setValueOpt angularAxis "tickformatstops" TickLabelStep |> DynObj.setValueOpt angularAxis "ticklabelstep" + LabelAlias |> DynObj.setValueOpt angularAxis "labelalias" Layer |> DynObj.setValueOptBy angularAxis "layer" StyleParam.Layer.convert angularAxis diff --git a/src/Plotly.NET/Layout/ObjectAbstractions/Polar/RadialAxis.fs b/src/Plotly.NET/Layout/ObjectAbstractions/Polar/RadialAxis.fs index 3871bd5f3..392d610e0 100644 --- a/src/Plotly.NET/Layout/ObjectAbstractions/Polar/RadialAxis.fs +++ b/src/Plotly.NET/Layout/ObjectAbstractions/Polar/RadialAxis.fs @@ -56,6 +56,7 @@ type RadialAxis() = /// Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically. /// Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format. And for dates see: https://github.com/d3/d3-time-format#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with TickFormat "%H~%M~%S.%2f" would display "09~15~23.46" /// Set rules for customizing TickFormat on different zoom levels + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the layer on which this axis is displayed. If "above traces", this axis is displayed above all the subplot's traces If "below traces", this axis is displayed below all the subplot's traces, but above the grid lines. Useful when used together with scatter-like traces with `cliponaxis` set to "false" to show markers and/or text nodes above this axis. /// Sets the spacing between tick labels as compared to the spacing between ticks. A value of 1 (default) means each tick gets a label. A value of 2 means shows every 2nd label. A larger value n means only every nth tick is labeled. `tick0` determines which labels are shown. Not implemented for axes with `type` "log" or "multicategory", or when `tickmode` is "array". /// Sets the calendar system to use for `range` and `tick0` if this is a date axis. This does not set the calendar for interpreting data on this axis, that's specified in the trace or via the global `layout.calendar` @@ -105,6 +106,7 @@ type RadialAxis() = [] ?TickAngle: int, [] ?TickFormat: string, [] ?TickFormatStops: seq, + [] ?LabelAlias: DynamicObj, [] ?Layer: StyleParam.Layer, [] ?TickLabelStep: int, [] ?Calendar: StyleParam.Calendar @@ -155,6 +157,7 @@ type RadialAxis() = ?TickAngle = TickAngle, ?TickFormat = TickFormat, ?TickFormatStops = TickFormatStops, + ?LabelAlias = LabelAlias, ?Layer = Layer, ?TickLabelStep = TickLabelStep, ?Calendar = Calendar @@ -207,6 +210,7 @@ type RadialAxis() = /// Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically. /// Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format. And for dates see: https://github.com/d3/d3-time-format#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with TickFormat "%H~%M~%S.%2f" would display "09~15~23.46" /// Set rules for customizing TickFormat on different zoom levels + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the layer on which this axis is displayed. If "above traces", this axis is displayed above all the subplot's traces If "below traces", this axis is displayed below all the subplot's traces, but above the grid lines. Useful when used together with scatter-like traces with `cliponaxis` set to "false" to show markers and/or text nodes above this axis. /// Sets the spacing between tick labels as compared to the spacing between ticks. A value of 1 (default) means each tick gets a label. A value of 2 means shows every 2nd label. A larger value n means only every nth tick is labeled. `tick0` determines which labels are shown. Not implemented for axes with `type` "log" or "multicategory", or when `tickmode` is "array". /// Sets the calendar system to use for `range` and `tick0` if this is a date axis. This does not set the calendar for interpreting data on this axis, that's specified in the trace or via the global `layout.calendar` @@ -256,6 +260,7 @@ type RadialAxis() = [] ?TickAngle: int, [] ?TickFormat: string, [] ?TickFormatStops: seq, + [] ?LabelAlias: DynamicObj, [] ?Layer: StyleParam.Layer, [] ?TickLabelStep: int, [] ?Calendar: StyleParam.Calendar @@ -306,6 +311,7 @@ type RadialAxis() = TickAngle |> DynObj.setValueOpt radialAxis "tickangle" TickFormat |> DynObj.setValueOpt radialAxis "tickformat" TickFormatStops |> DynObj.setValueOpt radialAxis "tickformatstops" + LabelAlias |> DynObj.setValueOpt radialAxis "labelalias" Layer |> DynObj.setValueOptBy radialAxis "layer" StyleParam.Layer.convert TickLabelStep |> DynObj.setValueOpt radialAxis "ticklabelstep" Calendar |> DynObj.setValueOptBy radialAxis "calendar" StyleParam.Calendar.convert diff --git a/src/Plotly.NET/Layout/ObjectAbstractions/Smith/ImaginaryAxis.fs b/src/Plotly.NET/Layout/ObjectAbstractions/Smith/ImaginaryAxis.fs index 784a0e899..5cd120d72 100644 --- a/src/Plotly.NET/Layout/ObjectAbstractions/Smith/ImaginaryAxis.fs +++ b/src/Plotly.NET/Layout/ObjectAbstractions/Smith/ImaginaryAxis.fs @@ -18,6 +18,7 @@ type ImaginaryAxis() = /// Sets the dash style of lines. Set to a dash type string ("solid", "dot", "dash", "longdash", "dashdot", or "longdashdot") or a dash length list in px (eg "5px,10px,2px,2px"). /// Sets the width (in px) of the grid lines. /// Sets the hover text formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46" + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the layer on which this axis is displayed. If "above traces", this axis is displayed above all the subplot's traces If "below traces", this axis is displayed below all the subplot's traces, but above the grid lines. Useful when used together with scatter-like traces with `cliponaxis` set to "false" to show markers and/or text nodes above this axis. /// Sets the axis line color. /// Sets the width (in px) of the axis line. @@ -43,6 +44,7 @@ type ImaginaryAxis() = [] ?GridDash: StyleParam.DrawingStyle, [] ?GridWidth: int, [] ?HoverFormat: string, + [] ?LabelAlias: DynamicObj, [] ?Layer: StyleParam.Layer, [] ?LineColor: Color, [] ?LineWidth: int, @@ -69,6 +71,7 @@ type ImaginaryAxis() = ?GridDash = GridDash, ?GridWidth = GridWidth, ?HoverFormat = HoverFormat, + ?LabelAlias = LabelAlias, ?Layer = Layer, ?LineColor = LineColor, ?LineWidth = LineWidth, @@ -98,6 +101,7 @@ type ImaginaryAxis() = /// Sets the dash style of lines. Set to a dash type string ("solid", "dot", "dash", "longdash", "dashdot", or "longdashdot") or a dash length list in px (eg "5px,10px,2px,2px"). /// Sets the width (in px) of the grid lines. /// Sets the hover text formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46" + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the layer on which this axis is displayed. If "above traces", this axis is displayed above all the subplot's traces If "below traces", this axis is displayed below all the subplot's traces, but above the grid lines. Useful when used together with scatter-like traces with `cliponaxis` set to "false" to show markers and/or text nodes above this axis. /// Sets the axis line color. /// Sets the width (in px) of the axis line. @@ -123,6 +127,7 @@ type ImaginaryAxis() = [] ?GridDash: StyleParam.DrawingStyle, [] ?GridWidth: int, [] ?HoverFormat: string, + [] ?LabelAlias: DynamicObj, [] ?Layer: StyleParam.Layer, [] ?LineColor: Color, [] ?LineWidth: int, @@ -149,6 +154,7 @@ type ImaginaryAxis() = GridDash |> DynObj.setValueOptBy imaginaryAxis "griddash" StyleParam.DrawingStyle.convert GridWidth |> DynObj.setValueOpt imaginaryAxis "gridwidth" HoverFormat |> DynObj.setValueOpt imaginaryAxis "hoverformat" + LabelAlias |> DynObj.setValueOpt imaginaryAxis "labelalias" Layer |> DynObj.setValueOptBy imaginaryAxis "layer" StyleParam.Layer.convert LineColor |> DynObj.setValueOpt imaginaryAxis "linecolor" LineWidth |> DynObj.setValueOpt imaginaryAxis "linewidth" diff --git a/src/Plotly.NET/Layout/ObjectAbstractions/Smith/RealAxis.fs b/src/Plotly.NET/Layout/ObjectAbstractions/Smith/RealAxis.fs index bbd329130..c15fca2db 100644 --- a/src/Plotly.NET/Layout/ObjectAbstractions/Smith/RealAxis.fs +++ b/src/Plotly.NET/Layout/ObjectAbstractions/Smith/RealAxis.fs @@ -18,6 +18,7 @@ type RealAxis() = /// Sets the dash style of lines. Set to a dash type string ("solid", "dot", "dash", "longdash", "dashdot", or "longdashdot") or a dash length list in px (eg "5px,10px,2px,2px"). /// Sets the width (in px) of the grid lines. /// Sets the hover text formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46" + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the layer on which this axis is displayed. If "above traces", this axis is displayed above all the subplot's traces If "below traces", this axis is displayed below all the subplot's traces, but above the grid lines. Useful when used together with scatter-like traces with `cliponaxis` set to "false" to show markers and/or text nodes above this axis. /// Sets the axis line color. /// Sets the width (in px) of the axis line. @@ -45,6 +46,7 @@ type RealAxis() = [] ?GridDash: StyleParam.DrawingStyle, [] ?GridWidth: int, [] ?HoverFormat: string, + [] ?LabelAlias: DynamicObj, [] ?Layer: StyleParam.Layer, [] ?LineColor: Color, [] ?LineWidth: int, @@ -73,6 +75,7 @@ type RealAxis() = ?GridDash = GridDash, ?GridWidth = GridWidth, ?HoverFormat = HoverFormat, + ?LabelAlias = LabelAlias, ?Layer = Layer, ?LineColor = LineColor, ?LineWidth = LineWidth, @@ -103,6 +106,7 @@ type RealAxis() = /// Sets the dash style of lines. Set to a dash type string ("solid", "dot", "dash", "longdash", "dashdot", or "longdashdot") or a dash length list in px (eg "5px,10px,2px,2px"). /// Sets the width (in px) of the grid lines. /// Sets the hover text formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46" + /// Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax. /// Sets the layer on which this axis is displayed. If "above traces", this axis is displayed above all the subplot's traces If "below traces", this axis is displayed below all the subplot's traces, but above the grid lines. Useful when used together with scatter-like traces with `cliponaxis` set to "false" to show markers and/or text nodes above this axis. /// Sets the axis line color. /// Sets the width (in px) of the axis line. @@ -130,6 +134,7 @@ type RealAxis() = [] ?GridDash: StyleParam.DrawingStyle, [] ?GridWidth: int, [] ?HoverFormat: string, + [] ?LabelAlias: DynamicObj, [] ?Layer: StyleParam.Layer, [] ?LineColor: Color, [] ?LineWidth: int, @@ -158,6 +163,7 @@ type RealAxis() = GridDash |> DynObj.setValueOptBy realAxis "griddash" StyleParam.DrawingStyle.convert GridWidth |> DynObj.setValueOpt realAxis "gridwidth" HoverFormat |> DynObj.setValueOpt realAxis "hoverformat" + LabelAlias |> DynObj.setValueOpt realAxis "labelalias" Layer |> DynObj.setValueOptBy realAxis "layer" StyleParam.Layer.convert LineColor |> DynObj.setValueOpt realAxis "linecolor" LineWidth |> DynObj.setValueOpt realAxis "linewidth" diff --git a/tests/Common/FSharpTestBase/TestCharts/UpstreamFeatures/2.19.fs b/tests/Common/FSharpTestBase/TestCharts/UpstreamFeatures/2.19.fs index c5ab33129..3f4faf10a 100644 --- a/tests/Common/FSharpTestBase/TestCharts/UpstreamFeatures/2.19.fs +++ b/tests/Common/FSharpTestBase/TestCharts/UpstreamFeatures/2.19.fs @@ -54,4 +54,75 @@ module ShapeLabel = let ``SVGPath shape with angled label`` = Chart.Line(x = x,y = y, UseDefaults = false) - |> Chart.withShape(shapes[3]) \ No newline at end of file + |> Chart.withShape(shapes[3]) + +module LabelAlias = + + open DynamicObj + + let internal labelAlias = DynamicObj() + labelAlias?("1") <- "ONE" + labelAlias?("0\u00B0") <- "ZERO" + + let internal linAxis() = LinearAxis.init(LabelAlias=labelAlias) + let internal angularAxis() = AngularAxis.init(LabelAlias=labelAlias) + let internal radialAxis() = RadialAxis.init(LabelAlias=labelAlias) + let internal imaginaryAxis() = ImaginaryAxis.init(LabelAlias=labelAlias) + let internal realAxis() = RealAxis.init(LabelAlias=labelAlias) + let internal colorBar() = ColorBar.init(LabelAlias=labelAlias) + + let ``Point chart with label alias`` = + Chart.Point([1,1], UseDefaults = false) + |> Chart.withXAxis(linAxis()) + |> Chart.withYAxis(linAxis()) + + let ``3D point chart with label alias`` = + Chart.Point3D([1,1,1], UseDefaults = false) + |> Chart.withXAxis(linAxis(), Id = StyleParam.SubPlotId.Scene 1) + |> Chart.withYAxis(linAxis(), Id = StyleParam.SubPlotId.Scene 1) + |> Chart.withZAxis(linAxis()) + + let ``Polar point chart with leabel alias`` = + Chart.PointPolar([1,1], UseDefaults = false) + |> Chart.withAngularAxis(angularAxis()) + |> Chart.withRadialAxis(radialAxis()) + + let ``Ternary point chart with label alias`` = + Chart.PointTernary([1,1,1], UseDefaults = false) + |> Chart.withAAxis(linAxis()) + |> Chart.withBAxis(linAxis()) + |> Chart.withCAxis(linAxis()) + + let ``Carpet chart with label alias`` = + Chart.Carpet( + carpetId = "carpet1", + A = [4.; 4.; 4.; 4.5; 4.5; 4.5; 5.; 5.; 5.; 6.; 6.; 6.], + B = [1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.], + Y = [2.; 3.5; 4.; 3.; 4.5; 5.; 5.5; 6.5; 7.5; 8.; 8.5; 10.], + AAxis = linAxis(), + BAxis = linAxis(), + UseDefaults = false + ) + + let ``Heatmap chart with label alias`` = + Chart.Heatmap([[1;2];[3;4]], UseDefaults = false) + |> Chart.withXAxis(linAxis()) + |> Chart.withYAxis(linAxis()) + |> Chart.withColorBar(colorBar()) + + let ``Point smith chart with label alias`` = + Chart.PointSmith([1,2], UseDefaults = false) + |> Chart.withImaginaryAxis(imaginaryAxis()) + |> Chart.withRealAxis(realAxis()) + + let ``Bullet gauge indicator chart with label alias`` = + Chart.Indicator( + value = 1, + mode = StyleParam.IndicatorMode.NumberDeltaGauge, + DeltaReference = 0, + Range = StyleParam.Range.MinMax(-1., 1.), + GaugeShape = StyleParam.IndicatorGaugeShape.Bullet, + ShowGaugeAxis = true, + GaugeAxis = linAxis(), + UseDefaults = false + ) \ No newline at end of file diff --git a/tests/ConsoleApps/FSharpConsole/Program.fs b/tests/ConsoleApps/FSharpConsole/Program.fs index 91ead7e05..c9ab6c709 100644 --- a/tests/ConsoleApps/FSharpConsole/Program.fs +++ b/tests/ConsoleApps/FSharpConsole/Program.fs @@ -11,42 +11,72 @@ open Newtonsoft.Json [] let main argv = - let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ] - let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.] - - let shapes = + + let labelAlias = DynamicObj() + labelAlias?("1") <- "ONE" + labelAlias?("0\u00B0") <- "ZERO" + + let linAxis = LinearAxis.init(LabelAlias=labelAlias) + let angularAxis = AngularAxis.init(LabelAlias=labelAlias) + let radialAxis = RadialAxis.init(LabelAlias=labelAlias) + let imaginaryAxis = ImaginaryAxis.init(LabelAlias=labelAlias) + let realAxis = RealAxis.init(LabelAlias=labelAlias) + let colorBar = ColorBar.init(LabelAlias=labelAlias) + + [ + Chart.Point([1,1], UseDefaults = false) + |> Chart.withXAxis(linAxis) + |> Chart.withYAxis(linAxis) + + Chart.Point3D([1,1,1], UseDefaults = false) + |> Chart.withXAxis(linAxis, Id = StyleParam.SubPlotId.Scene 1) + |> Chart.withYAxis(linAxis, Id = StyleParam.SubPlotId.Scene 1) + |> Chart.withZAxis(linAxis) + + Chart.PointPolar([1,1], UseDefaults = false) + |> Chart.withAngularAxis(angularAxis) + |> Chart.withRadialAxis(radialAxis) + + Chart.PointTernary([1,1,1], UseDefaults = false) + |> Chart.withAAxis(linAxis) + |> Chart.withBAxis(linAxis) + |> Chart.withCAxis(linAxis) + + [ - Shape.init( - ShapeType=StyleParam.ShapeType.Rectangle, - X0=2.,X1=4.,Y0=3.,Y1=4., - Opacity=0.3, - FillColor=Color.fromHex "#d3d3d3", - Label = ShapeLabel.init(Text="Rectangle") - ) - Shape.init( - ShapeType=StyleParam.ShapeType.Circle, - X0=5.,X1=7.,Y0=3.,Y1=4., - Opacity=0.3, - FillColor=Color.fromHex "#d3d3d3", - Label = ShapeLabel.init(Text="Circle", Padding = 20) - ) - Shape.init( - ShapeType=StyleParam.ShapeType.Line, - X0=1.,X1=2.,Y0=1.,Y1=2., - Opacity=0.3, - FillColor=Color.fromHex "#d3d3d3", - Label = ShapeLabel.init(Text="Line") - ) - Shape.init( - ShapeType=StyleParam.ShapeType.SvgPath, - Path=" M 3,7 L2,8 L2,9 L3,10, L4,10 L5,9 L5,8 L4,7 Z", - Label = ShapeLabel.init(Text="SVGPath", TextAngle = StyleParam.TextAngle.Degrees 33) + Chart.Carpet( + carpetId = "carpet1", + A = [4.; 4.; 4.; 4.5; 4.5; 4.5; 5.; 5.; 5.; 6.; 6.; 6.], + B = [1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.], + Y = [2.; 3.5; 4.; 3.; 4.5; 5.; 5.5; 6.5; 7.5; 8.; 8.5; 10.], + AAxis = linAxis, + BAxis = linAxis, + UseDefaults = false ) + ] - shapes - |> Seq.iter (fun shape -> - Chart.Line(x = x,y = y, UseDefaults = false) - |> Chart.withShape(shape) - |> Chart.show - ) + |> Chart.combine + + Chart.Heatmap([[1;2];[3;4]], UseDefaults = false) + |> Chart.withXAxis(linAxis) + |> Chart.withYAxis(linAxis) + |> Chart.withColorBar(colorBar) + + Chart.PointSmith([1,2], UseDefaults = false) + |> Chart.withImaginaryAxis(imaginaryAxis) + |> Chart.withRealAxis(realAxis) + + Chart.Indicator( + value = 1, + mode = StyleParam.IndicatorMode.NumberDeltaGauge, + DeltaReference = 0, + Range = StyleParam.Range.MinMax(-1., 1.), + GaugeShape = StyleParam.IndicatorGaugeShape.Bullet, + ShowGaugeAxis = true, + GaugeAxis = linAxis, + UseDefaults = false + ) + + ] + |> List.iter Chart.show 0 \ No newline at end of file diff --git a/tests/CoreTests/CoreTests/UpstreamFeatures/2.19.fs b/tests/CoreTests/CoreTests/UpstreamFeatures/2.19.fs index 4c395f0f3..2e0f6a1cd 100644 --- a/tests/CoreTests/CoreTests/UpstreamFeatures/2.19.fs +++ b/tests/CoreTests/CoreTests/UpstreamFeatures/2.19.fs @@ -47,4 +47,74 @@ module ShapeLabel = |> chartGeneratedContains ShapeLabel.``SVGPath shape with angled label`` ) ] + ] + +module LabelAlias = + [] + let ``LabelAlias chart HTML codegeneration tests`` = + testList "UpstreamFeatures.PlotlyJS_2_19" [ + testList "LabelAlias" [ + testCase "point chart with label alias data" ( fun () -> + """var data = [{"type":"scatter","mode":"markers","x":[1],"y":[1],"marker":{},"line":{}}];""" + |> chartGeneratedContains LabelAlias.``Point chart with label alias`` + ) + testCase "point chart with label alias layout" ( fun () -> + """var layout = {"xaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}},"yaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}}};""" + |> chartGeneratedContains LabelAlias.``Point chart with label alias`` + ) + testCase "3D point chart with label alias data" ( fun () -> + """var data = [{"type":"scatter3d","mode":"markers","x":[1],"y":[1],"z":[1],"marker":{},"line":{}}];""" + |> chartGeneratedContains LabelAlias.``3D point chart with label alias`` + ) + testCase "3D point chart with label alias layout" ( fun () -> + """var layout = {"scene":{"camera":{"projection":{"type":"perspective"}},"xaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}},"yaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}},"zaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}}}};""" + |> chartGeneratedContains LabelAlias.``3D point chart with label alias`` + ) + testCase "polar point chart with label alias data" ( fun () -> + """var data = [{"type":"scatterpolar","mode":"markers","r":[1],"theta":[1],"marker":{}}];""" + |> chartGeneratedContains LabelAlias.``Polar point chart with leabel alias`` + ) + testCase "polar point chart with label alias layout" ( fun () -> + """var layout = {"polar":{"angularaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}},"radialaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}}}};""" + |> chartGeneratedContains LabelAlias.``Polar point chart with leabel alias`` + ) + testCase "ternary point chart with label alias data" ( fun () -> + """var data = [{"type":"scatterternary","mode":"markers","a":[1],"b":[1],"c":[1],"marker":{},"line":{}}];""" + |> chartGeneratedContains LabelAlias.``Ternary point chart with label alias`` + ) + testCase "ternary point chart with label alias layout" ( fun () -> + """var layout = {"ternary":{"aaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}},"baxis":{"labelalias":{"1":"ONE","0°":"ZERO"}},"caxis":{"labelalias":{"1":"ONE","0°":"ZERO"}}}};""" + |> chartGeneratedContains LabelAlias.``Ternary point chart with label alias`` + ) + testCase "carpet chart with label alias data" ( fun () -> + """var data = [{"type":"carpet","y":[2.0,3.5,4.0,3.0,4.5,5.0,5.5,6.5,7.5,8.0,8.5,10.0],"a":[4.0,4.0,4.0,4.5,4.5,4.5,5.0,5.0,5.0,6.0,6.0,6.0],"b":[1.0,2.0,3.0,1.0,2.0,3.0,1.0,2.0,3.0,1.0,2.0,3.0],"aaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}},"baxis":{"labelalias":{"1":"ONE","0°":"ZERO"}},"carpet":"carpet1"}];""" + |> chartGeneratedContains LabelAlias.``Carpet chart with label alias`` + ) + testCase "carpet chart with label alias layout" ( fun () -> + emptyLayout LabelAlias.``Carpet chart with label alias`` + ) + testCase "heatmap chart with label alias data" ( fun () -> + """var data = [{"type":"heatmap","z":[[1,2],[3,4]],"colorbar":{"labelalias":{"1":"ONE","0°":"ZERO"}}}];""" + |> chartGeneratedContains LabelAlias.``Heatmap chart with label alias`` + ) + testCase "heatmap chart with label alias layout" ( fun () -> + """var layout = {"xaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}},"yaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}}};""" + |> chartGeneratedContains LabelAlias.``Heatmap chart with label alias`` + ) + testCase "point smith chart with label alias data" ( fun () -> + """var data = [{"type":"scattersmith","mode":"markers","imag":[2],"real":[1],"marker":{},"line":{}}];""" + |> chartGeneratedContains LabelAlias.``Point smith chart with label alias`` + ) + testCase "point smith chart with label alias layout" ( fun () -> + """var layout = {"smith":{"imaginaryaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}},"realaxis":{"labelalias":{"1":"ONE","0°":"ZERO"}}}};""" + |> chartGeneratedContains LabelAlias.``Point smith chart with label alias`` + ) + testCase "bullet gauge indicator chart with label alias data" ( fun () -> + """var data = [{"type":"indicator","mode":"number+delta+gauge","value":1,"delta":{"reference":0},"gauge":{"axis":{"labelalias":{"1":"ONE","0°":"ZERO"},"visible":true,"range":[-1.0,1.0]},"shape":"bullet"}}];""" + |> chartGeneratedContains LabelAlias.``Bullet gauge indicator chart with label alias`` + ) + testCase "bullet gauge indicator chart label alias layout" ( fun () -> + emptyLayout LabelAlias.``Bullet gauge indicator chart with label alias`` + ) + ] ] \ No newline at end of file