Change background transparency of Chart.js chart

Sebastian Hernandez picture Sebastian Hernandez · Aug 30, 2015 · Viewed 17.3k times · Source

i'm using chart.js wrapped within angular-charts.js to create a bar chart in an Ionic framework app.

I want to make the bar background totally opaque.

This the code i have to create the chart.

<canvas id="bar" class="chart chart-bar" data="data" labels="labels" legend="true" series="series" options="{showTooltips: false}" colours="[ '#ffff00',    '#0066ff']"></canvas>

Have any idea of how could i achieve that?

Thanks a lot!

Answer

potatopeelings picture potatopeelings · Aug 31, 2015

colours should be an array of color objects (not an array of color strings). So you need [ { fillColor: '#ffff00' }, { fillColor: '#0066ff' } ]

<canvas id="bar" class="chart chart-bar" data="data" labels="labels" legend="true" series="series" options="{showTooltips: false}" colours="[ { fillColor: '#ffff00' }, { fillColor: '#0066ff' } ]"></canvas>

Fiddle - http://jsfiddle.net/dyt0wf31/