Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

Black borders in label.

Open Kiszko opened this issue 10 years ago • 2 comments

Any way to get rid of those nasty black borders around the coloured item rectangle within a label. (Don't know what you would call that).

Screenshot

I couldn't find this within the Docs, so forgive me if there's a setting I'm missing.

Thanks

Kiszko avatar Sep 21 '16 12:09 Kiszko

@Kiszko if you're using the latest version there is a callback to configure these colors.

options: {
  tooltips: {
    callbacks: {
      labelColor: function(tooltipItem, chartInstance) {
        var meta = chartInstance.getDatasetMeta(tooltipItem.datasetIndex);
        var activeElement = meta.data[tooltipItem.index];
        var view = activeElement._view;
        return {
          borderColor: 'transparent',
          backgroundColor: view.backgroundColor
        };
      }
    }
  }
}

etimberg avatar Sep 21 '16 18:09 etimberg

Thanks, although 'transparent' doesn't work. It only accepts a solid color, eg. 'red'. Additionally, no options for borderWidth here. :(

It's worth mentioning the colors get converted from rgba to rgb which is also a strange behaviour.

Guidance appreciated.

Kiszko avatar Sep 21 '16 19:09 Kiszko