# Change background color of vision chart

**URL:** <https://forum.inductiveautomation.com/t/change-background-color-of-vision-chart/73322>\
**Category:** Ignition Early Access\
**Tags:** vision\
**Created:** [May 5, 2023, 9:14am UTC](https://forum.inductiveautomation.com/t/change-background-color-of-vision-chart/73322 "2023-05-05T09:14:35Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 15, 2023, 12:01pm UTC](https://forum.inductiveautomation.com/t/change-background-color-of-vision-chart/73322/8 "2023-05-15T12:01:49Z")

</div>

Sure. I have this in a `chart_util` library script:

```auto
from org.jfree.chart.plot import ValueMarker
from java.awt import Color, BasicStroke
#
# Supply a function to obtain the range value to mark with the given
# color and stroke.
class DynValueMarker(ValueMarker):
	def __init__ (self, callable, clr, stroke):
		super(ValueMarker, self). __init__ (0.0, clr, stroke)
		self.callable = callable
	def getValue(self):
		return self.callable()

```

You apply the above in configureChart with a function that reads the desired property. Note that for a classic chart, where this technique is most valuable, you have to put such properties on another component. I usually just use the parent container. This applies upper and lower specification limits to chart, where the props are in the chart's container:

```auto
	root = self.parent
	stroke = chart_util.BasicStroke(1.0)
	def getUSL():
		v = root.SelectedUSL
		return v
	def getLSL():
		v = root.SelectedLSL
		return v
	for plot in chart.plot.subplots:
		plot.addRangeMarker(chart_util.DynValueMarker(getUSL, chart_util.Color.RED, stroke))
		plot.addRangeMarker(chart_util.DynValueMarker(getLSL, chart_util.Color.BLUE, stroke))

```

The classic chart does not call `configureChart` for every data update the way the EasyChart does, which is why you need something that gets called with chart redraw.

{ If one were picky, and never needed to debug their [expletive], one might not use the intermediate variable `v` in those callables, or might even supply a lambda.... }

---

_[View the full topic](https://forum.inductiveautomation.com/t/change-background-color-of-vision-chart/73322)._
