Send different parameters to an Easy Chart

Hi there,

Is it possible to send different parameters pressing a button to an Easy Chart in the same window? For example, I have two buttons, one with Temperature parameters and when I press it, the Easy Chart shows it, and the other button with electrical parameters, and when I press it, the temperature parameters dissapear and then the same Easy Chart shows just electrical parameters.

Regards.

Yes. The simplest way would be to create custom dataset properties on each button with the same names as the configuration properties on the EasyChart (pens, tagPens, axes…). Then in the button’s actionPerformed event, copy the datasets from the button to the chart. Set the datasets up by copy/paste in each property’s dataset editor. (Set the chart the way you want, then copy its config datasets to the corresponding button.)

The actionPerformed events would look something like this:

ec = event.source.parent.getComponent("Easy Chart")
ec.axes = event.source.axes
ec.pens = event.source.pens
ec.tagPens = event.source.tagPens
ec.calcPens = event.source.calcPens
1 Like

Great! Thank you so much Phil!

Still have this problem, do you know why the date is in Dec, 1969? Please.:pray:

It’s because you don’t have any data for the chart to display. It should go away on its own when you have some actual data logged for at least one of the pens.

Oh thanks, I think I’m not using well the Tag Path in Cell Bindings, maybe you can help me please, I have a Data Type structure (Numerico) inside another Data Type Structure (BOMBA), how can I write the tag path to graph a Tag (Valor) that is in Numerico?

{Root Cointainer.BOMBA::Meta.TagPath}/Numerico.Value ? Or something like that?

I don’t think you need the .Value part of the tag path. Here’s an example of a Cell Update binding that I have on an Easy Chart here:

1 Like

Hi
Has anyone an example of a trend with buttons passing cell update bindings? I'm not getting it.

What exactly do you need? I don't think there's a viable method to pass cell update bindings via script, unless you do your cell update bindings to some custom property on a component on your window and then use the script to update the value on those properties.
I believe that an easier method would be doing what @pturmel described, have custom dataset properties somewhere, like on each button, and use the script to copy them to the chart's pen dataset properties.
Both methods end up being very similar, but the second one gives you much more flexibility since you're dealing with the whole dataset.

1 Like