Sebastian Hernandez
Sebastian Hernandez

Reputation: 2376

Change background transparency of Chart.js chart

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!

Upvotes: 3

Views: 29131

Answers (1)

potatopeelings
potatopeelings

Reputation: 41065

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/

Upvotes: 5

Related Questions