Commit f0ce010f authored by Alexandre Delanoë's avatar Alexandre Delanoë

[Chart] With Smart Constructor only (Sankey).

parent df46c07f
......@@ -60,7 +60,7 @@ type D2 =
{ "symbolSize" :: Number
, "data" :: Array (Array Number)
, "type" :: SeriesType
}
}
toSeries :: Serie -> Series
toSeries (SeriesD1 a) = unsafeCoerce a
......@@ -79,14 +79,14 @@ type Node = { name :: String}
type Link = { source :: String
, target :: String
, value :: Number
}
}
mkSankey :: Array Node -> Array Link -> Sankey
mkSankey ns ls = {"type" : seriesType Sankey
, layout : "none"
, "data" : ns
, "links" : ls
}
mkSankey :: Array Node -> Array Link -> Serie
mkSankey ns ls = SeriesSankey {"type" : seriesType Sankey
, layout : "none"
, "data" : ns
, "links" : ls
}
--
......@@ -131,4 +131,3 @@ mkSankey ns ls = {"type" : seriesType Sankey
-- https://ecomfe.github.io/echarts-examples/public/editor.html?c=scatter3D-dataset&gl=1
......@@ -125,7 +125,7 @@ sankeyEx :: Options
sankeyEx = Options { mainTitle : ""
, subTitle : ""
, xAxis : xAxis []
, yAxis : [ SeriesSankey $ mkSankey [{name : "a"}, {name : "b"}, {name:"c"}, {name:"d"}]
, yAxis : [ mkSankey [{name : "a"}, {name : "b"}, {name:"c"}, {name:"d"}]
[{source : "a", target : "b", value :2.0}
, {source : "a", target : "c", value :1.0}
, {source : "b", target : "c", value :1.0}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment