cancel
Showing results for 
Search instead for 
Did you mean: 

combining 2 tag queries in one chart

Former Member
0 Kudos

Hi,

I want to make a chart where the user can choose which data he wants to see. I have 3 options where somebody can choose from. But how can I combine 2 tag queries in one chart.

I already got 2 options, but there not the best one.

Option 1:

Make 1 tag query with all 3 lines and change the color from the pens to white when they don't want to see a line. (but then you get white spaces in your other lines)

Option 2:

Make 7 tag queries for each option (1&2&3;1&2;1&3;2&3;1;2;3). Drawback here is that I have to create so many tags... If I ever want to display 4 lines than I have a big problem.

I would be great if I could create 3 tag queries for each line and then combine them and put them in one graph

Does someone has any idea how to solve this?

Thank you!!

Jan

Accepted Solutions (1)

Accepted Solutions (1)

jcgood25
Active Contributor
0 Kudos

How dynamic are the tag / line combinations? If the user is only presented with a choice of lines, then do you know exactly which tags to use when they choose a line(s)? If so then some simple arrays for each line and using document.APPLET.getQueryObject().setTagName(x,strName); should be easy enough. It would still be only a single tag query with Server and Mode, but the tags would be driven from the client choices.

Former Member
0 Kudos

Thank you very much!!

I used the document.APPLETNAME.getQueryObject().setTagName() method!

jcgood25
Active Contributor
0 Kudos

Glad to hear that. I assume by now you've also figured out that if a user goes from 3 Lines down to 1 that you will need to clear out the extra indexed tags with .setTagName(x,"");

Former Member
0 Kudos

Yes, I already figured that out. I use .setTagName(x, null) though. It also works

Now I have another problem. Check the iSPCChart thread for that

Thank you!

Former Member
0 Kudos

Here something else you can do, it sort of emulates the "Tag Group" feature that is popular in most SCADA applications. With an XML file (or can use a database for this) you can define a groups of tags with whatever parameters you wish ie, color, line width line style, upper and lower pen limits etc. Then to render them on the page you can us a query (either XML query or SQL query depending on how you wish to store your tag information) From here you use some straightforward javascript to assign the tag information to the chart.

For fun, you can even have the user build their own tag groups and save them (again either as XML or in a database) Since your applet properties are both read and write, if you leave the chart applet user configurable, you could actually suck out the parameters of a chart they configured and save it as a "tag group" There all sorts of possibilities with this.

Former Member
0 Kudos

The "setTagName" and tag group approaches are optimal when all of the tags/datapoints are coming from the same data source. However, MII can also display data from multiple data sources on the same chart (or other applet) quite easily. Use BLS along with the Union (or, in some cases, Joiner) action to create a consolidated dataset that can be returned to the applet for display.

Answers (2)

Answers (2)

Former Member
0 Kudos

You should invest your time on BLS and XPath expressions to make your logics.

Former Member
0 Kudos

Jan_Vanderstappen,

You can have a chart with one of the queries as default. Then base on user inputs, you can use Javascript to change the query object assigned to that applet at runtime.

BR,

SB.

Former Member
0 Kudos

Thank you for the fast answer,

but I when I use that method, I need to create 7 tag queries (one for each unique option) and I was wondering if there was a method so I shouldn't need to use 7 queries.