angular-chart.js icon indicating copy to clipboard operation
angular-chart.js copied to clipboard

Input color as an object not working correctly

Open Slowair6 opened this issue 8 years ago • 2 comments

I think the colors properties is not working correctly. some of them are not working, example "borderColor", "pointBorderColor"and "pointHoverBorderColor" and some of them use the other value, example "backgroundColor", "pointBackgroundColor" and "pointHoverBackgroundColor"

Slowair6 avatar Apr 22 '17 14:04 Slowair6

Hi, nearly the same issue for me, i'm using input color as an object but property "pointHoverBorderColor" isn't working using : vm.colors = [ { backgroundColor: "rgba(159,204,0, 0.2)", pointBackgroundColor: "rgba(159,204,0, 1)", pointHoverBackgroundColor: "rgba(159,204,0, 0.8)", borderColor: "rgba(159,204,0, 1)", pointBorderColor: '#fff', pointHoverBorderColor: "rgba(159,204,0, 1)" },"rgba(250,109,33,0.5)","#9a9a9a","rgb(233,177,69)" ]; for <canvas id="line" class="chart chart-line" chart-data="vm.data" chart-colors="vm.colors" chart-labels="vm.labels" chart-series="vm.series" chart-options="vm.options" chart-dataset-override="vm.datasetOverride" chart-click="vm.onClick"></canvas> chartissue

medaak avatar Jun 06 '17 09:06 medaak

Looks like this is the cause: backgroundColor actually returns pointBackgroundColor. angular-chart.js Line 327

function getData (labels, data, colors, datasetOverride) {
      var dataset = {
        labels: labels,
        datasets: [{
          data: data,
          backgroundColor: colors.map(function (color) {
            return color.pointBackgroundColor;
          }),
          hoverBackgroundColor: colors.map(function (color) {
            return color.backgroundColor;
          })
        }]
      };

priyananda avatar Jan 14 '18 08:01 priyananda