Scripting JfreeChart using component property change.
The issue is that it throws in AttributeError when I try to access the dataset of chart.
Chart is located inside a template which has property change script :
at the end of the init, i’m trying to set the the dataset as:
which throws an error saying there is no attribute named Specs.
am I missing something here ?
This is a ‘Classic’ Chart component? The datasets work a bit differently, for complicated backend reasons. Try using self.chart.setPropertyValue("Specs", data)
True, Doesn’t need a class to do this little but setting the dataset from component event doesn’t work either.
For example,
I am running property change script on root container of the template which sets the value of the dataset. When I test it, I can see it’s initializing since the number on Y-axis changes as per the data but I don’t see the chart coming up.
For those awaiting news, the root cause is that the data that needed to be displayed, can’t be displayed due to null values interspersed within the dataset. Separating them out to individual datasets solved the problem.
Dynamically adding datasets to a classic chart doesn’t exist, but could be helpful. Link to entry on ideas site, if one wants to upvote this.
Well, actually...
You could call getDynamicProps(), which returns a TreeMap<String, DynamicPropertyDescriptor>, then add your own DynamicPropertyDescriptor to the map, and then apply it back to the chart with setDynamicProps(). Use the four argument constructor for com.inductiveautomation.factorypmi.application.binding.DynamicPropertyDescriptor - DynamicPropertyDescriptor("name", "description", com.inductiveautomation.ignition.common.Dataset, <your dataset>)
Hi, i am using classic chart in vision … in easy chart units of the tags will show in y axis(note - only if tags has different units its will show separate Y axis for each)
I am trying to achieve same thing in classic chart (is there any jfree script to achieve my requirement)
i am trying to show separate Y axis for tags if units are different
Yes for each tag i have separate dataset. I have 3 tags so i created 3 dataset and 3 x axis and 3 yaxis… But i want to show 3 y axis only if 3 tags has different units… If 3 tags has same unit… Then i have to use one y axis for all tags…
Whether i understood your reply or i am saying any wrong ? …
Please give your suggestion to find solution for my issue
Put all tags with same units in the same dataset. Put tags with different units in different dataset. I don’t think there is any other solution for the classic chart.
Move your raw data bindings to custom properties on the container or some other component. Script the construction of a merged dataset for the chart when any raw data changes.