-
Notifications
You must be signed in to change notification settings - Fork 5
CompaJ WorkSpace
Danila Rassokhin edited this page Mar 23, 2023
·
2 revisions
WorkSpace tab contains visual widgets such as charts, tables, e.t.c.
CompaJ can display charts, tables and other JavaFX objects which are instances of Node
class.
To display some widget simply call: CompaJ.addWorkSpaceWidget(WorkSpaceWidget)
in Terminal
or Editor
tab.
You can create line charts with simple LineChartBuilder
:
t = (0..10) //Create range
s = sin(t) //Calculate sin for range t
chart = :LineChartBuilder("t", "func", true) // Create chart with X axis called "t", Y axis called "func"
.with("sin(t)", t, s) // Add line on chart with name "sin(t)", t values for X axis and s values for Y axis
.build() // Build chart
CompaJ.addWorkSpaceWidget("Sin func chart", chart) // Add chart widget
You can create tables with simple TableBuilder
:
t = (0..10) //Create range
s = sin(t) //Calculate sin for range t
table = :TableBuilder // Create table
.addColumn(0, "sin(t)", s) // Add column with index = 0, named "sin(t)" with values from s
.build() // Build table
CompaJ.addWorkSpaceWidget("Sin func table", table) // Add table widget
You can display any instance of JavaFX Node
:
myJavaFXNode = createNode() // Get your JavaFX node here
CompaJ.addWorkSpaceWidget("MyWidget", myJavaFXNode) // Add myJavaFXNode as Widget with name "MyWidget"
CompaJ.addWorkSpaceWidget(myJavaFXNode) // Add myJavaFXNode as Widget with default name
You can create new widgets by implementing WorkSpaceWidget
interface in your class. See example in SIRModelWidget