# How to create a stacked bar graph

**URL:** <https://discourse.nodered.org/t/how-to-create-a-stacked-bar-graph/21470>\
**Category:** FAQs\
**Created:** [10 February 2020 00:11 UTC](https://discourse.nodered.org/t/how-to-create-a-stacked-bar-graph/21470 "2020-02-10T00:11:46Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [10 February 2020 20:33 UTC](https://discourse.nodered.org/t/how-to-create-a-stacked-bar-graph/21470/2 "2020-02-10T20:33:34Z")

</div>

Based on data format example here: [https://github.com/node-red/node-red-dashboard/blob/master/Charts.md#bar-and-pie-charts](https://github.com/node-red/node-red-dashboard/blob/master/Charts.md#bar-and-pie-charts)  
And chartjs documentation here: [https://www.chartjs.org/docs/latest/charts/bar.html#stacked-bar-chart](https://www.chartjs.org/docs/latest/charts/bar.html#stacked-bar-chart)  
You will need to change **options** for chart to make bars stacked.  
Use `msg.ui_control` property to send options.

```auto
msg.payload = [{
    "series": ["X", "Y", "Z"],
    "data": [[5,6,9], [3,8,5], [6,7,2] ],
    "labels": ["Jan", "Feb", "Mar"]
}]
msg.ui_control = {
     options: {
        scales: {
            xAxes: [{
                stacked: true
            }],
            yAxes: [{
                stacked: true
            }]
        }
    }
}

return msg;

```

---

_[View the full topic](https://discourse.nodered.org/t/how-to-create-a-stacked-bar-graph/21470)._
