Streams is easiest way to set up data in charts. Stream is adaptive and can show few lines with same style.

How it works

In page's logic you provide history data for Charts widget. It is a grid with some columns:

As usually first column has name ts and contains timestamps. Other columns is named by points full name.

Stream gets some columns for X axis, some other columns for Y axis. In our case for X we want to see ts, for Y — all other columns. To set up that behaviour stream has two properties: xfiler and filter. To use ts column for X axis you set property xfilter as name == "ts". And for your convenience it's already a default value, in most cases you don't need to touch it. To select all other columns for Y axis we need to set filter to name != "ts". In that way we selects all columns which name is not ts, in other words — all other.

Properties xfilter and filter has same syntax as Folio readAll function's query. You can use and, not, ==!=, >= and <= operators here to make really good column selecting. So what we can do here except check name? Almost anything! In usual Folio history query each point's column contains full point definition: it contains all points tags and markers. We can select points by kind, by markers like sp, sensor, outside, chilling, by equipRef and so on. And also we have here name: it's a column name, calculated on point's dis.

So, as many columns stream can find in grid with provided filters, as many it creates traces to show in charts. All created traces created with same stream has same properties and styles except name and color: they are calculated automatically.

Simple case

So, let's try to set up simple stream to see how it works. We will create one stream that shows history data grid.

Add widget

Create new page and add charts and make size bigger. You will get something like that:

Load data

Go to Logic editor and place here Chart's block. And add Eval logic block. Provide call for eval block like one below:

readAll(his and kind=="Number")[0..2].hisRead(lastWeek)

Here we read three any numeric points with history and read data for last week.

And now connect eval out with charts in. You will have something line next:

Setup charts

Now we set up stream properties to show data. Go back to GUI editor and select charts widget.

Create new stream by clicking on + Stream button:

xfilter property already has initial value we need: name == "ts". "ts" — is a data column contains timestamp, SkySpark provide us that name. Let's keep timestamps on X axis.

Set filter property to name != "ts" to select other columns, which is are data numbers, like below:

And now it's already works, you can see it right in GUI tab:

Grouping traces

Also, with streams you can create groups of traces. For example, you want to show temperature as solid lines, and set points for temperature as dotted lines, like next:

To get that works you need more specified data call like next one:

readAll(temp and his and zone and kind=="Number").hisRead(yesterday).hisRollupAuto(1hr)

Here we load all zone temp points. You can get a lot of them so may be it's better to specify equipRef too. We make hisRollupAuto just to make call more faster.

Next we will create two streams.

In first stream we will show only sensor data with default line style. Create stream and set filter property as sensor to choose only sensor points from data grid, and that is all you need to do with first stream.

Now let's create second stream and set here sp, it's how we can filter only set point data:

To make lines for that traces 

Resume

Stream is the best your option to show data in common case. It's really easy to set up. Also, stream itself has same properties and styles like Trace.


  • No labels