#Region Project Attributes
#MainFormWidth: 800
#MainFormHeight: 800
#End Region
#AdditionalJar: charts-11.2
'#AdditionalJar: javafx-graphics-11
'#AdditionalJar: javafx-base-11
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private Pane1 As Pane
Dim chart As JavaObject
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
chart.InitializeNewInstance("eu.hansolo.fx.charts.SankeyPlot", Null)
' Dim DARK_ORCHID As JavaObject = fx.colors.RGB(0x95, 0x20, 0xc9)
' Dim DARK_PASTEL_GREEN As JavaObject = fx.colors.RGB(0x1f, 0xaf, 0x44)
' Dim SPICY_PINK As JavaObject = fx.colors.RGB(0xff, 0x02, 0xb2)
' Dim LIMA As JavaObject = fx.colors.RGB(0x74, 0xce, 0x28)
Dim ORANGE As JavaObject = fx.Colors.RGB(0xfd, 0xbf, 0x6f)
' Dim STARSHIP As JavaObject = fx.Colors.RGB(0xda, 0xfd, 0x38)
Dim LIGHT_BLUE As JavaObject = fx.Colors.RGB(0xa6, 0xce, 0xe3)
Dim LIGHT_RED As JavaObject = fx.Colors.RGB(0xfb, 0x9a, 0x99)
Dim LIGHT_GREEN As JavaObject = fx.Colors.RGB(0xb2, 0xdf, 0x8a)
Dim YELLOW As JavaObject = fx.Colors.RGB(0xff, 0xff, 0x99)
Dim PURPLE As JavaObject = fx.Colors.RGB(0xca,0xb2, 0xd6)
Dim BLUE As JavaObject = fx.Colors.RGB(0x1f, 0x78, 0xb4)
Dim GREEN As JavaObject = fx.Colors.RGB(0x33, 0xa0, 0x2c)
Dim PINK As JavaObject = fx.Colors.RGB(0xFF, 0x48, 0xC6)
Dim brazil, mexico, usa, canada, GERMANY, portugal, spain, england, france, southAfrica, angola, morocco, senegal, mali, china, japan, india As JavaObject
brazil.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("Brazil", LIGHT_BLUE))
mexico.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("Mexico", ORANGE))
usa.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("USA", ORANGE))
canada.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("Canada", LIGHT_RED))
GERMANY.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("Germany", PINK))
portugal.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("Portugal", LIGHT_BLUE))
spain.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("Spain", LIGHT_GREEN))
england.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("England", LIGHT_RED))
france.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("France", LIGHT_GREEN))
southAfrica.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("South Africa", YELLOW))
angola.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("Angola", PURPLE))
morocco.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("Morocco", YELLOW))
senegal.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("Senegal", PURPLE))
mali.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("Mail", BLUE))
china.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("China", BLUE))
japan.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("Japan", GREEN))
india.InitializeNewInstance("eu.hansolo.fx.charts.data.PlotItem", Array("India", GREEN))
Dim ONE As Double = 1
Dim TWO As Double = 2
Dim THREE As Double = 3
Dim FIVE As Double = 5
Dim SEVEN As Double = 7
brazil.RunMethod("addToOutgoing", Array(portugal, FIVE))
brazil.RunMethod("addToOutgoing", Array(france, ONE))
brazil.RunMethod("addToOutgoing", Array(spain, ONE))
brazil.RunMethod("addToOutgoing", Array(england, ONE))
canada.RunMethod("addToOutgoing", Array(portugal, ONE))
canada.RunMethod("addToOutgoing", Array(france, FIVE))
canada.RunMethod("addToOutgoing", Array(england, ONE))
mexico.RunMethod("addToOutgoing", Array(portugal, ONE))
mexico.RunMethod("addToOutgoing", Array(france, ONE))
mexico.RunMethod("addToOutgoing", Array(spain, FIVE))
mexico.RunMethod("addToOutgoing", Array(england, ONE))
usa.RunMethod("addToOutgoing", Array(portugal, ONE))
usa.RunMethod("addToOutgoing", Array(france, ONE))
usa.RunMethod("addToOutgoing", Array(spain, ONE))
usa.RunMethod("addToOutgoing", Array(england, FIVE))
GERMANY.RunMethod("addToOutgoing", Array(southAfrica, FIVE))
portugal.RunMethod("addToOutgoing", Array(angola, TWO))
portugal.RunMethod("addToOutgoing", Array(senegal, ONE))
portugal.RunMethod("addToOutgoing", Array(morocco, ONE))
portugal.RunMethod("addToOutgoing", Array(southAfrica, THREE))
france.RunMethod("addToOutgoing", Array(angola, ONE))
france.RunMethod("addToOutgoing", Array(senegal, THREE))
france.RunMethod("addToOutgoing", Array(mali, THREE))
france.RunMethod("addToOutgoing", Array(morocco, THREE))
france.RunMethod("addToOutgoing", Array(southAfrica, ONE))
spain.RunMethod("addToOutgoing", Array(senegal, ONE))
spain.RunMethod("addToOutgoing", Array(morocco, THREE))
spain.RunMethod("addToOutgoing", Array(southAfrica, ONE))
england.RunMethod("addToOutgoing", Array(angola, ONE))
england.RunMethod("addToOutgoing", Array(senegal, ONE))
england.RunMethod("addToOutgoing", Array(morocco, TWO))
england.RunMethod("addToOutgoing", Array(southAfrica, SEVEN))
southAfrica.RunMethod("addToOutgoing", Array(china, FIVE))
southAfrica.RunMethod("addToOutgoing", Array(india, ONE))
southAfrica.RunMethod("addToOutgoing", Array(japan, THREE))
angola.RunMethod("addToOutgoing", Array(china, FIVE))
angola.RunMethod("addToOutgoing", Array(india, ONE))
angola.RunMethod("addToOutgoing", Array(japan, THREE))
senegal.RunMethod("addToOutgoing", Array(china, FIVE))
senegal.RunMethod("addToOutgoing", Array(india, ONE))
senegal.RunMethod("addToOutgoing", Array(japan, THREE))
mali.RunMethod("addToOutgoing", Array(china, FIVE))
mali.RunMethod("addToOutgoing", Array(india, ONE))
mali.RunMethod("addToOutgoing", Array(japan, THREE))
morocco.RunMethod("addToOutgoing", Array(china, FIVE))
morocco.RunMethod("addToOutgoing", Array(india, ONE))
morocco.RunMethod("addToOutgoing", Array(japan, THREE))
Dim sankeyPlotBuilder As JavaObject
sankeyPlotBuilder.InitializeStatic("eu.hansolo.fx.charts.SankeyPlotBuilder")
Dim wdth, hght As Double
wdth = 600
hght = 400
Dim plotItemArray As JavaObject
plotItemArray.InitializeArray("eu.hansolo.fx.charts.data.PlotItem", Array(brazil, mexico, usa, canada, GERMANY, portugal, spain, england, france, southAfrica, angola, morocco, senegal, mali, china, japan, india))
Dim streamFillMode As JavaObject
streamFillMode.InitializeStatic("eu.hansolo.fx.charts.SankeyPlot.StreamFillMode")
chart = sankeyPlotBuilder.RunMethodJO("create", Null) _
.RunMethodJO("prefSize", Array(wdth, hght)) _
.RunMethodJO("items", Array(plotItemArray)) _
.RunMethodJO("streamFillMode", Array(streamFillMode.GetField("GRADIENT"))) _
.RunMethodJO("build", Null)
Pane1.AddNode(chart,Pane1.Width*0.025,Pane1.Height*0.025,Pane1.Width*0.95,Pane1.Height*0.95)
End Sub