From 0d1e002eeda51bf6a94e30617dc3d29bf05af532 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 18 Mar 2020 21:25:30 +0100 Subject: [PATCH] [chart.js] Add ticks to afterBuildTicks function (#43141) --- types/chart.js/chart.js-tests.ts | 3 +++ types/chart.js/index.d.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index 3f391ddd5a..6a1bc49819 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -276,6 +276,9 @@ const linearScaleChart: Chart = new Chart(ctx, { scaleLabel: { display: true, labelString: 'Closing price ($)' + }, + afterBuildTicks: (scale, ticks) => { + return [Math.max(...ticks), 10, Math.min(...ticks)]; } }] }, diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 0fc117a483..e19f71e7be 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -718,7 +718,7 @@ declare namespace Chart { afterUpdate?(scale?: any): void; afterSetDimension?(scale?: any): void; afterDataLimits?(scale?: any): void; - afterBuildTicks?(scale?: any): void; + afterBuildTicks?(scale: any, ticks: number[]): number[]; afterTickToLabelConversion?(scale?: any): void; afterCalculateTickRotation?(scale?: any): void; afterFit?(scale?: any): void;