[chart.js] Add return type null to NestedTickOptions callback (#43143)

* [chart.js] Add return type null to NestedTickOptions callback

* [chart.js] Add undefined as callback return value
This commit is contained in:
Martin
2020-03-31 00:53:18 +02:00
committed by GitHub
parent 7e081dcef7
commit 41315ef7af
2 changed files with 19 additions and 2 deletions

View File

@@ -68,7 +68,21 @@ const chart: Chart = new Chart(ctx, {
xAxes: [
{
ticks: {
callback: Math.floor,
callback: (value) => {
if (value === 10) {
return Math.floor(value);
}
if (value === 20) {
return `${value}`;
}
if (value === 30) {
return undefined;
}
return null;
},
sampleSize: 10,
},
gridLines: {

View File

@@ -562,7 +562,10 @@ declare namespace Chart {
backdropPaddingX?: number;
backdropPaddingY?: number;
beginAtZero?: boolean;
callback?(value: any, index: any, values: any): string | number;
/**
* If the callback returns null or undefined the associated grid line will be hidden.
*/
callback?(value: number | string, index: number, values: number[] | string[]): string | number | null | undefined;
display?: boolean;
fontColor?: ChartColor;
fontFamily?: string;