# Setting up bound value on chart

**URL:** <https://forum.inductiveautomation.com/t/setting-up-bound-value-on-chart/17372>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [March 15, 2018, 7:06am UTC](https://forum.inductiveautomation.com/t/setting-up-bound-value-on-chart/17372 "2018-03-15T07:06:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mel](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mel](https://forum.inductiveautomation.com/u/Mel)\
**Post date:** [March 15, 2018, 7:06am UTC](https://forum.inductiveautomation.com/t/setting-up-bound-value-on-chart/17372/1 "2018-03-15T07:06:31Z")

</div>

Is it possible to have a separate script for having a lower and upper bound value on chart while it has current value of scatter came from dataset query.

For example here in my data, I have my scatter plot in the chart and my aim is to put a dynamic value for its bound that has straight line. Because I tried to check the build in function on chart customizer properties and set the upper and lower bound from both X and Y axes but still does’nt show the bound.

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/c37b1d85670d21f312d16061393c11b84bb76b1a.png)

Is there any script or function that will put bound manually on the chart.

output is something like this:  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/15f3aad8ab9e00461977e2b99e2a9c8af3e24978.png)

---

<div class="post-metadata">

**Author:** ![Claus\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Claus\_Nielsen](https://forum.inductiveautomation.com/u/Claus_Nielsen)\
**Post date:** [March 15, 2018, 9:47am UTC](https://forum.inductiveautomation.com/t/setting-up-bound-value-on-chart/17372/2 "2018-03-15T09:47:45Z")

</div>

Have you tried something like this

```auto
def setChartBounds(chart, min, max):

    plot = chart.getChart().getPlot()
    plot.getDomainAxis().setRange(min, max) # For setting the domain (x) axis bounds or
    plot.getRangeAxis().setRange(min, max) # For setting the range (y) axis bounds.

chart = event.source # Or whatever path to the chart
setChartBounds(chart, 0, 100)

```

---

<div class="post-metadata">

**Author:** ![Mel](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mel](https://forum.inductiveautomation.com/u/Mel)\
**Post date:** [March 16, 2018, 2:24am UTC](https://forum.inductiveautomation.com/t/setting-up-bound-value-on-chart/17372/3 "2018-03-16T02:24:10Z")

</div>

Yes, actually I already tried it and its working but the X and Y axis value will just simply adjust and my expectation is to have a line inside the chart like what I show in image above.

---

<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:** [March 16, 2018, 2:35am UTC](https://forum.inductiveautomation.com/t/setting-up-bound-value-on-chart/17372/4 "2018-03-16T02:35:02Z")

</div>

In an EasyChart, use two calculated pens with the Function = Constant. In a classic chart, add another dataset and create a constant dataset with points spanning your chart, connected by a line renderer.

---

<div class="post-metadata">

**Author:** ![Mel](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mel](https://forum.inductiveautomation.com/u/Mel)\
**Post date:** [March 16, 2018, 3:12am UTC](https://forum.inductiveautomation.com/t/setting-up-bound-value-on-chart/17372/5 "2018-03-16T03:12:15Z")

</div>

Thank you pturmel, Got it!

---

<div class="post-metadata">

**Author:** ![Claus\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Claus\_Nielsen](https://forum.inductiveautomation.com/u/Claus_Nielsen)\
**Post date:** [March 16, 2018, 6:42am UTC](https://forum.inductiveautomation.com/t/setting-up-bound-value-on-chart/17372/6 "2018-03-16T06:42:46Z")

</div>

You can also add range markers. This example is from the `configureChart` extension method.

```auto
def configureChart(self, chart):

	from org.jfree.chart.plot import ValueMarker
	from java.awt import Color, BasicStroke
		
	plot = chart.getPlot()
	
	stroke = BasicStroke(1.0)

	# Draws a horizontal red line through 12.4
	plot.addRangeMarker(ValueMarker(12.4, Color.RED, stroke))
	# Draws a horizontal blue line through 12.225
	plot.addRangeMarker(ValueMarker(12.225, Color.BLUE, stroke))
	

```

EDIT:  
Changed to fit your example with colors and location of markers 🙂
