# Musson Industrial’s Embr-Charts Module

**URL:** <https://forum.inductiveautomation.com/t/musson-industrial-s-embr-charts-module/91618>\
**Category:** 3rd Party Modules\
**Tags:** perspective\
**Created:** [June 10, 2024, 12:53pm UTC](https://forum.inductiveautomation.com/t/musson-industrial-s-embr-charts-module/91618 "2024-06-10T12:53:46Z")\
**Posts on this page:** 1\
**Showing post:** 205

<div class="post-metadata">

**Author:** ![csjohnson](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@csjohnson](https://forum.inductiveautomation.com/u/csjohnson)\
**Post date:** [March 20, 2025, 5:50pm UTC](https://forum.inductiveautomation.com/t/musson-industrial-s-embr-charts-module/91618/205 "2025-03-20T17:50:59Z")

</div>

If I understand correctly, you want to color the bars on the chart based on some calculation (variant)? Is that variant constantly changing and you want the chart to update as it changes?

I'm not sure if `options.elements.bars` would be the correct place to do it. As I understand it, those properties are there to globally define styles for the listed elements.

_Although, it does seem to work..._

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

The arrow function would get called every time the chart is drawn/updated. The `ctx` object will contain the _x_ and _y_ values for a _single_ bar. In other words, for every bar that must be drawn, the arrow function on `backgroundColor` would be called with a new `ctx` object for the respective bar.

Post a sample of your dataset for us to see, if you can.  
Be sure to follow this guide when posting code/data.  
[Wiki - how to post code on this forum - General Discussion - Inductive Automation Forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831)

The "traditional" way would be to add the `backgroundColor` property to your dataset.  
See this link for more info: [Vertical Bar Chart | Chart.js](https://www.chartjs.org/docs/latest/samples/bar/vertical.html)

---

_[View the full topic](https://forum.inductiveautomation.com/t/musson-industrial-s-embr-charts-module/91618)._
