# Jfree chart issue

**URL:** <https://forum.inductiveautomation.com/t/jfree-chart-issue/30862>\
**Category:** Ignition\
**Created:** [December 20, 2019, 2:51pm UTC](https://forum.inductiveautomation.com/t/jfree-chart-issue/30862 "2019-12-20T14:51:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [December 20, 2019, 2:51pm UTC](https://forum.inductiveautomation.com/t/jfree-chart-issue/30862/1 "2019-12-20T14:51:41Z")

</div>

I have been trying to create a custom chart. one of the main problem I am running into is defining the Plot !  
I have a class object :

```auto
class LabTestChart():
	instance = None
	
	def __init__ ( self, chart ):
		self.chart = chart
		
		self.plotObj = chart.getPlot()
		
		# Each sub-plot is of type org.jfree.chart.plot.XYPlot
		# index 0 is the main part
		self.subPlots = self.plotObj.getSubplots()

```

and it gives me an error as :

```auto
AttributeError: 'com.inductiveautomation.factorypmi.application.com' object has no attribute 'getSubplots'

	at org.python.core.Py.AttributeError(Py.java:173)
	at org.python.core.PyObject.noAttributeError(PyObject.java:930)
	at org.python.core.PyObject.object ___getattribute__ (PyObject.java:3692)
	at org.python.core.PyObject$object ___getattribute___ exposer. __call__ (Unknown Source)
	at org.python.core.Deriveds. __findattr_ex__ (Deriveds.java:59)
	at org.python.core.PyObjectDerived. __findattr_ex__ (PyObjectDerived.java:983)
	at org.python.core.PyObject. __getattr__ (PyObject.java:923)
	at org.python.pycode._pyx640. __init__ $2(<module:shared.mixing.Reports.LabHistory>:55)
	at org.python.pycode._pyx640.call_function(<module:shared.mixing.Reports.LabHistory>)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:301)

```

which is little weird as jfree chart has the Subplot object !

Thanks

---

<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:** [December 20, 2019, 4:26pm UTC](https://forum.inductiveautomation.com/t/jfree-chart-issue/30862/2 "2019-12-20T16:26:05Z")

</div>

`AttributeError: 'com.inductiveautomation.factorypmi.application.com' object`

Print the `type(self.plotObj)` - it’s not a JFreeChart class, which is probably the problem.

Are you directly passing an Ignition component into your constructor? You need to go another level deeper to get the actual JFreeChart object - I believe it would be `<ignition component reference>.getChart().getPlot()`

---

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [January 3, 2020, 8:59pm UTC](https://forum.inductiveautomation.com/t/jfree-chart-issue/30862/3 "2020-01-03T20:59:28Z")

</div>

Got it working. Thanks

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 5, 2020, 12:01pm UTC](https://forum.inductiveautomation.com/t/jfree-chart-issue/30862/4 "2020-01-05T12:01:01Z")

</div>

Was the `getChart()` part missing the issue, or…? (for posterity)

---

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [January 6, 2020, 1:16pm UTC](https://forum.inductiveautomation.com/t/jfree-chart-issue/30862/5 "2020-01-06T13:16:26Z")

</div>

No, Since, it didn’t had more than 1 subPlot for that chart, PlotObj itself can be referenced to assign the variable to different properties of that subPlot. Basically, All I did is,

```auto
subPlots = self.plotObj

```

Hope it’s clear. Thanks
