Rounded bar in v2.0

Hi there,

First thank you for your amazing library. I need to update the library 1.x to 2.0 for a client and i’m stuck on how to extend correctly my bar chart. I need to apply the same rounded effect on the bar which has been made with v1.0.2 . ChartJS syntax is quite different now.

var originalBarController = Chart.controllers.bar;
Chart.controllers.bar = Chart.controllers.bar.extend({
  draw: function(ease) {
    var i =0;
    originalBarController.prototype.draw.apply(this, arguments);

    /* write here the change to make to corners rounded */

  }

});

Q1 : How can I retrieve the dataset -> bars’ array from the extend function ? I only found the bar value with this.chart.chart.config.data.datasets.
Q2 : How can I perform that ?

Any advices appreciated!

JSField : http://jsfiddle.net/0dzp3jxw/

Author: Fantashit

2 thoughts on “Rounded bar in v2.0

  1. Here is a working example. CodePen

    Unfortunately in the time I had available, I could not get the radius to be set from the chart config so is globally set in the extension.

    Tested with Charts.js 2.5.0

    Source code: Repo

Comments are closed.