File tree Expand file tree Collapse file tree 7 files changed +34
-17
lines changed Expand file tree Collapse file tree 7 files changed +34
-17
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ declare module 'chart.js' {
197
197
interface PluginOptionsByType <TType extends ChartType > {
198
198
customCanvasBackgroundColor? : {
199
199
color? : string
200
- }
200
+ } | false
201
201
}
202
202
}
203
203
```
Original file line number Diff line number Diff line change @@ -2913,13 +2913,13 @@ export interface TooltipItem<TType extends ChartType> {
2913
2913
}
2914
2914
2915
2915
export interface PluginOptionsByType < TType extends ChartType > {
2916
- colors : ColorsPluginOptions ;
2917
- decimation : DecimationOptions ;
2918
- filler : FillerOptions ;
2919
- legend : LegendOptions < TType > ;
2920
- subtitle : TitleOptions ;
2921
- title : TitleOptions ;
2922
- tooltip : TooltipOptions < TType > ;
2916
+ colors : ColorsPluginOptions | false ;
2917
+ decimation : DecimationOptions | false ;
2918
+ filler : FillerOptions | false ;
2919
+ legend : LegendOptions < TType > | false ;
2920
+ subtitle : TitleOptions | false ;
2921
+ title : TitleOptions | false ;
2922
+ tooltip : TooltipOptions < TType > | false ;
2923
2923
}
2924
2924
export interface PluginChartOptions < TType extends ChartType > {
2925
2925
plugins : PluginOptionsByType < TType > ;
Original file line number Diff line number Diff line change 1
- import { Chart } from '../../src/types.js' ;
1
+ import { Chart , TitleOptions , TooltipOptions } from '../../src/types.js' ;
2
2
3
3
Chart . defaults . scales . time . time . minUnit = 'day' ;
4
4
5
- Chart . defaults . plugins . title . display = false ;
5
+ ( Chart . defaults . plugins . title as TitleOptions ) . display = false ;
6
6
7
7
Chart . defaults . datasets . bar . backgroundColor = 'red' ;
8
8
@@ -27,4 +27,4 @@ Chart.defaults.layout = {
27
27
} ,
28
28
} ;
29
29
30
- Chart . defaults . plugins . tooltip . boxPadding = 3 ;
30
+ ( Chart . defaults . plugins . tooltip as TooltipOptions ) . boxPadding = 3 ;
Original file line number Diff line number Diff line change 1
- import { Chart } from '../../src/types.js' ;
1
+ import { Chart , TitleOptions } from '../../src/types.js' ;
2
2
3
3
Chart . overrides . bar . scales . x . type = 'time' ;
4
4
5
- Chart . overrides . bar . plugins . title . display = false ;
5
+ ( Chart . overrides . bar . plugins . title as TitleOptions ) . display = false ;
6
6
7
7
Chart . overrides . line . datasets . bar . backgroundColor = 'red' ;
8
8
Original file line number Diff line number Diff line change 1
- import { defaults } from '../../../src/types.js' ;
1
+ import { defaults , LegendOptions } from '../../../src/types.js' ;
2
2
3
3
// https://github.com/chartjs/Chart.js/issues/8711
4
- const original = defaults . plugins . legend . labels . generateLabels ;
4
+ const original = ( defaults . plugins . legend as LegendOptions < "line" > ) . labels . generateLabels ;
5
5
6
+ // @ts -ignore
6
7
defaults . plugins . legend . labels . generateLabels = function ( chart ) {
7
8
return [ {
8
9
datasetIndex : 0 ,
Original file line number Diff line number Diff line change
1
+ import { Chart } from '../../../src/types.js' ;
2
+
3
+ const chart = new Chart ( 'id' , {
4
+ type : 'bubble' ,
5
+ data : {
6
+ labels : [ ] ,
7
+ datasets : [ {
8
+ data : [ ]
9
+ } ]
10
+ } ,
11
+ options : {
12
+ plugins : {
13
+ legend : false
14
+ }
15
+ }
16
+ } ) ;
Original file line number Diff line number Diff line change 1
- import { Chart } from '../../../../src/types.js' ;
1
+ import { Chart , TooltipOptions } from '../../../../src/types.js' ;
2
2
3
- Chart . overrides . bubble . plugins . tooltip . callbacks . label = ( item ) => {
3
+ ( Chart . overrides . bubble . plugins . tooltip as TooltipOptions < 'bubble' > ) . callbacks . label = ( item ) => {
4
4
const { x, y, _custom : r } = item . parsed ;
5
5
return `${ item . label } : (${ x } , ${ y } , ${ r } )` ;
6
6
} ;
You can’t perform that action at this time.
0 commit comments