# Changing colour of bars in bar charts

**URL:** <https://discourse.nodered.org/t/changing-colour-of-bars-in-bar-charts/93371>\
**Category:** Dashboard\
**Created:** [22 November 2024 21:03 UTC](https://discourse.nodered.org/t/changing-colour-of-bars-in-bar-charts/93371 "2024-11-22T21:03:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sirhc](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sirhc](https://discourse.nodered.org/u/Sirhc)\
**Post date:** [22 November 2024 21:03 UTC](https://discourse.nodered.org/t/changing-colour-of-bars-in-bar-charts/93371/1 "2024-11-22T21:03:43Z")

</div>

Hello

I have an array with 2 datasets in it which I inject into a chart. One set is the x-axis labels and the other is y-axis values.

I have the series colour in the chart set to blue and ticked the box " Use first colour for all bars ". However, one of the bars I'd like to make a different colour.

Is this possible? Can you specify individual bars to be individual colours?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [23 November 2024 08:09 UTC](https://discourse.nodered.org/t/changing-colour-of-bars-in-bar-charts/93371/2 "2024-11-23T08:09:22Z")

</div>

Yes it is possible, you would need to create two lots of the data,  
eg  
0,0,3,0  
2,4,0,2  
OG data 2,4,3,2  
And then stack the bar chart  
Not knowing what dashboard you are using

> **[Chart ui-chart | Node-RED Dashboard 2.0](https://dashboard.flowfuse.com/nodes/widgets/ui-chart.html#bar-charts)**
>
> Visualize your data beautifully with ui-chart in Node-RED Dashboard 2.0 for insightful analytics.

> [@Color one value in Node-Red Dashboard differently](https://discourse.nodered.org/t/color-one-value-in-node-red-dashboard-differently/83831/3):
>
> Not really a quick way, or even that clean, you could stack the bar chart, and use Javascript or Jsonata to create the look, but will not be perfect. e.g. [{"id":"fa5f6d3530e9471c","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"ui\_control","v":"{\"options\":{\"scales\":{\"xAxes\":[{\"stacked\":true}],\"yAxes\":[{\"stacked\":false}]}}}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","…

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 December 2024 08:10 UTC](https://discourse.nodered.org/t/changing-colour-of-bars-in-bar-charts/93371/3 "2024-12-07T08:10:16Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
