# XY Chart Perspective Dynamic Bullet Colour Change

**URL:** <https://forum.inductiveautomation.com/t/xy-chart-perspective-dynamic-bullet-colour-change/108145>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 4, 2025, 3:32pm UTC](https://forum.inductiveautomation.com/t/xy-chart-perspective-dynamic-bullet-colour-change/108145 "2025-07-04T15:32:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![backupaniket83](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@backupaniket83](https://forum.inductiveautomation.com/u/backupaniket83)\
**Post date:** [July 4, 2025, 3:32pm UTC](https://forum.inductiveautomation.com/t/xy-chart-perspective-dynamic-bullet-colour-change/108145/1 "2025-07-04T15:32:10Z")

</div>

Help Needed: Dynamic Bullet Color in XY Chart Based on SQL Data (Perspective)

Hi everyone,

I’m currently working on a Perspective XY Chart, and I need help applying dynamic bullet colors in series[0] based on a threshold value.

✅ Objective:

Color the bullet (marker) of each point in the chart:

Red if the Y-axis value exceeds a threshold (e.g., \> 1)

Blue otherwise

📊 Setup:

Chart Type: XY Chart in Perspective

Series: series[0]

Data Source: Named Query (querying SQL data)

Dataset contains:

Timestamp (x-axis)

NumericValue (y-axis)

Source (label/tooltip)

⚙ What I Tried:

I bound series[0].data to the Named Query and applied a Script Transform to add a "bulletColor" key per row, like so:

newData =

for row in range(value.getRowCount()):  
xVal = value.getValueAt(row, "Timestamp")  
yVal = value.getValueAt(row, "NumericValue")  
sourceVal = value.getValueAt(row, "Source")

```
newData.append({
    "x": xVal,
    "y": yVal,
    "source": sourceVal,
    "bulletColor": "red" if yVal > 1 else "blue"
})

```

return newData

In the chart configuration, I set:

series[0].x → "x"

series[0].y → "y"

series[0].source → "source"

series[0].bullet.fill → "bulletColor"

❌ Issue:

Despite trying this approach and variations of it:

The bullet color is not changing dynamically

Or the chart throws an error like "array found, string expected"

Or the chart shows no data

🧩 Questions:

1. Is this approach officially supported in Perspective for per-point bullet colors?

2. Does bullet.fill accept dynamic values from series[0].data rows?

3. Is there an alternative method (e.g., using scripting or styling per series) that works reliably?

Any guidance, working example, or reference is truly appreciated — I’ve been exploring this for a few days and would love to know if others have solved this cleanly.

Thanks in advance! 🙏

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [July 4, 2025, 5:07pm UTC](https://forum.inductiveautomation.com/t/xy-chart-perspective-dynamic-bullet-colour-change/108145/2 "2025-07-04T17:07:26Z")

</div>

Welcome to the forum!  
Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). You can edit your post to fix it. Thanks.

---

<div class="post-metadata">

**Author:** ![Ujwal\_Wankhede](https://avatars.discourse-cdn.com/v4/letter/u/4af34b/32.png) [@Ujwal\_Wankhede](https://forum.inductiveautomation.com/u/Ujwal_Wankhede)\
**Post date:** [July 5, 2025, 2:34am UTC](https://forum.inductiveautomation.com/t/xy-chart-perspective-dynamic-bullet-colour-change/108145/3 "2025-07-05T02:34:50Z")

</div>

Configure the color variable in `deriveFieldsFromData`  
`series[n].line.appearance.bullets[0].deriveFieldsFromData.fill.color : "bulletColor"`

---

<div class="post-metadata">

**Author:** ![backupaniket83](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@backupaniket83](https://forum.inductiveautomation.com/u/backupaniket83)\
**Post date:** [July 6, 2025, 2:19pm UTC](https://forum.inductiveautomation.com/t/xy-chart-perspective-dynamic-bullet-colour-change/108145/4 "2025-07-06T14:19:59Z")

</div>

I tried setting series[0].line.appearance.bullets[0].deriveFieldsFromData.fill.color to "bulletColor", and my dataset includes that field with proper color values like "#FF0000" and "green", but it's still not working. The bullet type is set to "circle" and the data is correctly bound. Is there anything else I might be missing? Screenshot and structure below.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [July 7, 2025, 6:23am UTC](https://forum.inductiveautomation.com/t/xy-chart-perspective-dynamic-bullet-colour-change/108145/5 "2025-07-07T06:23:00Z")

</div>

I dont see screenshot

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [July 7, 2025, 6:49am UTC](https://forum.inductiveautomation.com/t/xy-chart-perspective-dynamic-bullet-colour-change/108145/6 "2025-07-07T06:49:12Z")

</div>

And you didn't fix the code formatting in your first post. Please help us help you.

---

<div class="post-metadata">

**Author:** ![backupaniket83](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@backupaniket83](https://forum.inductiveautomation.com/u/backupaniket83)\
**Post date:** [July 7, 2025, 6:16pm UTC](https://forum.inductiveautomation.com/t/xy-chart-perspective-dynamic-bullet-colour-change/108145/7 "2025-07-07T18:16:44Z")

</div>

Sorry, I need a screenshot for reference to apply the same settings as per the suggestion given.

---

<div class="post-metadata">

**Author:** ![backupaniket83](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@backupaniket83](https://forum.inductiveautomation.com/u/backupaniket83)\
**Post date:** [July 7, 2025, 6:17pm UTC](https://forum.inductiveautomation.com/t/xy-chart-perspective-dynamic-bullet-colour-change/108145/8 "2025-07-07T18:17:26Z")

</div>

It is just example I have apply param setting not used any code

---

<div class="post-metadata">

**Author:** ![Ujwal\_Wankhede](https://avatars.discourse-cdn.com/v4/letter/u/4af34b/32.png) [@Ujwal\_Wankhede](https://forum.inductiveautomation.com/u/Ujwal_Wankhede)\
**Post date:** [July 8, 2025, 5:22am UTC](https://forum.inductiveautomation.com/t/xy-chart-perspective-dynamic-bullet-colour-change/108145/9 "2025-07-08T05:22:56Z")

</div>

I suspect you're using "bulletColor" as a quoted string, which might be causing the issue. If that's the case, it won't work as expected.  
Here is the working sample below:

 ![Bullet Example](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/3/13f3a16bdaad4b9c446ee437d0f29b323d31cdc8.png)
