Skip to content

Commit

Permalink
plotlyjs v2.14: Add support for sankey links with arrows (plotly/plot…
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene committed Feb 8, 2023
1 parent 28de52f commit 99d635a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Plotly.NET/ChartAPI/GenericChart.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module HTML =
<head>
<!-- Plotly.js -->
<meta http-equiv="X-UA-Compatible" content="IE=11" >
<script src="https://cdn.plot.ly/plotly-2.13.3.min.js"></script>
<script src="https://cdn.plot.ly/plotly-2.14.0.min.js"></script>
[ADDITIONAL_HEAD_TAGS]
<style>
.container {
Expand Down Expand Up @@ -58,7 +58,7 @@ module HTML =
newScript.AppendLine(
@"
var renderPlotly_[SCRIPTID] = function() {
var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.13.3.min'}}) || require;
var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.14.0.min'}}) || require;
fsharpPlotlyRequire(['plotly'], function(Plotly) {"
)
|> ignore
Expand Down
4 changes: 4 additions & 0 deletions src/Plotly.NET/Traces/ObjectAbstractions/Sankey.fs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ type SankeyLinks() =

static member init
(
[<Optional; DefaultParameterValue(null)>] ?ArrowLen: int,
[<Optional; DefaultParameterValue(null)>] ?Color: Color,
[<Optional; DefaultParameterValue(null)>] ?ColorScales: seq<SankeyLinkColorscale>,
[<Optional; DefaultParameterValue(null)>] ?CustomData: seq<#IConvertible>,
Expand All @@ -143,6 +144,7 @@ type SankeyLinks() =

SankeyLinks()
|> SankeyLinks.style (
?ArrowLen = ArrowLen,
?Color = Color,
?ColorScales = ColorScales,
?CustomData = CustomData,
Expand All @@ -160,6 +162,7 @@ type SankeyLinks() =

static member style
(
[<Optional; DefaultParameterValue(null)>] ?ArrowLen: int,
[<Optional; DefaultParameterValue(null)>] ?Color: Color,
[<Optional; DefaultParameterValue(null)>] ?ColorScales: seq<SankeyLinkColorscale>,
[<Optional; DefaultParameterValue(null)>] ?CustomData: seq<#IConvertible>,
Expand All @@ -175,6 +178,7 @@ type SankeyLinks() =
) =
(fun (sankeyLinks: SankeyLinks) ->

ArrowLen |> DynObj.setValueOpt sankeyLinks "arrowlen"
Color |> DynObj.setValueOpt sankeyLinks "color"
ColorScales |> DynObj.setValueOpt sankeyLinks "colorscales"
CustomData |> DynObj.setValueOpt sankeyLinks "customdata"
Expand Down
4 changes: 2 additions & 2 deletions tests/Plotly.NET.Tests/HtmlCodegen/SimpleTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let simpleChart =
let ``Html layout tests`` =
testList "SimpleTests.Simple tests" [
testCase "Expecting plotly js" ( fun () ->
"https://cdn.plot.ly/plotly-2.13.3.min"
"https://cdn.plot.ly/plotly-2.14.0.min"
|> chartGeneratedContains simpleChart
);
testCase "Expecting data" ( fun () ->
Expand All @@ -36,7 +36,7 @@ let ``Html layout tests`` =
|> chartGeneratedContains simpleChart
);
testCase "Expecting require config" (fun () ->
"var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.13.3.min'}}) || require;"
"var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.14.0.min'}}) || require;"
|> chartGeneratedContains simpleChart
);
testCase "Expecting html tags in embedded page only" (fun () ->
Expand Down

0 comments on commit 99d635a

Please sign in to comment.