Jfreechart tag provider

Hello I have a simple component jfreechart how to insert data from a tag in this graphic

Is there a reason that you are not using the chart components built in Ignition?

it’s just a test for a component developed from outside of ignition

Someone who does a bit more module development might be able to answer in detail, but you will have to create the properties in the component you import and pass the data in through the designer.

I would take a look at the following link for the github for their vision component example.

This page from the SDK documentation also is useful.

yes I use this example on github when I export the module I try to drag and drop a tag but no data is displayed

Drag and drop probably is something that would need to be configured separately from the properties.

Hopefully someone who’s done more component stuff will see this. I mostly do modules to import libraries for scripting more than components and stuff.

You would need to add a DnD transfer handler to the component (doesn’t look like the sdk example has one) in order to support it. A good starting point would be to look at this - https://docs.oracle.com/javase/tutorial/uiswing/dnd/intro.html. I’m not entirely sure what the data flavour of tags look like so perhaps someone could chime in on that.

From the Easy Chart, to support drag and drop you’ll want to accept the ListOfNodeBrowseInfo flavor:

boolean fromTree = event.isDataFlavorSupported(ListOfNodeBrowseInfo.FLAVOR);
boolean fromTreeHistorical = event.isDataFlavorSupported(ListOfQualifiedPath.FLAVOR);
boolean fromTable = event.isDataFlavorSupported(VisionAdvancedTable.selectedRowsFlavor);

okay okay is there any other way to read a tag in a chart without drag and drop

Properly expose your fields following the Javabeans property-access style. The designer will automatically turn those javabeans into bindable properties in the designer - then you can just configure a binding on them in the runtime.

I only see the data property in the style field but can not use the tag to display the data


JFreeChart uses a different backing Dataset class (confusingly), not Ignition’s built-in dataset. Expose a generic ‘data’ property (type ignition.common.Dataset) with a getter and setter. Then when that property changes (ie, once a binding has been applied) you’ll need to pass that Ignition dataset into a new instance of com.inductiveautomation.factorypmi.application.components.chart.runtime.XYNumericDataSet.XYNumericDataSet. The DatasetDescriptor constructor argument bridges the gap between Ignition’s Dataset class and JFreeChart’s.

Ok thanks for the precision do you have a tutorial that explains the unfolding

Nope! :slight_smile:

Charts are a particularly rough starting point to build off of. @pturmel may have some advice, I know he’s at least extended the built in charts in one of his modules.

thanks PGriffith @pturmel do you have an example that you suggest

Unfortunately, no. I didn’t have to manipulate the JFreeChart datasets themselves when I wrote the NoteChart module. The key will be to have the setter for your data property initiate the transformation.