# Easy Chart XYBoxAnnotation -layer background

**URL:** <https://forum.inductiveautomation.com/t/easy-chart-xyboxannotation-layer-background/25634>\
**Category:** Ignition\
**Created:** [June 7, 2019, 1:15pm UTC](https://forum.inductiveautomation.com/t/easy-chart-xyboxannotation-layer-background/25634 "2019-06-07T13:15:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjell](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@kjell](https://forum.inductiveautomation.com/u/kjell)\
**Post date:** [June 7, 2019, 1:15pm UTC](https://forum.inductiveautomation.com/t/easy-chart-xyboxannotation-layer-background/25634/1 "2019-06-07T13:15:55Z")

</div>

I’m not able to set XYBoxAnnotation to Layer.BACKGROUND for subplots  
(pens are drawn behind the box)  
grateful for tips!

Code in configureChart:  
from java.awt import Color, BasicStroke, Font  
from org.jfree.chart.annotations import XYBoxAnnotation  
from org.jfree.ui import Layer

```
for index, plot in enumerate(chart.getPlot().getSubplots()):
		index = index + 1
		if index ==1:
				title = 'Level' 
				stroke = BasicStroke(0)
				outline = Color(0, 0, 0)
				fill = Color(184,218,255)
				startX = self.startDate.getTime() 
				endX = self.endDate.getTime()
				bottomY = 70
				topY = 90
                                    overlay = XYBoxAnnotation(startX, bottomY, endX, topY, stroke, outline, fill)
                                    chart.getPlot().getSubplots().get(0).addAnnotation(overlay)
				#Layer.BACKGROUND
		elif index ==2:
			title = 'Speed' 
		elif index ==3:
					title = 'Water' 
		elif index ==4:
				title = 'Temp.' 
		elif index ==5:
				title = 'Titan' 
		labelAxis = NumberAxis("Subplot %s Title" % (index + 1))
		labelAxis = NumberAxis(title)

		
		labelAxis.setLabelFont(Font("Tahoma", Font.BOLD, 16))
		labelAxis.setTickLabelsVisible(False)
		labelAxis.setTickMarksVisible(False)
		labelAxis.setAxisLineVisible(False)
		plot.setDomainAxis(1, labelAxis)
		#print index, plot.getRangeAxis().getAutoRangeMinimumSize()
```

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [June 7, 2019, 4:01pm UTC](https://forum.inductiveautomation.com/t/easy-chart-xyboxannotation-layer-background/25634/2 "2019-06-07T16:01:45Z")

</div>

Add the annotation to the renderer.

```auto
renderer = plot.getRenderer()
renderer.addAnnotation(overlay,Layer.BACKGROUND)

```

---

<div class="post-metadata">

**Author:** ![kjell](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@kjell](https://forum.inductiveautomation.com/u/kjell)\
**Post date:** [June 12, 2019, 9:10am UTC](https://forum.inductiveautomation.com/t/easy-chart-xyboxannotation-layer-background/25634/3 "2019-06-12T09:10:54Z")

</div>

Great!  
Thank you!
