chartjs / chartjs/chartjs-plugin-datalabels

Color gradient doesn't work as expected

Open
#307 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
920
Forks
507
PR merge metrics
No merged PRs in 30d

Description

## The problem

I want to use a line chart with datalabels, with a color gradient. I want the datalabel background color to be the same color as the line.

## Expected behavior

When given the same CanvasGradient object to both the line color and datalabel color props, they should have the same color at any given point on the line.

## Current behavior

When I pass the same CanvasGradient object as the backgroundColor property to the datalabel config, it seems to completely ignore the value of the datalabel and uses the top-most color in the gradient, rather than calculating its color based on the position in the context chart range.

I have isolated the problem in this fork of the demo - https://codesandbox.io/s/plugin-example-forked-wv2uxg?file=/src/App.vue

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.