# Perspective - XY Charts column colors - Conditional

**URL:** <https://forum.inductiveautomation.com/t/perspective-xy-charts-column-colors-conditional/77520>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [August 7, 2023, 1:49pm UTC](https://forum.inductiveautomation.com/t/perspective-xy-charts-column-colors-conditional/77520 "2023-08-07T13:49:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandre\_Rousselet](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@Alexandre\_Rousselet](https://forum.inductiveautomation.com/u/Alexandre_Rousselet)\
**Post date:** [August 7, 2023, 1:49pm UTC](https://forum.inductiveautomation.com/t/perspective-xy-charts-column-colors-conditional/77520/1 "2023-08-07T13:49:26Z")

</div>

Hello,

I am working in Perspective to setup some XYcharts on my dashboard.

I am trying to setup an XY column chart with column styles for each x value depending on their respective y values.

For example on the chart below, my reference would be the red line value. If under I would be columns would be red, if over, columns would be green.

I am already able to change the whole series colors based on that, but still not able to do that per column.

Any idea in which properties of my XYchart I would be able to find this value?  
Any idea if such setup is possible, and if not, should I just split this in two series (1 red, 1 green)

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

Thanks,

Alexandre

---

<div class="post-metadata">

**Author:** ![CalebM](https://avatars.discourse-cdn.com/v4/letter/c/71c47a/32.png) [@CalebM](https://forum.inductiveautomation.com/u/CalebM)\
**Post date:** [August 7, 2023, 2:05pm UTC](https://forum.inductiveautomation.com/t/perspective-xy-charts-column-colors-conditional/77520/2 "2023-08-07T14:05:10Z")

</div>

You will want to use the deriveFieldsFromData property.

You'll need to add a property to set the color with for each data point. You will want to set this property based on the value.

 ![Capture1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/c/5c2496a8af2304700c0bdb003eaa0c7b02824a34.png)  
Then you will need to add the name of the property to the deriveFieldsFromData. You could use multiple properties if you wanted different fill and stroke colors.  
 ![Capture2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/e/1ece9f61920aa5e4e9e0fca44b9e7465c5615bce.png)

---

<div class="post-metadata">

**Author:** ![richard\_hamilton](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@richard\_hamilton](https://forum.inductiveautomation.com/u/richard_hamilton)\
**Post date:** [March 8, 2024, 10:56am UTC](https://forum.inductiveautomation.com/t/perspective-xy-charts-column-colors-conditional/77520/3 "2024-03-08T10:56:13Z")

</div>

Hi guys,

I have set up my XY chart, as a bar chart and have the bars showing red for out of spec and green for in spec. This is working lovely in preview mode.

![cuscom](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/9/e9d739db22eb1e52529e7088bb727f0277ad8165.png)

My problem is when I launch the perspective session the colours in the chart aren't being passed to the launched session.

![cuscom1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/7/c7d36d2810f517355ad724b0f6968f7e02c05e6c.png)

Would anyone have any idea why this is?

Thanks  
Richard

---

<div class="post-metadata">

**Author:** ![richard\_hamilton](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@richard\_hamilton](https://forum.inductiveautomation.com/u/richard_hamilton)\
**Post date:** [March 20, 2024, 10:10am UTC](https://forum.inductiveautomation.com/t/perspective-xy-charts-column-colors-conditional/77520/4 "2024-03-20T10:10:58Z")

</div>

So it appears the problem was when the session was launched the query was polling, thus losing the values in the color column.

I fixed this by creating a nested query which added the values for the color to the column as the query was polling.
