Skip to content

Chart.Sankey missing parameters and abstractions #168

Description

@gaviei

Missing parameters:

  • arrangement
  • valueformat
  • valuesuffix
  • Link.hovertemplate
  • Link.customdata

Type mismatch

Arrangement

https://plotly.com/javascript/reference/sankey/#sankey-arrangement
https://plotly.com/python/sankey-diagram/#define-node-position

#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)

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

Activity

  1. MaheshPunna commented on Sep 12, 2021

    @MaheshPunna

    @kMutagene Please check these missing abstractions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: MissingAbstractionPlotly.js functionality that has to be implemented

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions