#Region Project Attributes
#MainFormWidth: 1200
#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
Dim xySeriesBuilder As JavaObject
xySeriesBuilder.InitializeStatic("eu.hansolo.fx.charts.series.XYSeriesBuilder")
Dim xySeries1 As JavaObject
xySeries1.InitializeNewInstance("eu.hansolo.fx.charts.series.XYSeries", Null)
Dim xyChartItemList As List
xyChartItemList.Initialize
Dim number As Double = 1
Dim value As Double = 600
Dim description As String = "Jan"
Dim xyChartItem As JavaObject
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
number = 2
value = 760
description = "Feb"
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
number = 3
value = 585
description = "Feb"
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
number = 4
value = 410
description = "Feb"
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
number = 5
value = 605
description = "Feb"
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
number = 6
value = 825
description = "Feb"
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
number = 7
value = 595
description = "Feb"
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
number = 8
value = 300
description = "Feb"
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
number = 9
value = 515
description = "Feb"
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
number = 10
value = 780
description = "Feb"
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
number = 11
value = 570
description = "Feb"
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
number = 12
value = 620
description = "Feb"
xyChartItemList.add(xyChartItem.InitializeNewInstance("eu.hansolo.fx.charts.data.XYChartItem", Array(number, value, description)))
Dim chartType As JavaObject
chartType.InitializeStatic("eu.hansolo.fx.charts.ChartType")
Dim fillColor As JavaObject
fillColor.InitializeStatic("javafx.scene.paint.Color")
Dim stringFillColor As String = "#00AEF520"
Dim strokeColor As JavaObject
strokeColor.InitializeStatic("javafx.scene.paint.Color")
Dim stringStrokeColor As String = "#00AEF5"
Dim symbolStrokeColor As JavaObject
symbolStrokeColor.InitializeStatic("javafx.scene.paint.Color")
Dim stringSymbolStrokeColor As String = "#293C47"
Dim symbolSize As Double = 10
Dim strokeWidth As Double = 3
xySeries1 = xySeriesBuilder.RunMethodJO("create", Null) _
.RunMethodJO("items", Array(xyChartItemList)) _
.RunMethodJO("chartType", Array(chartType.GetField("SMOOTH_LINE"))) _
.RunMethodJO("fill", Array(fillColor.RunMethod("web", Array(stringFillColor)))) _
.RunMethodJO("stroke", Array(strokeColor.RunMethod("web", Array(stringStrokeColor)))) _
.RunMethodJO("symbolFill", Array(strokeColor.RunMethod("web", Array(stringStrokeColor)))) _
.RunMethodJO("symbolStroke", Array(symbolStrokeColor.RunMethod("web", Array(stringSymbolStrokeColor)))) _
.RunMethodJO("symbolSize", Array(symbolSize)) _
.RunMethodJO("strokeWidth", Array(strokeWidth)) _
.RunMethodJO("symbolsVisible", Array(True)) _
.RunMethodJO("build", Null)
Dim xAxisBottom As JavaObject
Dim bottomAxisBuilder As JavaObject
xAxisBottom.InitializeNewInstance("eu.hansolo.fx.charts.Axis", Null)
bottomAxisBuilder.InitializeStatic("eu.hansolo.fx.charts.AxisBuilder")
Dim orientation As JavaObject
orientation.InitializeStatic("javafx.geometry.Orientation")
Dim position As JavaObject
position.InitializeStatic("eu.hansolo.fx.charts.Position")
Dim axisType As JavaObject
axisType.InitializeStatic("eu.hansolo.fx.charts.AxisType")
Dim categories As List
categories.Initialize
categories.AddAll(Array As String("", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"))
Dim minvalue As Double = 1
Dim maxvalue As Double = 13
Dim axisColor As JavaObject
axisColor.InitializeStatic("javafx.scene.paint.Color")
Dim stringAxisColor As String = "#85949B"
Dim tickLabelColor As JavaObject
tickLabelColor.InitializeStatic("javafx.scene.paint.Color")
Dim stringTickLabelColor As String = "#85949B"
Dim tickMarkColor As JavaObject
tickMarkColor.InitializeStatic("javafx.scene.paint.Color")
Dim stringTickMarkColor As String = "#85949B"
Dim prefHeight As Double = 25
Dim prefWidth As Double = 25
Dim axisWidth As Double = 25
xAxisBottom = bottomAxisBuilder.RunMethodJO("create", Array(orientation.GetField("HORIZONTAL"), position.GetField("BOTTOM"))) _
.RunMethodJO("type", Array(axisType.GetField("TEXT"))) _
.RunMethodJO("prefHeight", Array(prefHeight)) _
.RunMethodJO("categories", Array(categories)) _
.RunMethodJO("minValue", Array(minvalue)) _
.RunMethodJO("maxValue", Array(maxvalue)) _
.RunMethodJO("autoScale", Array(True)) _
.RunMethodJO("axisColor", Array(strokeColor.RunMethod("web", Array(stringAxisColor)))) _
.RunMethodJO("tickLabelColor", Array(strokeColor.RunMethod("web", Array(stringTickLabelColor)))) _
.RunMethodJO("tickMarkColor", Array(strokeColor.RunMethod("web", Array(stringTickMarkColor)))) _
.RunMethodJO("build", Null)
Dim anchorPane As JavaObject
anchorPane.InitializeStatic("javafx.scene.layout.AnchorPane")
anchorPane.RunMethod("setBottomAnchor", Array(xAxisBottom, 0.0))
anchorPane.RunMethod("setLeftAnchor", Array(xAxisBottom, axisWidth))
anchorPane.RunMethod("setRightAnchor", Array(xAxisBottom, axisWidth))
Dim yAxisLeft, yAxisLeftBuilder As JavaObject
yAxisLeft.InitializeNewInstance("eu.hansolo.fx.charts.Axis", Null)
yAxisLeftBuilder.InitializeStatic("eu.hansolo.fx.charts.AxisBuilder")
yAxisLeft = yAxisLeftBuilder.RunMethodJO("create", Array(orientation.GetField("VERTICAL"), position.GetField("LEFT"))) _
.RunMethodJO("type", Array(axisType.GetField("LINEAR"))) _
.RunMethodJO("prefWidth", Array(prefWidth)) _
.RunMethodJO("minValue", Array(0.0)) _
.RunMethodJO("maxValue", Array(1000.0)) _
.RunMethodJO("autoScale", Array(True)) _
.RunMethodJO("axisColor", Array(strokeColor.RunMethod("web", Array(stringAxisColor)))) _
.RunMethodJO("tickLabelColor", Array(strokeColor.RunMethod("web", Array(stringTickLabelColor)))) _
.RunMethodJO("tickMarkColor", Array(strokeColor.RunMethod("web", Array(stringTickMarkColor)))) _
.RunMethodJO("build", Null)
anchorPane.RunMethod("setTopAnchor", Array(yAxisLeft, 0.0))
anchorPane.RunMethod("setBottomAnchor", Array(yAxisLeft, axisWidth))
anchorPane.RunMethod("setLeftAnchor", Array(yAxisLeft, 0.0))
Dim grid, gridBuilder As JavaObject
grid.Initializestatic("eu.hansolo.fx.charts.Grid")
gridBuilder.InitializeStatic("eu.hansolo.fx.charts.GridBuilder")
Dim gridLinePaintColor As JavaObject
gridLinePaintColor.InitializeStatic("javafx.scene.paint.Color")
Dim stringGridLinePaintColor As String = "#384C57"
Dim gridLineDashes(2) As Double
gridLineDashes(0) = 4
gridLineDashes(1) = 4
grid = gridBuilder.RunMethodJO("create", Array(xAxisBottom, yAxisLeft)) _
.RunMethodJO("gridLinePaint", Array(gridLinePaintColor.RunMethod("web", Array(stringGridLinePaintColor)))) _
.RunMethodJO("minorHGridLinesVisible", Array(False)) _
.RunMethodJO("mediumHGridLinesVisible", Array(False)) _
.RunMethodJO("minorVGridLinesVisible", Array(False)) _
.RunMethodJO("mediumVGridLinesVisible", Array(False)) _
.RunMethodJO("gridLineDashes", Array(gridLineDashes)) _
.RunMethodJO("build", Null)
Log(xySeries1)
Dim javaobjectarray As JavaObject
javaobjectarray.InitializeArray("eu.hansolo.fx.charts.series.XYSeries", Array(xySeries1))
Dim lineChartPane As JavaObject
lineChartPane.InitializeNewInstance("eu.hansolo.fx.charts.XYPane", Array(javaobjectarray))
Dim axisjavaobject As JavaObject
axisjavaobject.InitializeArray("eu.hansolo.fx.charts.Axis", Array(yAxisLeft, xAxisBottom))
chart.InitializeNewInstance("eu.hansolo.fx.charts.XYChart", Array(lineChartPane, grid, axisjavaobject))
'add the chart to Pane1
Pane1.AddNode(chart,Pane1.Width*0.025,Pane1.Height*0.025,Pane1.Width*0.95,Pane1.Height*0.95)
End Sub