Chart menu with Scripting

Hi All,
I was wondering if someone knows if it’s possible to replicate the Chart’s menu, the right-click menu (MODE,BACKGROUND, etc ) , via script.
Basically, I’m asking if it’s possible to have a bunch of buttons on the HMI page, where for every single button I have a “property” of the Chart’s Menu.
So, in this case I’ll have a button for:
“Zoom” and if clicked I’ll have the possibility to zoom;
“Pan” and if clicked I’ll have the possibility to pan around;
and so on…

Thanks for the attention.

Cheers,

Since the Chart extends from JFreeChart you can use some of the public methods from the ChartPanel class to do it. See the following for a full list of commands:
http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/ChartPanel.html

Button -> actionPerformed:

from java.awt.event import ActionEvent
from org.jfree.chart import ChartPanel

printCommand = ActionEvent(event.source, ActionEvent.ACTION_PERFORMED, ChartPanel.PRINT_COMMAND)

table = event.source.parent.getComponent("Chart")
table.actionPerformed(printCommand)
1 Like

Yes, the chart objects have a setMode() scripting function (method) that actually performs the mode selection.

1 Like

:heart_eyes:
Thanks for the info guys! I just made it and already added to my project.
Thanks again!

Cheers,