# Easy Chart mode not changing with setMode

**URL:** <https://forum.inductiveautomation.com/t/easy-chart-mode-not-changing-with-setmode/114929>\
**Category:** Ignition\
**Tags:** ignition83\
**Created:** [April 7, 2026, 6:29pm UTC](https://forum.inductiveautomation.com/t/easy-chart-mode-not-changing-with-setmode/114929 "2026-04-07T18:29:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyle\_Latzke](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@Kyle\_Latzke](https://forum.inductiveautomation.com/u/Kyle_Latzke)\
**Post date:** [April 7, 2026, 6:29pm UTC](https://forum.inductiveautomation.com/t/easy-chart-mode-not-changing-with-setmode/114929/1 "2026-04-07T18:29:46Z")

</div>

We are no longer allowed to use right-click on Ignition client computers. IT uses Secure Desktop 12 blocked right-click. No convincing them otherwise.

I’ve found some other threads about this, but they had additional errors or were calling setMode incorrectly. I looks like I’m doing it correctly and not even getting errors. I can add print statements and it looks like the script is running.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/0/b00e3044055f25c52eb36b2c3ded6566031c24e1.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/5/9556a37d59da2f4b794fe0374fc84e6bf2050b97.png)

This is the script for the actionPerformed event for the Settings Menu button above. The menu works and I can see the debug prints when i click X-Trace for example.

The Easy Chart name is indeed “Easy Chart”.

I’m using an integer to change the mode.

```javascript
from javax.swing import JPopupMenu, JMenu, JMenuItem, JSeparator
from java.awt.event import ActionListener

chart = event.source.parent.getComponent('Easy Chart')

# MENU CALLBACK HELPER
class MenuAction(ActionListener):
    def __init__ (self, func):
        self.func = func
    def actionPerformed(self, e):
        self.func()

# MODE CHANGE
def setSpan():
    chart.setMode(1)

def setZoom():
    chart.setMode(0)

def setMark():
    chart.setMode(3)

def setXTrace():
    chart.setMode(4)
    print("chart set to Mode(4) - X-Trace")

# RESET AXES
def resetAxes():
    chart.axes = chart.axes
    chart.repaint()

# BACKGROUND
def setBlack():
    from java.awt import Color
    chart.background = Color.black
    chart.plotBackground = Color.black
    chart.repaint()

def setWhite():
    from java.awt import Color
    chart.background = Color.white
    chart.plotBackground = Color.white
    chart.repaint()

# BUILD MENU
menu = JPopupMenu()

# MODE SUBMENU
modeMenu = JMenu("Mode")

item = JMenuItem("Span")
item.addActionListener(MenuAction(setSpan))
modeMenu.add(item)

item = JMenuItem("Zoom")
item.addActionListener(MenuAction(setZoom))
modeMenu.add(item)

item = JMenuItem("Mark")
item.addActionListener(MenuAction(setMark))
modeMenu.add(item)

item = JMenuItem("X-Trace")
item.addActionListener(MenuAction(setXTrace))
modeMenu.add(item)

menu.add(modeMenu)

# RESET AXES
item = JMenuItem("Reset Axes")
item.addActionListener(MenuAction(resetAxes))
menu.add(item)

menu.add(JSeparator())

# BG SUBMENU
bgMenu = JMenu("Background")

item = JMenuItem("Black")
item.addActionListener(MenuAction(setBlack))
bgMenu.add(item)

item = JMenuItem("White")
item.addActionListener(MenuAction(setWhite))
bgMenu.add(item)

menu.add(bgMenu)

# POPUP MENU LOCATION (UNDER BUTTON)
menu.show(event.source, 0, event.source.height)

```

I figured I’d get some error at least. I saw a thread that said I might need to click the chart afterwards but that doesn’t make a difference. This seems so easy compared to stuff I’ve already done and I’m not sure what’s wrong.

---

<div class="post-metadata">

**Author:** ![Kyle\_Latzke](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@Kyle\_Latzke](https://forum.inductiveautomation.com/u/Kyle_Latzke)\
**Post date:** [April 8, 2026, 12:21pm UTC](https://forum.inductiveautomation.com/t/easy-chart-mode-not-changing-with-setmode/114929/2 "2026-04-08T12:21:57Z")

</div>

Sorry for the post, this window I was working on had an Easy Chart behind a Container that held another Easy Chart…

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 8, 2026, 4:46pm UTC](https://forum.inductiveautomation.com/t/easy-chart-mode-not-changing-with-setmode/114929/3 "2026-04-08T16:46:29Z")

</div>

PS: [system.gui.createPopupMenu | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-gui/system-gui-createPopupMenu)

Lot easier/less verbose than doing _all_ the swing menu work yourself.
