# EasyChart configureChart extension function

**URL:** <https://forum.inductiveautomation.com/t/easychart-configurechart-extension-function/17300>\
**Category:** General Discussion\
**Created:** [March 9, 2018, 6:00pm UTC](https://forum.inductiveautomation.com/t/easychart-configurechart-extension-function/17300 "2018-03-09T18:00:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![steven.elam](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steven.elam/32/4797_2.png) [@steven.elam](https://forum.inductiveautomation.com/u/steven.elam)\
**Post date:** [March 9, 2018, 6:00pm UTC](https://forum.inductiveautomation.com/t/easychart-configurechart-extension-function/17300/1 "2018-03-09T18:00:52Z")

</div>

My project uses both Charts and EasyCharts. I received a feature request requiring that I save the user’s preference for chart background color when they use the right-click popup menu to change the color. For Charts, I accomplished this by using the configureChart extension function which is invoked when the right-click popup menu is used.

Unfortunately for EasyCharts, the configureChart function is not called when the user uses the popup menu. Is there another event or hook I can use to execute some code when the user uses the right-click popup menu?

---

<div class="post-metadata">

**Author:** ![phillip.bow](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@phillip.bow](https://forum.inductiveautomation.com/u/phillip.bow)\
**Post date:** [March 9, 2018, 7:44pm UTC](https://forum.inductiveautomation.com/t/easychart-configurechart-extension-function/17300/2 "2018-03-09T19:44:20Z")

</div>

Here’s one approach… maybe a little heavy handed, but the technique could possibly be applied elsewhere:

In Window -\> Scripting… -\> internalFrameActivated:

```auto
from com.inductiveautomation.factorypmi.application.components import PMIEasyChart
from com.inductiveautomation.factorypmi.application.components import PMIChart

charts = project.NewScript.getMatchingComponents([PMIEasyChart, PMIChart], event.source.rootContainer)

for chart in charts:
	print chart.plotBackground
	# set background color if user has preference saved

```

In Window -\> Scripting… -\> visionWindowClosed:

```auto
from com.inductiveautomation.factorypmi.application.components import PMIEasyChart
from com.inductiveautomation.factorypmi.application.components import PMIChart

charts = project.NewScript.getMatchingComponents([PMIEasyChart, PMIChart], event.source.rootContainer)

for chart in charts:
	print chart.plotBackground
	# save user preference if chart is not default white

```

In Project -\> Scripts -\> Script Library -\> NewScript: (_or Global -\> Shared if useful_)

```auto
def getMatchingComponents(componentTypes, rootComponent):
	matches = []
	
	if rootComponent is None:
		return matches
	
	if hasattr(rootComponent, 'components'):
		children = rootComponent.components
		
		for child in children:
			matches.extend(getMatchingComponents(componentTypes, child))	
	
	if(type(rootComponent) in componentTypes):
		matches.append(rootComponent)
		
	return matches
	

```

---

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [March 9, 2018, 8:04pm UTC](https://forum.inductiveautomation.com/t/easychart-configurechart-extension-function/17300/3 "2018-03-09T20:04:25Z")

</div>

Seems like @phillip.bow has the right idea, just grab the plotBackground when the window closes (or on a timer or something) since it seems fairly involved to get it when it actually changes.

To simplify things though:

```auto
ez = event.source.rootContainer.getComponent("Easy Chart")
print ez.plotBackground

```

Will work in your onVisionWindowClosed() event.

---

<div class="post-metadata">

**Author:** ![steven.elam](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steven.elam/32/4797_2.png) [@steven.elam](https://forum.inductiveautomation.com/u/steven.elam)\
**Post date:** [March 9, 2018, 10:37pm UTC](https://forum.inductiveautomation.com/t/easychart-configurechart-extension-function/17300/4 "2018-03-09T22:37:22Z")

</div>

I guess my question really is: Why is the event behavior for EasyChart different than that of Chart?

---

<div class="post-metadata">

**Author:** ![R.Alamsha](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@R.Alamsha](https://forum.inductiveautomation.com/u/R.Alamsha)\
**Post date:** [March 10, 2018, 12:54am UTC](https://forum.inductiveautomation.com/t/easychart-configurechart-extension-function/17300/5 "2018-03-10T00:54:56Z")

</div>

Functionality of charts and many components in Ignition is very basic and i don't think anything much will happen. Dashboard and component development community is very active in React JS. I think, Ignition has realized this trend and hence planning to release a new JS visualization module called Perspective. Very good move. Check this topic.

> [@Ignition Community Conference 2017](http://forum.inductiveautomation.com/t/ignition-community-conference-2017/15436/6):
>
> New Visualization Module – Perspective … This new module, called Perspective, will add browser-based clients to Ignition. It is based on front-end web technologies such as HTML5, Javascript, React and CSS3… This is interesting to see Ignition to become more web-based. Though it does raise some questions. Will Jython scripting still be available in the GUI when using Perspective, or will JavaScript become the primary scripting language? What about the backend scripts (gateway scripts, tag tri…

---

<div class="post-metadata">

**Author:** ![R.Alamsha](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@R.Alamsha](https://forum.inductiveautomation.com/u/R.Alamsha)\
**Post date:** [March 12, 2018, 9:55am UTC](https://forum.inductiveautomation.com/t/easychart-configurechart-extension-function/17300/6 "2018-03-12T09:55:22Z")

</div>

> [@steven.elam](#):
>
> I guess my question really is: Why is the event behavior for EasyChart different than that of Chart?

Did you try 3D Charts Module?. I think it's free.

[![](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/c/dc02b75fef3784ff667cc3cdbc1b17292489d0d6.jpeg "3D Charts Module Demo") ](https://www.youtube.com/watch?v=2PXHBKGlCs8)

---

<div class="post-metadata">

**Author:** ![dmdrendall](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dmdrendall](https://forum.inductiveautomation.com/u/dmdrendall)\
**Post date:** [October 10, 2018, 7:58pm UTC](https://forum.inductiveautomation.com/t/easychart-configurechart-extension-function/17300/7 "2018-10-10T19:58:27Z")

</div>

It doesn’t appear you’re getting your question answered. I’ve been working with the JFreeChart library for a few weeks now trying to control whether axes on certain subplots are visible or not. My understanding is the EasyChart is built from the base library JFreeChart, I’m not certain about the Chart component.

You’d have to check it’s properties, and read up on its javadocs to determine what you might have at your disposal.
