I have a JFiddle example here which has rounded curves on bars: https://jsfiddle.net/qjae6xyp/
On the bars you are seeing there are curves on top.
There is a method below which draws those corners
Chart.types.Bar.extend({
name: "BarAlt",
initialize: function (data) {
Chart.types.Bar.prototype.initialize.apply(this, arguments);
if (this.options.curvature !== undefined && this.options.curvature <= 1) {
var rectangleDraw = this.datasets[0].bars[0].draw;
var self = this;
var radius = this.datasets[0].bars[0].width * this.options.curvature * 0.2;
// override the rectangle draw with ours
this.datasets.forEach(function (dataset) {
dataset.bars.forEach(function (bar) {
bar.draw = function () {
// draw the original bar a little down (so that our curve brings it to its original position)
var y = bar.y;
// the min is required so animation does not start from below the axes
bar.y = Math.min(bar.y + radius, self.scale.endPoint - 1);
// adjust the bar radius depending on how much of a curve we can draw
var barRadius = (bar.y - y);
rectangleDraw.apply(bar, arguments);
// draw a rounded rectangle on top
Chart.helpers.drawRoundedRectangle(self.chart.ctx, bar.x - bar.width / 2, bar.y - barRadius + 1, bar.width, bar.height, barRadius);
ctx.fill();
// restore the y value
bar.y = y;
}
})
})
}
}
});
But problem is I have angular project and using ng2-charts. https://stackblitz.com/edit/ng2-charts-bar-template-kkmuqx?file=src/app/app.component.ts
This example is a demonstration of my angular project.And I have horizontalBar chart here.I've been searching for many days to implement this rounded corner functionality here on ng2-charts but I couldn't be able to access that custom method through angular ng2-charts.I would be super-glad if someone could come up with my stackblitz example to show how it should be implemented.
https://stackblitz.com/edit/ng2-charts-bar-template-kkmuqx?file=src/app/app.component.ts