Skip to content

Commit b76bf18

Browse files
committed
update to plotlyjs version 2.7.0
1 parent 97a6b68 commit b76bf18

File tree

5 files changed

+67
-11
lines changed

5 files changed

+67
-11
lines changed

src/Plotly.NET/ChartAPI/Chart2D.fs

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,6 +3062,7 @@ module Chart2D =
30623062
/// <param name="Opacity">Sets the Opacity of the trace.</param>
30633063
/// <param name="Text">Sets a text associated with each datum</param>
30643064
/// <param name="MultiText">Sets individual text for each datum</param>
3065+
/// <param name="TextPosition">Sets the position of text associated with each datum</param>
30653066
/// <param name="HistFunc">Specifies the binning function used for this histogram trace. If "count", the histogram values are computed by counting the number of values lying inside each bin. If "sum", "avg", "min", "max", the histogram values are computed using the sum, the average, the minimum or the maximum of the values lying inside each bin respectively.</param>
30663067
/// <param name="HistNorm">Specifies the type of normalization used for this histogram trace. If "", the span of each bar corresponds to the number of occurrences (i.e. the number of data points lying inside the bins). If "percent" / "probability", the span of each bar corresponds to the percentage / fraction of occurrences with respect to the total number of sample points (here, the sum of all bin HEIGHTS equals 100% / 1). If "density", the span of each bar corresponds to the number of occurrences in a bin divided by the size of the bin interval (here, the sum of all bin AREAS equals the total number of sample points). If "probability density", the area of each bar corresponds to the probability that an event will fall into the corresponding bin (here, the sum of all bin AREAS equals 1).</param>
30673068
/// <param name="AlignmentGroup">Set several traces linked to the same position axis or matching axes to the same alignmentgroup. This controls whether bars compute their positional range dependently or independently.</param>
@@ -3071,8 +3072,12 @@ module Chart2D =
30713072
/// <param name="BinGroup">Set a group of histogram traces which will have compatible bin settings. Note that traces on the same subplot and with the same "orientation" under `barmode` "stack", "relative" and "group" are forced into the same bingroup, Using `bingroup`, traces under `barmode` "overlay" and on different axes (of the same axis type) can have compatible bin settings. Note that histogram and histogram2d" trace can share the same `bingroup`</param>
30723073
/// <param name="XBins">Sets the binning across the x dimension</param>
30733074
/// <param name="YBins">Sets the binning across the y dimension</param>
3074-
/// <param name="MarkerColor">Sets the color of the histogram's bars.</param>
3075-
/// <param name="Marker">Sets the marker for the histogram's bars (use this for more finegrained control than the other marker-associated arguments).</param>
3075+
/// <param name="MarkerColor">Sets the color of the bars</param>
3076+
/// <param name="MarkerColorScale">Sets the colorscale for the bars. To have an effect, `MarkerColor` must map to color scale values.</param>
3077+
/// <param name="MarkerOutline">Sets the color of the bar outlines</param>
3078+
/// <param name="MarkerPatternShape">Sets a pattern shape for all bars</param>
3079+
/// <param name="MultiMarkerPatternShape">Sets an individual pattern shape for each bar</param>
3080+
/// <param name="MarkerPattern">Sets the marker pattern (use this for more finegrained control than the other pattern-associated arguments).</param>
30763081
/// <param name="Line">Sets the outline of the histogram's bars.</param>
30773082
/// <param name="XError">Sets the x error of this trace.</param>
30783083
/// <param name="YError">Sets the y error of this trace.</param>
@@ -3090,6 +3095,7 @@ module Chart2D =
30903095
[<Optional; DefaultParameterValue(null)>] ?Opacity: float,
30913096
[<Optional; DefaultParameterValue(null)>] ?Text: #IConvertible,
30923097
[<Optional; DefaultParameterValue(null)>] ?MultiText: seq<#IConvertible>,
3098+
[<Optional; DefaultParameterValue(null)>] ?TextPosition: StyleParam.TextPosition,
30933099
[<Optional; DefaultParameterValue(null)>] ?HistFunc: StyleParam.HistFunc,
30943100
[<Optional; DefaultParameterValue(null)>] ?HistNorm: StyleParam.HistNorm,
30953101
[<Optional; DefaultParameterValue(null)>] ?AlignmentGroup: string,
@@ -3100,6 +3106,11 @@ module Chart2D =
31003106
[<Optional; DefaultParameterValue(null)>] ?XBins: Bins,
31013107
[<Optional; DefaultParameterValue(null)>] ?YBins: Bins,
31023108
[<Optional; DefaultParameterValue(null)>] ?MarkerColor: Color,
3109+
[<Optional; DefaultParameterValue(null)>] ?MarkerColorScale: StyleParam.Colorscale,
3110+
[<Optional; DefaultParameterValue(null)>] ?MarkerOutline: Line,
3111+
[<Optional; DefaultParameterValue(null)>] ?MarkerPatternShape: StyleParam.PatternShape,
3112+
[<Optional; DefaultParameterValue(null)>] ?MultiMarkerPatternShape: seq<StyleParam.PatternShape>,
3113+
[<Optional; DefaultParameterValue(null)>] ?MarkerPattern: Pattern,
31033114
[<Optional; DefaultParameterValue(null)>] ?Marker: Marker,
31043115
[<Optional; DefaultParameterValue(null)>] ?Line: Line,
31053116
[<Optional; DefaultParameterValue(null)>] ?XError: Error,
@@ -3112,14 +3123,32 @@ module Chart2D =
31123123
let useDefaults =
31133124
defaultArg UseDefaults true
31143125

3126+
let pattern =
3127+
MarkerPattern
3128+
|> Option.defaultValue (TraceObjects.Pattern.init ())
3129+
|> TraceObjects.Pattern.style (?Shape = MarkerPatternShape, ?MultiShape = MultiMarkerPatternShape)
3130+
3131+
let marker =
3132+
Marker
3133+
|> Option.defaultValue (TraceObjects.Marker.init ())
3134+
|> TraceObjects.Marker.style (
3135+
?Color = MarkerColor,
3136+
Pattern = pattern,
3137+
?Colorscale = MarkerColorScale,
3138+
?Outline = MarkerOutline
3139+
)
3140+
31153141
Trace2D.initHistogram (
31163142
Trace2DStyle.Histogram(
31173143
?X = X,
31183144
?Y = Y,
3145+
?Orientation = Orientation,
3146+
?Name = Name,
3147+
?ShowLegend = ShowLegend,
31193148
?Opacity = Opacity,
31203149
?Text = Text,
31213150
?MultiText = MultiText,
3122-
?Orientation = Orientation,
3151+
?TextPosition = TextPosition,
31233152
?HistFunc = HistFunc,
31243153
?HistNorm = HistNorm,
31253154
?AlignmentGroup = AlignmentGroup,
@@ -3129,16 +3158,14 @@ module Chart2D =
31293158
?BinGroup = BinGroup,
31303159
?XBins = XBins,
31313160
?YBins = YBins,
3132-
?Marker = Marker,
3161+
Marker = marker,
31333162
?Line = Line,
31343163
?XError = XError,
31353164
?YError = YError,
31363165
?Cumulative = Cumulative,
31373166
?HoverLabel = HoverLabel
31383167
)
31393168
)
3140-
|> TraceStyle.Marker(?Color = MarkerColor)
3141-
|> TraceStyle.TraceInfo(?Name = Name, ?ShowLegend = ShowLegend)
31423169
|> GenericChart.ofTraceObject useDefaults
31433170

31443171

src/Plotly.NET/ChartAPI/GenericChart.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module HTML =
1515
<head>
1616
<!-- Plotly.js -->
1717
<meta http-equiv="X-UA-Compatible" content="IE=11" >
18-
<script src="https://cdn.plot.ly/plotly-2.6.3.min.js"></script>
18+
<script src="https://cdn.plot.ly/plotly-2.7.0.min.js"></script>
1919
[ADDITIONAL_HEAD_TAGS]
2020
<style>
2121
.container {
@@ -58,7 +58,7 @@ module HTML =
5858
newScript.AppendLine(
5959
@"
6060
var renderPlotly_[SCRIPTID] = function() {
61-
var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.6.3.min'}}) || require;
61+
var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.7.0.min'}}) || require;
6262
fsharpPlotlyRequire(['plotly'], function(Plotly) {"
6363
)
6464
|> ignore

src/Plotly.NET/Traces/Trace2D.fs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,9 @@ type Trace2DStyle() =
873873
/// <param name="Y">Sets the sample data to be binned on the y axis.</param>
874874
/// <param name="Text">Sets text elements associated with each (x,y) pair. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y) coordinates. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels.</param>
875875
/// <param name="MultiText">Sets text elements associated with each (x,y) pair. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y) coordinates. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels.</param>
876+
/// <param name="TextPosition">Sets the positions of the `text` elements with respects to the (x,y) coordinates.</param>
877+
/// <param name="TextTemplate">Template string used for rendering the information text that appear on points. Note that this will override `textinfo`. Variables are inserted using %{variable}, for example "y: %{y}". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available.</param>
878+
/// <param name="MultiTextTemplate">Template string used for rendering the information text that appear on points. Note that this will override `textinfo`. Variables are inserted using %{variable}, for example "y: %{y}". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available.</param>
876879
/// <param name="HoverText">Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y) coordinates. To be seen, trace `hoverinfo` must contain a "text" flag.</param>
877880
/// <param name="MultiHoverText">Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y) coordinates. To be seen, trace `hoverinfo` must contain a "text" flag.</param>
878881
/// <param name="HoverInfo">Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired.</param>
@@ -897,14 +900,21 @@ type Trace2DStyle() =
897900
/// <param name="XBins">Sets the binning across the x dimension</param>
898901
/// <param name="YBins">Sets the binning across the y dimension</param>
899902
/// <param name="Marker">Sets the marker of this trace.</param>
903+
/// <param name="TextAngle">Sets the angle of the tick labels with respect to the bar. For example, a `tickangle` of -90 draws the tick labels vertically. With "auto" the texts may automatically be rotated to fit with the maximum size in bars.</param>
904+
/// <param name="TextFont">Sets the font used for `text`.</param>
900905
/// <param name="Line">Sets the line of this trace.</param>
901906
/// <param name="XError">Sets the x error of this trace.</param>
902907
/// <param name="YError">Sets the y error of this trace.</param>
903908
/// <param name="SelectedPoints">Array containing integer indices of selected points. Has an effect only for traces that support selections. Note that an empty array means an empty selection where the `unselected` are turned on for all points, whereas, any other non-array values means no selection all where the `selected` and `unselected` styles have no effect.</param>
904909
/// <param name="Selected">Sets the style of selected points of this trace.</param>
905910
/// <param name="Unselected">Sets the style of unselected points of this trace.</param>
911+
/// <param name="ClipOnAxis">Determines whether the text nodes are clipped about the subplot axes. To show the text nodes above axis lines and tick labels, make sure to set `xaxis.layer` and `yaxis.layer` to "below traces".</param>
912+
/// <param name="Constraintext">Constrain the size of text inside or outside a bar to be no larger than the bar itself.</param>
906913
/// <param name="Cumulative">Sets wether and how the cumulative distribution is displayed</param>
907914
/// <param name="HoverLabel">Sets the style of the hoverlabels of this trace.</param>
915+
/// <param name="InsideTextAnchor">Determines if texts are kept at center or start/end points in `textposition` "inside" mode.</param>
916+
/// <param name="InsideTextFont">Sets the font used for `text` lying inside the bar.</param>
917+
/// <param name="OutsideTextFont">Sets the font used for `text` lying outside the bar.</param>
908918
/// <param name="XCalendar">Sets the calendar system to use with `x` date data.</param>
909919
/// <param name="YCalendar">Sets the calendar system to use with `y` date data.</param>
910920
/// <param name="UIRevision">Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well as some `editable: true` modifications such as `name` and `colorbar.title`. Defaults to `layout.uirevision`. Note that other user-driven trace attribute changes are controlled by `layout` attributes: `trace.visible` is controlled by `layout.legend.uirevision`, `selectedpoints` is controlled by `layout.selectionrevision`, and `colorbar.(x|y)` (accessible with `config: {editable: true}`) is controlled by `layout.editrevision`. Trace changes are tracked by `uid`, which only falls back on trace index if no `uid` is provided. So if your app can add/remove traces before the end of the `data` array, such that the same trace has a different index, you can still preserve user-driven changes if you give each trace a `uid` that stays with it as it moves.</param>
@@ -922,6 +932,9 @@ type Trace2DStyle() =
922932
[<Optional; DefaultParameterValue(null)>] ?Y: seq<#IConvertible>,
923933
[<Optional; DefaultParameterValue(null)>] ?Text: #IConvertible,
924934
[<Optional; DefaultParameterValue(null)>] ?MultiText: seq<#IConvertible>,
935+
[<Optional; DefaultParameterValue(null)>] ?TextPosition: StyleParam.TextPosition,
936+
[<Optional; DefaultParameterValue(null)>] ?TextTemplate: string,
937+
[<Optional; DefaultParameterValue(null)>] ?MultiTextTemplate: seq<string>,
925938
[<Optional; DefaultParameterValue(null)>] ?HoverText: string,
926939
[<Optional; DefaultParameterValue(null)>] ?MultiHoverText: seq<string>,
927940
[<Optional; DefaultParameterValue(null)>] ?HoverInfo: StyleParam.HoverInfo,
@@ -946,14 +959,21 @@ type Trace2DStyle() =
946959
[<Optional; DefaultParameterValue(null)>] ?XBins: Bins,
947960
[<Optional; DefaultParameterValue(null)>] ?YBins: Bins,
948961
[<Optional; DefaultParameterValue(null)>] ?Marker: Marker,
962+
[<Optional; DefaultParameterValue(null)>] ?TextAngle: float,
963+
[<Optional; DefaultParameterValue(null)>] ?TextFont: Font,
949964
[<Optional; DefaultParameterValue(null)>] ?Line: Line,
950965
[<Optional; DefaultParameterValue(null)>] ?XError: Error,
951966
[<Optional; DefaultParameterValue(null)>] ?YError: Error,
952967
[<Optional; DefaultParameterValue(null)>] ?SelectedPoints: seq<#IConvertible>,
953968
[<Optional; DefaultParameterValue(null)>] ?Selected: Selection,
954969
[<Optional; DefaultParameterValue(null)>] ?Unselected: Selection,
970+
[<Optional; DefaultParameterValue(null)>] ?ClipOnAxis: bool,
971+
[<Optional; DefaultParameterValue(null)>] ?Constraintext: StyleParam.ConstrainText,
955972
[<Optional; DefaultParameterValue(null)>] ?Cumulative: Cumulative,
956973
[<Optional; DefaultParameterValue(null)>] ?HoverLabel: Hoverlabel,
974+
[<Optional; DefaultParameterValue(null)>] ?InsideTextAnchor: StyleParam.InsideTextAnchor,
975+
[<Optional; DefaultParameterValue(null)>] ?InsideTextFont: Font,
976+
[<Optional; DefaultParameterValue(null)>] ?OutsideTextFont: Font,
957977
[<Optional; DefaultParameterValue(null)>] ?XCalendar: StyleParam.Calendar,
958978
[<Optional; DefaultParameterValue(null)>] ?YCalendar: StyleParam.Calendar,
959979
[<Optional; DefaultParameterValue(null)>] ?UIRevision: string
@@ -971,6 +991,8 @@ type Trace2DStyle() =
971991
X |> DynObj.setValueOpt histogram "x"
972992
Y |> DynObj.setValueOpt histogram "y"
973993
(Text, MultiText) |> DynObj.setSingleOrMultiOpt histogram "text"
994+
TextPosition|> DynObj.setValueOptBy histogram "textposition" StyleParam.TextPosition.convert
995+
(TextTemplate, MultiTextTemplate) |> DynObj.setSingleOrMultiOpt histogram "texttemplate"
974996
(HoverText, MultiHoverText) |> DynObj.setSingleOrMultiOpt histogram "hovertext"
975997
HoverInfo |> DynObj.setValueOptBy histogram "hoverinfo" StyleParam.HoverInfo.convert
976998
(HoverTemplate, MultiHoverTemplate) |> DynObj.setSingleOrMultiOpt histogram "hovertemplate"
@@ -993,14 +1015,21 @@ type Trace2DStyle() =
9931015
XBins |> DynObj.setValueOpt histogram "xbins"
9941016
YBins |> DynObj.setValueOpt histogram "ybins"
9951017
Marker |> DynObj.setValueOpt histogram "marker"
1018+
TextAngle |> DynObj.setValueOpt histogram "textangle"
1019+
TextFont |> DynObj.setValueOpt histogram "textfont"
9961020
Line |> DynObj.setValueOpt histogram "line"
9971021
XError |> DynObj.setValueOpt histogram "error_x"
9981022
YError |> DynObj.setValueOpt histogram "error_y"
9991023
SelectedPoints |> DynObj.setValueOpt histogram "selectedpoints"
10001024
Selected |> DynObj.setValueOpt histogram "selected"
10011025
Unselected |> DynObj.setValueOpt histogram "unselected"
1026+
ClipOnAxis |> DynObj.setValueOpt histogram "cliponaxis"
1027+
Constraintext |> DynObj.setValueOptBy histogram "constraintext" StyleParam.ConstrainText.convert
10021028
Cumulative |> DynObj.setValueOpt histogram "cumulative"
10031029
HoverLabel |> DynObj.setValueOpt histogram "hoverlabel"
1030+
InsideTextAnchor |> DynObj.setValueOptBy histogram "insidetextanchor" StyleParam.InsideTextAnchor.convert
1031+
InsideTextFont |> DynObj.setValueOpt histogram "insidetextfont"
1032+
OutsideTextFont |> DynObj.setValueOpt histogram "outsidetextfont"
10041033
XCalendar |> DynObj.setValueOptBy histogram "xcalendar" StyleParam.Calendar.convert
10051034
YCalendar |> DynObj.setValueOptBy histogram "ycalendar" StyleParam.Calendar.convert
10061035
UIRevision |> DynObj.setValueOpt histogram "uirevision"

tests/Plotly.NET.Tests/HtmlCodegen/DistributionCharts.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ let ``Histogram charts`` =
2222
// the string is too big to be here fully.
2323
[
2424
"var data = [{\"type\":\"histogram\",\"x\":[0.33836984091362443,0.2844184475412678,0.2629626417825756,0.6253758443637638,0.46346185284827923,0.9283738280312968,0.1463105539541275,0.9505998873853124,0.5961332552116985"
25-
"0.7608672612164483,0.8280196519699039,0.040246858280267035,0.0017312127173557937],\"marker\":{}}];"
25+
"""0.7608672612164483,0.8280196519699039,0.040246858280267035,0.0017312127173557937],"marker":{"pattern":{}}}];"""
2626
]
2727
|> chartGeneratedContainsList histoChart
2828
);

0 commit comments

Comments
 (0)