# Trying to change color for ValueMarker on Bar Chart

**URL:** <https://forum.inductiveautomation.com/t/trying-to-change-color-for-valuemarker-on-bar-chart/63196>\
**Category:** Ignition\
**Tags:** ignition81, scripting, database, vision\
**Created:** [August 19, 2022, 12:16pm UTC](https://forum.inductiveautomation.com/t/trying-to-change-color-for-valuemarker-on-bar-chart/63196 "2022-08-19T12:16:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [August 19, 2022, 12:16pm UTC](https://forum.inductiveautomation.com/t/trying-to-change-color-for-valuemarker-on-bar-chart/63196/1 "2022-08-19T12:16:43Z")

</div>

Hello!

I am following this forum question [here](https://forum.inductiveautomation.com/t/bar-chart-report-static-line/18445/14), which shows how to add the valuemarker as well as changing the color of the line.

Although, I am having trouble getting the line to change colors. I am sure it has something to do with the script, just not sure what within it is giving me issues.

```auto
	from java.awt import Color
	from org.jfree.chart.plot import ValueMarker
	red = Color(255, 10, 10)
	marker = ValueMarker(26, red) #point on range axis to label
	marker.setLabel("Goal")
	chart.getPlot().addRangeMarker(marker)

```

This is the chart with that script, but when I remove the ` from java.awt import Color` and `red = Color(255, 10, 10)` it will populate with the line as intended.

The script for the working one,

```auto
	from org.jfree.chart.plot import ValueMarker
	marker = ValueMarker(26) #point on range axis to label
	marker.setLabel("Some Marker")
	chart.getPlot().addRangeMarker(marker)

```

This is the Bar Chart with working script.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/f/ff57d6edbdf521d19912ee21b909c180bd587d47.png)

Thank you

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 19, 2022, 3:59pm UTC](https://forum.inductiveautomation.com/t/trying-to-change-color-for-valuemarker-on-bar-chart/63196/2 "2022-08-19T15:59:25Z")

</div>

According to the [ValueMarker javadoc](https://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/plot/ValueMarker.html), the constructor needs a stroke style as well if you use a paint value in it.

EDIT: You might try the setPaint method on the marker

```python
	from java.awt import Color
	from org.jfree.chart.plot import ValueMarker
	red = Color(255, 10, 10)
	marker = ValueMarker(26) #point on range axis to label
	marker.setPaint(red)
	marker.setLabel("Goal")
	chart.getPlot().addRangeMarker(marker)

```

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [August 19, 2022, 5:30pm UTC](https://forum.inductiveautomation.com/t/trying-to-change-color-for-valuemarker-on-bar-chart/63196/3 "2022-08-19T17:30:24Z")

</div>

I did not have the stroke style constructor. After adding that it worked as intended! Thank you!
