Vision RingPlot using Pie Chart

I’ve realized that the Pie Chart component has recently had a configureChart extension function added to it. This is very much appreciated to dial in the appearance of the chart. I have a Pie Chart with the “style” property set to “Ring”. In the configureChart script I have the following.

	plot = chart.getPlot()
	plot.setShadowPaint(None)
	plot.setSeparatorsVisible(False)
	plot.setOutlineVisible(False)
	plot.setSectionDepth(0.12)
	plot.setCenterTextMode(CenterTextMode.FIXED)
	plot.setCenterText("TEST")

Ultimately I’m trying to display a value in the center of the ring, for testing I’m simply trying to get the word “TEST” to display in the center of the ring using the setCenterText method. When doing so I get the following error

ERROR Vision.Components.PieChart - Error invoking extension method.
org.python.core.PyException: Traceback (most recent call last):
  File "<extension-method configureChart>", line 16, in configureChart
AttributeError: 'org.jfree.chart.plot.RingPlot' object has no attribute 'setCenterTextMode'

	at org.python.core.Py.AttributeError(Py.java:207)
	at org.python.core.PyObject.noAttributeError(PyObject.java:1032)
	at org.python.core.PyObject.__getattr__(PyObject.java:1027)
	at org.python.pycode._pyx271.configureChart$1(<extension-method configureChart>:17)
	at org.python.pycode._pyx271.call_function(<extension-method configureChart>)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
	at org.python.core.PyFunction.function___call__(PyFunction.java:471)
	at org.python.core.PyFunction.__call__(PyFunction.java:466)
	at org.python.core.PyFunction.__call__(PyFunction.java:456)
	at org.python.core.PyFunction.__call__(PyFunction.java:451)
	at com.inductiveautomation.vision.api.client.components.model.ExtensionFunction.invoke(ExtensionFunction.java:151)
	at com.inductiveautomation.factorypmi.application.components.PMIPieChart.createPieChart(PMIPieChart.java:255)
	at com.inductiveautomation.factorypmi.application.components.PMIPieChart.setExtensionFunctions(PMIPieChart.java:682)
	at com.inductiveautomation.factorypmi.designer.eventhandling.ComponentScriptEditor.applyChanges(ComponentScriptEditor.java:599)
	at com.inductiveautomation.factorypmi.designer.eventhandling.ComponentScriptEditor$5.actionPerformed(ComponentScriptEditor.java:340)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
	at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.Component.processEvent(Unknown Source)
	at java.desktop/java.awt.Container.processEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

The plot is a RingPlot object so I’m not sure why that method isn’t available. Any ideas?

The JFreeChart library version we use is not fully up to date with the ‘upstream’ version - unfortunately, it looks like the RingPlot method in our bundled library doesn’t include any functionality that would fit what you’re trying to do. I don’t see anything in PiePlot (the direct parent class) either.