Skip to content

Commit

Permalink
Allow array for line opts in dataset (#10179)
Browse files Browse the repository at this point in the history
* fix line as array ts error

* added test

* implement only for the border,background color and radius
  • Loading branch information
LeeLenaleee committed Feb 21, 2022
1 parent 2f7550d commit 16e6acc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 4 additions & 2 deletions types/index.esm.d.ts
Expand Up @@ -177,8 +177,10 @@ export interface LineControllerDatasetOptions
extends ControllerDatasetOptions,
ScriptableAndArrayOptions<PointPrefixedOptions, ScriptableContext<'line'>>,
ScriptableAndArrayOptions<PointPrefixedHoverOptions, ScriptableContext<'line'>>,
ScriptableOptions<LineOptions, ScriptableContext<'line'>>,
ScriptableOptions<LineHoverOptions, ScriptableContext<'line'>>,
ScriptableOptions<Omit<LineOptions, keyof CommonElementOptions>, ScriptableContext<'line'>>,
ScriptableAndArrayOptions<CommonElementOptions, ScriptableContext<'line'>>,
ScriptableOptions<Omit<LineHoverOptions, keyof CommonHoverOptions>, ScriptableContext<'line'>>,
ScriptableAndArrayOptions<CommonHoverOptions, ScriptableContext<'line'>>,
AnimationOptions<'line'> {
/**
* The ID of the x axis to plot this dataset on.
Expand Down
13 changes: 13 additions & 0 deletions types/tests/controllers/line_styling_array.ts
@@ -0,0 +1,13 @@
import { Chart } from '../../index.esm';

const chart = new Chart('id', {
type: 'line',
data: {
labels: [],
datasets: [{
data: [],
backgroundColor: ['red', 'blue'],
hoverBackgroundColor: ['red', 'blue'],
}]
},
});

0 comments on commit 16e6acc

Please sign in to comment.