# Get Chart (not Easy Chart) mode in script

**URL:** <https://forum.inductiveautomation.com/t/get-chart-not-easy-chart-mode-in-script/35662>\
**Category:** Ignition\
**Created:** [June 15, 2020, 4:25pm UTC](https://forum.inductiveautomation.com/t/get-chart-not-easy-chart-mode-in-script/35662 "2020-06-15T16:25:27Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 11, 2022, 5:57am UTC](https://forum.inductiveautomation.com/t/get-chart-not-easy-chart-mode-in-script/35662/14 "2022-10-11T05:57:04Z")

</div>

**For the Easy Chart** , I tested [@pturmel's approach](https://forum.inductiveautomation.com/t/easy-chart-accessing-the-datasets-being-rendered/8709/9) combined with [@klpe's method](https://forum.inductiveautomation.com/t/get-chart-not-easy-chart-mode-in-script/35662/11) for getting the radio buttons, and it works perfectly. However, if work is to be done with the code, there is no need to do the work every time the mouse enters the chart or every time the mouse enters some component on the chart, so rather than develop listeners, I simply added a custom component to the chart's parent container called oldMode. I then use the mode to evaluate whether or not work needs to be done at the _ **mouseEntered** _ event. Here is the code:

```auto
oldMode = event.source.parent.oldMode
def findJFChart(src):
	try: 
		return (src, src.chart) 
	except: pass 
	try: 
		for x in range(src.componentCount): 
			try:return findJFChart(src.getComponent(x)) 
			except: pass 
	except: pass 
	raise ValueError, "Unable to Find a JFreeChart Instance"
chart = event.source
ch = findJFChart(chart)
isPanned = ch[0].getPopupMenu().getSubElements()[0].getComponent().getItem(1).isSelected()
isZoomed = ch[0].getPopupMenu().getSubElements()[0].getComponent().getItem(0).isSelected()
isXtraced = ch[0].getPopupMenu().getSubElements()[0].getComponent().getItem(3).isSelected()
if isPanned:
	newMode = "Pan Mode"
elif isZoomed:
	newMode = "Zoom Mode"
elif isXtraced:
	newMode = "XTrace Mode"
else:
	newMode = "Mark Mode"
if newMode != oldMode:
	print newMode 
	#do work HERE
	event.source.parent.oldMode = newMode

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/get-chart-not-easy-chart-mode-in-script/35662)._
