What I’d like to do is to drag and drop a tag with history on to an easychart and show the trend, (simples) but I’d like to show that same tag history with an offset. For example a 12 hours of tank level trend form yesterday and also day before on the same chart.
I can do it with a simple chart and a couple of tables, but I’d like the easycahrt features, ideally I’d like to use Travis’s template.
has anyone done this before, I guess its a case of scripting the datasets.
I don’t think this can be done with an Easy Chart because we don’t have control over the data that is retrieved from the server. But I think this could be done with a regular chart as you mentioned.
Hi Nick, I guessed as much, I just wondered if there was a trick somewhere, perhaps using a transaction group to record data instead of history, and then moving data into a dedicated 3 column table (t-stamp, value 1 & value 2), time shifting the second value. then reading the table from the easy chart.
If you are recording with a transaction group, and you only need one time offset (always a 12-hour offset), you could create a view in your database that subtracts that offset from t_stamp. Then reference the table for normal data, and the same column(s) in the view for offset data.
For a variable offset, you could create a helper table of client ids (or some unique key) versus desired time offset. In the view, join the original table with the helper table and subtract the joined offset from t_stamp. Then add the client id condition to the db pen’s where clause. Unwieldy, but should work.
my big challenge is that there will be at least 150 devices with 1 second data, I don’t want double data for each, I’d like to do it on the fly. this project is at bid stage at present, I know I can do it but its just figuring out a plan so I can cost it.
Database views hold no actual data. They are just queries that are saved in the database that can be accessed as if they were tables. That makes them usable within an EasyChart (as DB pens).
Anyways, the offset “tables” would not require more storage. Just record your history with SQL Bridge transactions. The rest is computed on the fly like any other query.
I decided on a slightly different approach, a bit long-winded but it works well,
set up an easy chart as normal using historical tags
Read the tagpaths of any tag pens on the easy chart,
read the historical tag data for the offset datetimes in to a dataset
loop thru the dataset changing the datetime by the offset.
use that dataset to build a new table in the database.
make a dataset for the easychart DB pens that references the new table and send it to the easy chart.
put in some anti-idiot code and run as required.
Using the tagpaths from the easychart means that it works with drag and drop as well as fixed and indirected tags, it still need quite a bit of polishing but I idea is sound and will do what I need it to.