Skip to content

Commit

Permalink
plotly.js v2.19.0: Add LabelAlias to various axes(plotly/plotly.js#6481)
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene committed Jul 9, 2023
1 parent 02614cb commit f9e14fb
Show file tree
Hide file tree
Showing 9 changed files with 252 additions and 36 deletions.
6 changes: 6 additions & 0 deletions src/Plotly.NET/CommonAbstractions/ColorBar.fs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type ColorBar() =
/// <param name="BorderWidth">Sets the width (in px) or the border enclosing this color bar.</param>
/// <param name="DTick">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&lt;f&gt;", 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&lt;n&gt;" 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"</param>
/// <param name="ExponentFormat">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.</param>
/// <param name="LabelAlias">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.</param>
/// <param name="Len">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.</param>
/// <param name="LenMode">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.</param>
/// <param name="MinExponent">Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is "SI" or "B".</param>
Expand Down Expand Up @@ -61,6 +62,7 @@ type ColorBar() =
[<Optional; DefaultParameterValue(null)>] ?BorderWidth: float,
[<Optional; DefaultParameterValue(null)>] ?DTick: IConvertible,
[<Optional; DefaultParameterValue(null)>] ?ExponentFormat: StyleParam.ExponentFormat,
[<Optional; DefaultParameterValue(null)>] ?LabelAlias: DynamicObj,
[<Optional; DefaultParameterValue(null)>] ?Len: float,
[<Optional; DefaultParameterValue(null)>] ?LenMode: StyleParam.UnitMode,
[<Optional; DefaultParameterValue(null)>] ?MinExponent: float,
Expand Down Expand Up @@ -107,6 +109,7 @@ type ColorBar() =
?BorderWidth = BorderWidth,
?DTick = DTick,
?ExponentFormat = ExponentFormat,
?LabelAlias = LabelAlias,
?Len = Len,
?LenMode = LenMode,
?MinExponent = MinExponent,
Expand Down Expand Up @@ -156,6 +159,7 @@ type ColorBar() =
/// <param name="BorderWidth">Sets the width (in px) or the border enclosing this color bar.</param>
/// <param name="DTick">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&lt;f&gt;", 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&lt;n&gt;" 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"</param>
/// <param name="ExponentFormat">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.</param>
/// <param name="LabelAlias">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.</param>
/// <param name="Len">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.</param>
/// <param name="LenMode">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.</param>
/// <param name="MinExponent">Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is "SI" or "B".</param>
Expand Down Expand Up @@ -200,6 +204,7 @@ type ColorBar() =
[<Optional; DefaultParameterValue(null)>] ?BorderWidth: float,
[<Optional; DefaultParameterValue(null)>] ?DTick: IConvertible,
[<Optional; DefaultParameterValue(null)>] ?ExponentFormat: StyleParam.ExponentFormat,
[<Optional; DefaultParameterValue(null)>] ?LabelAlias: DynamicObj,
[<Optional; DefaultParameterValue(null)>] ?Len: float,
[<Optional; DefaultParameterValue(null)>] ?LenMode: StyleParam.UnitMode,
[<Optional; DefaultParameterValue(null)>] ?MinExponent: float,
Expand Down Expand Up @@ -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"
Expand Down
15 changes: 15 additions & 0 deletions src/Plotly.NET/Layout/ObjectAbstractions/Common/LinearAxis.fs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type LinearAxis() =
/// <param name="Anchor">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`.</param>
/// <param name="Side">Determines whether a x (y) axis is positioned at the "bottom" ("left") or "top" ("right") of the plotting area.</param>
/// <param name="Overlaying">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.</param>
/// <param name="LabelAlias">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.</param>
/// <param name="Layer">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.</param>
/// <param name="Domain">Sets the domain of this axis (in plot fraction).</param>
/// <param name="Position">Sets the position of this axis in the plotting space (in normalized coordinates). Only has an effect if `anchor` is set to "free".</param>
Expand Down Expand Up @@ -167,6 +168,7 @@ type LinearAxis() =
[<Optional; DefaultParameterValue(null)>] ?Anchor: StyleParam.LinearAxisId,
[<Optional; DefaultParameterValue(null)>] ?Side: StyleParam.Side,
[<Optional; DefaultParameterValue(null)>] ?Overlaying: StyleParam.LinearAxisId,
[<Optional; DefaultParameterValue(null)>] ?LabelAlias: DynamicObj,
[<Optional; DefaultParameterValue(null)>] ?Layer: StyleParam.Layer,
[<Optional; DefaultParameterValue(null)>] ?Domain: StyleParam.Range,
[<Optional; DefaultParameterValue(null)>] ?Position: float,
Expand Down Expand Up @@ -252,6 +254,7 @@ type LinearAxis() =
?Anchor = Anchor,
?Side = Side,
?Overlaying = Overlaying,
?LabelAlias = LabelAlias,
?Layer = Layer,
?Domain = Domain,
?Position = Position,
Expand Down Expand Up @@ -338,6 +341,7 @@ type LinearAxis() =
/// <param name="Anchor">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`.</param>
/// <param name="Side">Determines whether a x (y) axis is positioned at the "bottom" ("left") or "top" ("right") of the plotting area.</param>
/// <param name="Overlaying">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.</param>
/// <param name="LabelAlias">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.</param>
/// <param name="Layer">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.</param>
/// <param name="Domain">Sets the domain of this axis (in plot fraction).</param>
/// <param name="Position">Sets the position of this axis in the plotting space (in normalized coordinates). Only has an effect if `anchor` is set to "free".</param>
Expand Down Expand Up @@ -418,6 +422,7 @@ type LinearAxis() =
[<Optional; DefaultParameterValue(null)>] ?Anchor: StyleParam.LinearAxisId,
[<Optional; DefaultParameterValue(null)>] ?Side: StyleParam.Side,
[<Optional; DefaultParameterValue(null)>] ?Overlaying: StyleParam.LinearAxisId,
[<Optional; DefaultParameterValue(null)>] ?LabelAlias: DynamicObj,
[<Optional; DefaultParameterValue(null)>] ?Layer: StyleParam.Layer,
[<Optional; DefaultParameterValue(null)>] ?Domain: StyleParam.Range,
[<Optional; DefaultParameterValue(null)>] ?Position: float,
Expand Down Expand Up @@ -500,6 +505,7 @@ type LinearAxis() =
?Anchor = Anchor,
?Side = Side,
?Overlaying = Overlaying,
?LabelAlias = LabelAlias,
?Layer = Layer,
?Domain = Domain,
?Position = Position,
Expand Down Expand Up @@ -556,6 +562,7 @@ type LinearAxis() =
/// <param name="EndLine">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.</param>
/// <param name="EndLineColor">Sets the line color of the end line.</param>
/// <param name="EndLineWidth">Sets the width (in px) of the end line.</param>
/// <param name="LabelAlias">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.</param>
/// <param name="LabelPadding">Extra padding between label and the axis</param>
/// <param name="LabelPrefix">Sets a axis label prefix.</param>
/// <param name="LabelSuffix">Sets a axis label suffix.</param>
Expand Down Expand Up @@ -612,6 +619,7 @@ type LinearAxis() =
[<Optional; DefaultParameterValue(null)>] ?EndLine: bool,
[<Optional; DefaultParameterValue(null)>] ?EndLineColor: Color,
[<Optional; DefaultParameterValue(null)>] ?EndLineWidth: int,
[<Optional; DefaultParameterValue(null)>] ?LabelAlias: DynamicObj,
[<Optional; DefaultParameterValue(null)>] ?LabelPadding: int,
[<Optional; DefaultParameterValue(null)>] ?LabelPrefix: string,
[<Optional; DefaultParameterValue(null)>] ?LabelSuffix: string,
Expand Down Expand Up @@ -669,6 +677,7 @@ type LinearAxis() =
?EndLine = EndLine,
?EndLineColor = EndLineColor,
?EndLineWidth = EndLineWidth,
?LabelAlias = LabelAlias,
?LabelPadding = LabelPadding,
?LabelPrefix = LabelPrefix,
?LabelSuffix = LabelSuffix,
Expand Down Expand Up @@ -701,6 +710,7 @@ type LinearAxis() =
/// <param name="ShowTickSuffix">Same as `showtickprefix` but for tick suffixes.</param>
/// <param name="TickSuffix">Sets a tick label suffix.</param>
/// <param name="ShowExponent">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.</param>
/// <param name="LabelAlias">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.</param>
/// <param name="ExponentFormat">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.</param>
/// <param name="MinExponent">Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `TickFormat` is "SI" or "B".</param>
/// <param name="SeparateThousands">If "true", even 4-digit integers are separated</param>
Expand All @@ -713,6 +723,7 @@ type LinearAxis() =
static member initIndicatorGauge
(
[<Optional; DefaultParameterValue(null)>] ?DTick: #IConvertible,
[<Optional; DefaultParameterValue(null)>] ?LabelAlias: DynamicObj,
[<Optional; DefaultParameterValue(null)>] ?ExponentFormat: StyleParam.ExponentFormat,
[<Optional; DefaultParameterValue(null)>] ?MinExponent: float,
[<Optional; DefaultParameterValue(null)>] ?NTicks: int,
Expand Down Expand Up @@ -741,6 +752,7 @@ type LinearAxis() =
LinearAxis()
|> LinearAxis.style (
?DTick = DTick,
?LabelAlias = LabelAlias,
?ExponentFormat = ExponentFormat,
?MinExponent = MinExponent,
?NTicks = NTicks,
Expand Down Expand Up @@ -841,6 +853,7 @@ type LinearAxis() =
/// <param name="Anchor">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`.</param>
/// <param name="Side">Determines whether a x (y) axis is positioned at the "bottom" ("left") or "top" ("right") of the plotting area.</param>
/// <param name="Overlaying">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.</param>
/// <param name="LabelAlias">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.</param>
/// <param name="Layer">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.</param>
/// <param name="Domain">Sets the domain of this axis (in plot fraction).</param>
/// <param name="Position">Sets the position of this axis in the plotting space (in normalized coordinates). Only has an effect if `anchor` is set to "free".</param>
Expand Down Expand Up @@ -942,6 +955,7 @@ type LinearAxis() =
[<Optional; DefaultParameterValue(null)>] ?Anchor: StyleParam.LinearAxisId,
[<Optional; DefaultParameterValue(null)>] ?Side: StyleParam.Side,
[<Optional; DefaultParameterValue(null)>] ?Overlaying: StyleParam.LinearAxisId,
[<Optional; DefaultParameterValue(null)>] ?LabelAlias: DynamicObj,
[<Optional; DefaultParameterValue(null)>] ?Layer: StyleParam.Layer,
[<Optional; DefaultParameterValue(null)>] ?Domain: StyleParam.Range,
[<Optional; DefaultParameterValue(null)>] ?Position: float,
Expand Down Expand Up @@ -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"
Expand Down
Loading

0 comments on commit f9e14fb

Please sign in to comment.