Remove backgroundColor for line graph
I love the ability to use the dynamic global colors, but I'm struggling to further customize the appearance of the graphs in my project. I'd like to remove the backgroundColor (or set opacity to 0) for line graphs but still have a background color for bar graphs.
Is there a way to do this that I'm overlooking? From what I see here, it looks like the backgroundColor value is always calculated based on the main color of that data series and can't be modified without completely removing background colors for all chart types:
function getColor (color) {
return {
backgroundColor: rgba(color, 0.2), //This is the line I'd like to be able to customize
pointBackgroundColor: rgba(color, 1),
pointHoverBackgroundColor: rgba(color, 0.8),
borderColor: rgba(color, 1),
pointBorderColor: '#fff',
pointHoverBorderColor: rgba(color, 1)
};
}
You can pass the entire color object with whatever value you want for backgroundColor.
On 21 Jul 2016 2:45 AM, "Caitlin Collins" [email protected] wrote:
I love the ability to use the dynamic global colors, but I'm struggling to further customize the appearance of the graphs in my project. I'd like to remove the backgroundColor (or set opacity to 0) for line graphs but still have a background color for bar graphs.
Is there a way to do this that I'm overlooking? From what I see here, it looks like the backgroundColor value is always calculated based on the main color of that data series and can't be modified without completely removing background colors for all chart types:
function getColor (color) { return { backgroundColor: rgba(color, 0.2), //This is the line I'd like to be able to customize pointBackgroundColor: rgba(color, 1), pointHoverBackgroundColor: rgba(color, 0.8), borderColor: rgba(color, 1), pointBorderColor: '#fff', pointHoverBorderColor: rgba(color, 1) }; }
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jtblin/angular-chart.js/issues/443, or mute the thread https://github.com/notifications/unsubscribe-auth/ABUxrs97cEVucY196g4KwKMQPfIM1MFzks5qXlDEgaJpZM4JQ-l5 .
Could you give an example of this please?
You see the search input box at the top of the page, it's as simple as searching for "backgroundColor" there: https://github.com/jtblin/angular-chart.js/search?utf8=%E2%9C%93&q=backgroundColor
You can also use the datasetOverride to do this for each set of data inserted into the data array:
$scope.datasetOverride.push({backgroundColor: "rgba(0,0,0,0)"}); // TODO: This won't work in IE8, needs to be "rgb(0,0,0)"
<canvas class="chart chart-line"
chart-data="data"
chart-series="series"
chart-colors="colors"
chart-dataset-override="datasetOverride"
chart-options="options">
</canvas>