import "Simantics/DB" import "Simantics/Variables" import "Simantics/Model" import "Simantics/Entity" import "Simantics/Subscription" import "http://www.simantics.org/Charts-1.2" as CHART type Chart = Resource type ChartGroup = Resource type ChartItem = Resource importJava "org.simantics.charts.ui.SCLChart" where @JavaName createNewChart """ Creates a new Chart to the default Charts folder under the given Model parameter. Returns the created Chart. """ createChart :: Model -> Chart @JavaName createNewChart """ Creates a new Chart under the given ChartGroup parameter. Returns the created Chart. """ createChartInGroup :: ChartGroup -> Chart @JavaName createNewChartGroup """ Creates a new ChartGroup under the given Model parameter. Returns the created ChartGroup. """ createChartGroup :: Model -> ChartGroup @JavaName addChartItems """ 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. """ addChartItems :: Chart -> Variable -> ChartItem @JavaName linkSubToChart """ Links the given Subscription to the given chart and returns the created ChartItem. """ linkSubToChart :: Subscription -> Chart -> ChartItem """ Browses the given Model for its Charts and then returns them in a list. """ chartsOf :: Model -> [Chart] chartsOf model = recurse (toResource model) where recurse r = do cs = resourceChildrenOf r charts = map fromResource $ filter isChart cs chartGrp = filter isChartGroup cs charts + concatMap recurse chartGrp isChart r = isInstanceOf r CHART.TimeSeriesChart isChartGroup r = isInstanceOf r CHART.ChartGroup