2 import "Simantics/Variables"
3 import "Simantics/Model"
4 import "Simantics/Entity"
5 import "Simantics/Subscription"
7 import "http://www.simantics.org/Charts-1.2" as CHART
10 type ChartGroup = Resource
11 type ChartItem = Resource
13 importJava "org.simantics.charts.ui.SCLChart" where
14 @JavaName createNewChart
16 Creates a new Chart to the default Charts folder under the given Model parameter. Returns the created Chart.
18 createChart :: Model -> <Proc> Chart
20 @JavaName createNewChart
22 Creates a new Chart under the given ChartGroup parameter. Returns the created Chart.
24 createChartInGroup :: ChartGroup -> <Proc> Chart
26 @JavaName createNewChartGroup
28 Creates a new ChartGroup under the given Model parameter. Returns the created ChartGroup.
30 createChartGroup :: Model -> <Proc> ChartGroup
32 @JavaName addChartItems
34 Creates new chartItem with the given Variable to the given Chart and returns the created ChartItem. New Subscription item is created at the same time.
36 addChartItems :: Chart -> Variable -> <WriteGraph> ChartItem
38 @JavaName linkSubToChart
40 Links the given Subscription to the given chart and returns the created ChartItem.
42 linkSubToChart :: Subscription -> Chart -> <WriteGraph> ChartItem
45 Browses the given Model for its Charts and then returns them in a list.
47 chartsOf :: Model -> <ReadGraph> [Chart]
48 chartsOf model = recurse (toResource model)
51 cs = resourceChildrenOf r
52 charts = map fromResource $ filter isChart cs
53 chartGrp = filter isChartGroup cs
54 charts + concatMap recurse chartGrp
55 isChart r = isInstanceOf r CHART.TimeSeriesChart
56 isChartGroup r = isInstanceOf r CHART.ChartGroup