#r "nuget: Plotly.NET, 2.0.0-preview.7"
#r "nuget: Plotly.NET.Interactive, 2.0.0-preview.7"
open Plotly.NET
(*
let nodesData = Seq.zip3 ["A"; "B"; "C"; "D"; "E"; "F"] //label
[0.2; 0.1; 0.5; 0.7; 0.3; 0.5] //x
[0.7; 0.5; 0.2; 0.4; 0.2; 0.3] //y
let nodes = nodesData |> Seq.map(fun (label, x, y) -> Node.Create(label,
XRank = x, //requires int
YRank = y)) //requires int
let linksData = Seq.zip3 [0; 0; 1; 2; 5; 4; 3; 5] //source
[5; 3; 4; 3; 0; 2; 2; 3] //target
[1.; 2.; 1.; 1.; 1.; 1.; 1.; 2.] //value
let links = linksData |> Seq.map(fun (source, target, value) -> Link.Create(nodes.[source],
nodes.[target],
value = value))
let sankey = Chart.Sankey(nodes = nodes,
links = links)
|> GenericChart.mapTrace(fun x -> x.SetValue("arrangement", "snap")
x)
*)
let trace =
let tmp = Trace("sankey")
tmp?node <- {|
label = ["A"; "B"; "C"; "D"; "E"; "F"]
x = [0.2; 0.1; 0.5; 0.7; 0.3; 0.5]
y = [0.7; 0.5; 0.2; 0.4; 0.2; 0.3]
pad =10.
|}
tmp?link <- {| source = [0; 0; 1; 2; 5; 4; 3; 5]
target = [5; 3; 4; 3; 0; 2; 2; 3]
value = [1; 2; 1; 1; 1; 1; 1; 2] |}
tmp?arrangement <- "snap"
tmp
GenericChart.ofTraceObject(trace)
Missing parameters:
Type mismatch
Those are currently option<int>
https://plotly.com/javascript/reference/sankey/#sankey-node-x
https://plotly.com/javascript/reference/sankey/#sankey-node-y
Arrangement
https://plotly.com/javascript/reference/sankey/#sankey-arrangement
https://plotly.com/python/sankey-diagram/#define-node-position
ValueFormat
https://plotly.com/javascript/reference/sankey/#sankey-valueformat
https://plotly.com/python/sankey-diagram/#more-complex-sankey-diagram-with-colored-links
ValueSuffix
https://plotly.com/javascript/reference/sankey/#sankey-valuesuffix
https://plotly.com/python/sankey-diagram/#more-complex-sankey-diagram-with-colored-links
Link.hovertemplate
https://plotly.com/javascript/reference/sankey/#sankey-link-hovertemplate
https://plotly.com/python/sankey-diagram/#hovertemplate-and-customdata-of-sankey-diagrams
Link.customdata
https://plotly.com/javascript/reference/sankey/#sankey-link-customdata
https://plotly.com/python/sankey-diagram/#hovertemplate-and-customdata-of-sankey-diagrams