diff --git a/docs/developers/axes.md b/docs/developers/axes.md index 01917928947..6bc4507126c 100644 --- a/docs/developers/axes.md +++ b/docs/developers/axes.md @@ -90,9 +90,8 @@ To work with Chart.js, custom scale types must implement the following interface // Get the pixel (x coordinate for horizontal axis, y coordinate for vertical axis) for a given value // @param value : the value to get the pixel for - // @param index : index into the data array of the value - // @param datasetIndex : index of the dataset the value comes from - getPixelForValue: function(value, index, datasetIndex) {}, + // @param [index] : index into the data array of the value + getPixelForValue: function(value, index) {}, // Get the value for a given pixel (x coordinate for horizontal axis, y coordinate for vertical axis) // @param pixel : pixel value diff --git a/docs/getting-started/v3-migration.md b/docs/getting-started/v3-migration.md index 9372488bce4..7e4ba2ad0e0 100644 --- a/docs/getting-started/v3-migration.md +++ b/docs/getting-started/v3-migration.md @@ -467,7 +467,7 @@ The APIs listed in this section have changed in signature or behaviour from vers #### Changed in Scales * `Scale.getLabelForIndex` was replaced by `scale.getLabelForValue` -* `Scale.getPixelForValue` now has only one parameter. For the `TimeScale` that parameter must be millis since the epoch +* `Scale.getPixelForValue` now only requires one parameter. For the `TimeScale` that parameter must be millis since the epoch. As a performance optimization, it may take an optional second parameter, giving the index of the data point. ##### Changed in Ticks diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index 9043ac851a4..fd5c53848e5 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -1219,7 +1219,7 @@ export interface Scale extends El * @param {number} [index] * @return {number} */ - getPixelForValue(value: number, index: number): number; + getPixelForValue(value: number, index?: number): number; /** * Used to get the data value from a given pixel. This is the inverse of getPixelForValue