-
Couldn't load subscription status.
- Fork 12k
Closed
Labels
Milestone
Description
Expected Behavior
I am using a function as the value of backgroundColor on a bar chart. The allowed types should include a function that returns a color.
Current Behavior
The allowed types do not include a funciton:
Type '(context: any, options: any) => string' is not assignable to type 'string | _DeepPartialObject<CanvasGradient> | _DeepPartialObject<CanvasPattern> | undefined'.
Steps to Reproduce
import { ChartConfiguration } from 'chart.js';
const getConfig = (): ChartConfiguration<'bar'> => {
return {
type: 'bar',
options: {
backgroundColor: context => {
return '#fff'
},
}
}
}
Environment
- Chart.js version: 3.5.0
- Typescript: 4.3.5