From 29a9dcdcb87cd66d6f77723745e12613027c6046 Mon Sep 17 00:00:00 2001 From: alexandre Date: Fri, 5 Apr 2024 16:49:49 +0200 Subject: [PATCH] rename V to Value --- packages/x-charts/src/internals/colorScale.ts | 10 +++++----- packages/x-charts/src/models/colorMapping.ts | 14 +++++++------- packages/x-charts/src/models/seriesType/common.ts | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/x-charts/src/internals/colorScale.ts b/packages/x-charts/src/internals/colorScale.ts index d114ffa15d639..a0c2807e9dfd4 100644 --- a/packages/x-charts/src/internals/colorScale.ts +++ b/packages/x-charts/src/internals/colorScale.ts @@ -5,8 +5,8 @@ import { OrdinalColorConfig, } from '../models/colorMapping'; -export function getSequentialColorScale( - config: ContinuousColorConfig | PiecewiseColorConfig, +export function getSequentialColorScale( + config: ContinuousColorConfig | PiecewiseColorConfig, ) { if (config.type === 'piecewise') { return scaleThreshold(config.thresholds, config.colors); @@ -15,9 +15,9 @@ export function getSequentialColorScale( return scaleSequential([config.min ?? 0, config.max ?? 100], config.color); } -export function getOrdinalColorScale( - config: OrdinalColorConfig, -): ScaleOrdinal | ScaleOrdinal { +export function getOrdinalColorScale( + config: OrdinalColorConfig, +): ScaleOrdinal | ScaleOrdinal { if (config.values) { return scaleOrdinal(config.values, config.colors).unknown(config.unknownColor ?? null); } diff --git a/packages/x-charts/src/models/colorMapping.ts b/packages/x-charts/src/models/colorMapping.ts index 46cfd38afa169..045de15faa73a 100644 --- a/packages/x-charts/src/models/colorMapping.ts +++ b/packages/x-charts/src/models/colorMapping.ts @@ -1,27 +1,27 @@ -export interface ContinuousColorConfig { +export interface ContinuousColorConfig { type: 'continuous'; /** * The minimal value of the color scale. * @default 0 */ - min?: V; + min?: Value; /** * The maximal value of the color scale. * @default 100 */ - max?: V; + max?: Value; /** * The colors to render. Can either be and array with the extrem colors, or an interpolation function. */ color: [string, string] | ((t: number) => string); } -export interface PiecewiseColorConfig { +export interface PiecewiseColorConfig { type: 'piecewise'; /** * The thresholds where color should change from one category to another. */ - thresholds: V[]; + thresholds: Value[]; /** * The colors used for each band defined by `thresholds`. * Should contain N+1 colors with N the number of thresholds. @@ -29,13 +29,13 @@ export interface PiecewiseColorConfig { colors: string[]; } -export interface OrdinalColorConfig { +export interface OrdinalColorConfig { type: 'ordinal'; /** * The value to map. * If undefined, it will be integers from 0 to the number of colors. */ - values?: V[]; + values?: Value[]; /** * The color palette. */ diff --git a/packages/x-charts/src/models/seriesType/common.ts b/packages/x-charts/src/models/seriesType/common.ts index 97a51b2047928..3ce9e1479e1ed 100644 --- a/packages/x-charts/src/models/seriesType/common.ts +++ b/packages/x-charts/src/models/seriesType/common.ts @@ -11,7 +11,7 @@ export type CommonSeriesType = { * @param {TValue} value The series' value to render. * @returns {string} The string to dispaly. */ - valueFormatter?: (value: V) => string; + valueFormatter?: (value: Value) => string; highlightScope?: Partial; };