My Easy Chart component tagPens property is populated using a SELECT from a database table - it depends on the machine whose status the operator wants to see.
The operator would like to persist the choices he makes in the chart legend. Example: if he hides a pen, that pen should be hidden also next time he lands on the trend page for that machine; same for the color, if he changes the color using the chart legend control, the new color should be saved for the next access.
As I can see, It doesn’t seem to be any changes in the tagPens property after using the legend control, so that I can read and store them to the database.
Is there any other way to access the actual pen configuration?
I assume that by chart legend, you mean the Pen Control.
When a tag is checked or unchecked in the Pen Control it modifies the Enabled column in the appropriate dataset for that pen. If you are using the Ignition Historical tags this would be the tagPens dataset. This is also true for the color (color changes in the pen control are propagated to the appropriate dataset).
If you’re trying to see this in the designer, you have to be careful. The properties of Easy Chart at design time are cached and will not be modified, even if you run the window in designer.
To see that the dataset is truly being modified, create a table on the window and bind it to the tagPens dataset, this will show you what will be modified at runtime.
I’ve just tried: as far as my tests are concerned, when I check/uncheck a pen or change the color appearance of a pen in the pen control, there’s no change at all in the pen properties in the tagPens dataset property of the Easy Chart. I tested that in two ways:
By binding a table control to the tagPens property of the Easy Chart
By printing to the console the ENABLED and COLOR field values of the tagPens dataset property by means of a Button
Make certain that the Auto Apply property is set to true. If it isn’t there should be an apply button on the chart, you’ll need to click that to apply the changes to the dataset.
Otherwise, perhaps a binding to the tagPens dataset is overwriting it so it’s always enabled.