# Progress bar IGNITION 8.1

**URL:** <https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [March 3, 2022, 11:01pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812 "2022-03-03T23:01:51Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esme\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/ecb155/32.png) [@Esme\_Lopez](https://forum.inductiveautomation.com/u/Esme_Lopez)\
**Post date:** [March 3, 2022, 11:01pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/1 "2022-03-03T23:01:51Z")

</div>

Hello, I need to know how to add a progress bar in a power table in each cell of one column as animation or something changing color each percent, can anyone help me ?

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [March 5, 2022, 5:01am UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/2 "2022-03-05T05:01:24Z")

</div>

This may work for you. Open the power table script and put this on _configureCell_.

```auto
if colIndex == 0:
		from javax.swing import JProgressBar
		from java.awt import Color
				
		minValue = 0.0
		maxValue = 100.0
		colora = Color.RED
		colorb = Color.GREEN
		
		reda = colora.getRed()
		greena = colora.getGreen()
		bluea = colora.getBlue()		
		redb = colorb.getRed()
		greenb = colorb.getGreen()
		blueb = colorb.getBlue()		
		ratio = float(value)/(maxValue+minValue) if float(maxValue+minValue) != 0.0 else 0.0
		def pcolormix(pa,pb):
			return int(pb*ratio+pa*(1.0-ratio))		
		mixcolor = Color(pcolormix(reda, redb), pcolormix(greena, greenb), pcolormix(bluea, blueb))
		
		jbar = JProgressBar(int(minValue), int(maxValue))
		jbar.setValue(value)			
		jbar.setStringPainted(True)
		jbar.setForeground(mixcolor)
		jbar.setBackground(mixcolor)
		return {"renderer": jbar}

```

this is how it looks

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/3/d325027dd3c2fa513a2c938baec6b8ba9f8dc230.png)

---

<div class="post-metadata">

**Author:** ![Esme\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/ecb155/32.png) [@Esme\_Lopez](https://forum.inductiveautomation.com/u/Esme_Lopez)\
**Post date:** [March 7, 2022, 8:37pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/3 "2022-03-07T20:37:50Z")

</div>

Hi, thanks, I tried that but nothing happened, I check the code that I wrote but I think everything is ok

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [March 7, 2022, 8:51pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/4 "2022-03-07T20:51:58Z")

</div>

You should modify the code based on the column Index you want to apply the render. Also modify the min and max that apply to you case.

---

<div class="post-metadata">

**Author:** ![Esme\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/ecb155/32.png) [@Esme\_Lopez](https://forum.inductiveautomation.com/u/Esme_Lopez)\
**Post date:** [March 7, 2022, 8:54pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/5 "2022-03-07T20:54:56Z")

</div>

Yes, I change de number that my column has also do I need to change the min and max in the next sentence before and after the else? : ratio = float(value)/maxValue+minValue if float(maxValue+minValue) != 0.0 else 0.0

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [March 7, 2022, 8:58pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/6 "2022-03-07T20:58:05Z")

</div>

In my example I did

```auto
minValue = 0.0
maxValue = 100.0

```

You should only change those

```auto
minValue = yourminvalue
maxValue = yourmaxvalue

```

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [March 7, 2022, 9:01pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/7 "2022-03-07T21:01:30Z")

</div>

put `()` between max and min addition, like:

```auto
ratio = float(value)/(maxValue+minValue) if float(maxValue+minValue) != 0.0 else 0.0

```

---

<div class="post-metadata">

**Author:** ![Esme\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/ecb155/32.png) [@Esme\_Lopez](https://forum.inductiveautomation.com/u/Esme_Lopez)\
**Post date:** [March 7, 2022, 10:26pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/8 "2022-03-07T22:26:48Z")

</div>

thanks, I did it, let me try changing the value

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [March 7, 2022, 11:11pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/9 "2022-03-07T23:11:42Z")

</div>

OK, but you just really need to copy the code, maybe fix de indent and adjust some variables. Everything should work. Do you see any errors?

---

<div class="post-metadata">

**Author:** ![Esme\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/ecb155/32.png) [@Esme\_Lopez](https://forum.inductiveautomation.com/u/Esme_Lopez)\
**Post date:** [March 8, 2022, 3:52pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/10 "2022-03-08T15:52:13Z")

</div>

Thanks, It worked, the problema was that my columnwas an String and should be INT

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [March 9, 2022, 3:13am UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/11 "2022-03-09T03:13:14Z")

</div>

If that was a solution to the problem, please mark this post as solved.

---

<div class="post-metadata">

**Author:** ![Esmeralda\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@Esmeralda\_Lopez](https://forum.inductiveautomation.com/u/Esmeralda_Lopez)\
**Post date:** [April 21, 2022, 4:02pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/12 "2022-04-21T16:02:19Z")

</div>

Hi, if I want to change to other colors, can this work ?  
I tried with other colors but don’t let me do it

---

<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:** [November 4, 2024, 4:23pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/13 "2024-11-04T16:23:30Z")

</div>

Split this topic on November 4, 2024, 4:23pm UTC

2 posts were split to a new topic: [Progress bar in Perspective table](https://forum.inductiveautomation.com/t/progress-bar-in-perspective-table/98132)

---

<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:** [November 4, 2024, 6:28pm UTC](https://forum.inductiveautomation.com/t/progress-bar-ignition-8-1/56812/14 "2024-11-04T18:28:47Z")

</div>

Split this topic on November 4, 2024, 6:28pm UTC

2 posts were merged into an existing topic: [Progress bar in Perspective table](https://forum.inductiveautomation.com/t/progress-bar-in-perspective-table/98132/4)
