Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: scale improvements #1383

Merged
merged 79 commits into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
63a8d02
test: undefined baseline with granular domain override
monfera Sep 17, 2021
d31d2e0
fix: ensure at least two array elements
monfera Sep 17, 2021
63dad76
test: restore singleton undefined for now
monfera Sep 17, 2021
6c6185d
fix: removing unnecessary let
monfera Sep 17, 2021
6a5a69e
test: typescript four point four
monfera Sep 17, 2021
6ab43ac
refactor: enjoying typescript four point four
monfera Sep 17, 2021
08838a9
refactor: yielding a true or false literal can always be simplified
monfera Sep 17, 2021
5d12a2a
chore: linter appeasement
monfera Sep 17, 2021
abfd291
test: removing more scale assertions 01
monfera Sep 17, 2021
5a1b349
test: removing more scale assertions 02
monfera Sep 17, 2021
ae9b210
test: relax a type for truthfulness as strings do also occur
monfera Sep 17, 2021
79fad38
test: removing more scale assertions 03
monfera Sep 17, 2021
16e470a
test: removing all any from scale_band.ts
monfera Sep 17, 2021
276c7cf
test: removing all any from scale_continuous.ts
monfera Sep 17, 2021
2ed8e58
test: removing an any and a union type
monfera Sep 17, 2021
8a4dfe5
fix: removing all coercive equal from our code
monfera Sep 19, 2021
5640e5a
fix: removing all coercive not equal
monfera Sep 19, 2021
5da6339
fix: preventing future coercive equal and unequal
monfera Sep 19, 2021
54cb818
refactor: drive by simplification
monfera Sep 19, 2021
49f799e
refactor: reduce algorithmic complexity somewhat
monfera Sep 19, 2021
97d09aa
refactor: simpler coalescing
monfera Sep 19, 2021
b24c588
refactor: a let removed
monfera Sep 19, 2021
b06bf2d
refactor: mergeYCustomDomainsByGroupId
monfera Sep 19, 2021
16e19b0
refactor: redefine boundedness
monfera Sep 19, 2021
e8e5c20
refactor: mergeYCustomDomainsByGroupId 2
monfera Sep 19, 2021
b6f3839
refactor: mergeYCustomDomainsByGroupId 3
monfera Sep 19, 2021
d419c3c
refactor: topple some typescript jenga
monfera Sep 19, 2021
276a5d9
refactor: remove no longer expressive utils
monfera Sep 19, 2021
bb3053b
refactor: convertXScaleTypes
monfera Sep 19, 2021
a1ca96a
refactor: convertXScaleTypes 2
monfera Sep 19, 2021
4fb6ff1
refactor: removed an overly lightweight util
monfera Sep 19, 2021
9329c70
refactor: simplified the return value for degenerate cases
monfera Sep 19, 2021
5d82166
refactor: convertXScaleTypes 3
monfera Sep 19, 2021
2d1ca1f
refactor: convertXScaleTypes 4 - mandatory tz yield
monfera Sep 19, 2021
82b082b
refactor: remove light and distant abstraction
monfera Sep 19, 2021
c4f4037
fix: no more any in computeContinuousDataDomain
monfera Sep 19, 2021
0ccf5b1
fix: no more explicit and implicit any in computeOrdinalDataDomain
monfera Sep 19, 2021
10a7b38
fix: no more param optionality or zero length if
monfera Sep 19, 2021
d7429fc
test: killing some optionalities
monfera Sep 19, 2021
c6a2aa3
chore: refactor constrainPadding
monfera Sep 19, 2021
fcd45d0
chore: refactor getPaddedDomain
monfera Sep 19, 2021
53f1b9d
chore: refactor getPaddedDomain 2 - special case removal
monfera Sep 19, 2021
e7e288b
chore: warning text cleanup
monfera Sep 19, 2021
0acc6b0
refactor: coerceYScaleTypes 1
monfera Sep 19, 2021
46563c3
refactor: coerceYScaleTypes 2
monfera Sep 19, 2021
69a7d41
refactor: coerceYScaleTypes 3
monfera Sep 19, 2021
209c9f6
refactor: coerceYScaleTypes 4
monfera Sep 19, 2021
9219ceb
refactor: for of idiom in computeYDomain
monfera Sep 19, 2021
1ab9a78
chore: no need for optionality
monfera Sep 19, 2021
d173297
chore: remove planned code change comments
monfera Sep 20, 2021
b80bb22
chore: pick props in type sig and remove X axis originated or obvious…
monfera Sep 20, 2021
7711a63
fix: more any removal
monfera Sep 20, 2021
7563e07
chore: exempt var names centrally ht Nick
monfera Sep 20, 2021
9398aad
chore: no await ht Nick
monfera Sep 20, 2021
ba1a983
chore: undone exemption workaround ht Nick
monfera Sep 20, 2021
3f571d9
Revert "chore: no await ht Nick"
monfera Sep 20, 2021
f5a9e39
Merge remote-tracking branch 'origin/master' into time-axis-06
monfera Sep 20, 2021
2a71e74
refactor: eq neq optimizations 01
monfera Sep 21, 2021
43a2750
refactor: eq neq optimizations 02
monfera Sep 21, 2021
6600695
refactor: eq neq optimizations 03
monfera Sep 21, 2021
c1822f8
refactor: eq neq optimizations 04
monfera Sep 21, 2021
b3a9c7e
chore: no longer async
monfera Sep 21, 2021
2c877eb
chore: no longer async part 2
monfera Sep 21, 2021
e61c7eb
refactor: eq neq optimizations 04 part 2
monfera Sep 21, 2021
cea8e19
chore: remove duplication
monfera Sep 21, 2021
3f44bd6
chore: remove eslint exemption
monfera Sep 21, 2021
854ea38
chore: remove eslint exemption
monfera Sep 21, 2021
0de55eb
test: remove overtyping
monfera Sep 21, 2021
604a1e0
test: remove overtyping update
monfera Sep 21, 2021
820f3fd
refactor: simpler uniqueValues
monfera Sep 21, 2021
908a7f8
refactor: eq neq optimizations 05 - just comments and minor reorg
monfera Sep 21, 2021
9dd03e1
chore: linter wants one line
monfera Sep 21, 2021
7cdd7a9
refactor: eq neq optimizations 06
monfera Sep 21, 2021
78342e3
refactor: eq neq optimizations 07
monfera Sep 21, 2021
6f8bf4c
refactor: eq neq optimizations 08
monfera Sep 21, 2021
23513e2
refactor: eq neq optimizations 09
monfera Sep 21, 2021
2a69ec5
fix: simplification regression
monfera Sep 21, 2021
e532321
test: yield false and simplify type
monfera Sep 21, 2021
8a90a96
chore: remove unused try/catch
nickofthyme Sep 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ module.exports = {
/*
* Standard rules
*/
'@typescript-eslint/object-curly-spacing': 0,
'no-restricted-syntax': 0, // this is a good rule, for-of is good
'no-console': process.env.NODE_ENV === 'production' ? 2 : 1,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 1,
Expand Down
2 changes: 1 addition & 1 deletion integration/page_objects/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class CommonPage {

expect(element).toMatchImageSnapshot();
} catch (error) {
throw new Error(error);
throw new Error(String(error));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have yet to find a good way to cast the errors in catch blocks. I have started doing...

} catch (e) {
  const error = e as Error;
  console.log(e);
}

but besides that, This catch is not even needed, nothing changes so I'd say we handle the error differently here or get rid of the try/catch altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad to get rid of the try/catch, haven't analyzed its purpose. As we discussed I'd like to get rid of try/catch in the use of scales too, started that work but shelved at the time, it's best to avoid try/catch use in normal chartmaking code as usually there's a better option

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at it and don't have the courage to tamper with it in this PR, I think @nickofthyme you'd have better intuition about what to do with it

}

Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@elastic/eui": "^37.7.0",
"@mdx-js/loader": "^1.6.6",
"@microsoft/api-documenter": "^7.12.7",
"@microsoft/api-extractor": "^7.13.1",
"@microsoft/api-extractor": "^7.18.9",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/commit-analyzer": "^8.0.1",
"@semantic-release/exec": "^5.0.0",
Expand Down Expand Up @@ -104,8 +104,8 @@
"@types/seedrandom": "^2.4.28",
"@types/url-parse": "^1.4.3",
"@types/uuid": "^3.4.4",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"autoprefixer": "^9.0.0",
"backport": "^5.6.6",
"canvas": "^2.8.0",
Expand All @@ -115,7 +115,8 @@
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"eslint": "^7.17.0",
"eslint-config-airbnb-typescript": "^12.0.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-airbnb-typescript": "^14.0.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-elastic-charts": "link:./packages/eslint-plugin-elastic-charts",
"eslint-plugin-eslint-comments": "^3.2.0",
Expand Down Expand Up @@ -169,7 +170,7 @@
"speed-measure-webpack-plugin": "^1.5.0",
"ts-jest": "^26.5.5",
"ts-prune": "^0.8.4",
"typescript": "^4.1.3",
"typescript": "^4.4.3",
"webpack": "^4.46.0",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.1.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/charts/api/charts.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1111,9 +1111,9 @@ export type HistogramModeAlignment = 'start' | 'center' | 'end';

// @public (undocumented)
export const HistogramModeAlignments: Readonly<{
Start: LineAlignSetting;
Center: LineAlignSetting;
End: LineAlignSetting;
Start: HistogramModeAlignment;
Center: HistogramModeAlignment;
End: HistogramModeAlignment;
}>;

// @public (undocumented)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
* Side Public License, v 1.
*/

import { Scale } from '../../../../scales';
import { createCustomCachedSelector } from '../../../../state/create_selector';
import { getChartThemeSelector } from '../../../../state/selectors/get_chart_theme';
import { getSettingsSpecSelector } from '../../../../state/selectors/get_settings_specs';
import { AnnotationId, AxisId, GroupId } from '../../../../utils/ids';
import { AnnotationId, AxisId } from '../../../../utils/ids';
import { AnnotationDimensions } from '../../annotations/types';
import { computeAnnotationDimensions } from '../../annotations/utils';
import { computeSeriesGeometriesSelector } from './compute_series_geometries';
Expand Down Expand Up @@ -45,7 +44,7 @@ export const computeAnnotationDimensionsSelector = createCustomCachedSelector(
return computeAnnotationDimensions(
annotationSpecs,
settingsSpec.rotation,
yScales as Map<GroupId, Scale<number>>,
yScales,
xScale,
axesSpecs,
isHistogramMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,5 @@ export function getScale(
padding: RelativeBandsPadding = DEFAULT_SM_PANEL_PADDING,
) {
const singlePanelSmallMultiple = domain.length <= 1;
return new ScaleBand(
domain.length > 0 ? domain : [(undefined as unknown) as number],
[0, maxRange],
undefined,
singlePanelSmallMultiple ? 0 : padding,
);
return new ScaleBand(domain, [0, maxRange], undefined, singlePanelSmallMultiple ? 0 : padding);
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function getYBrushExtents(
chartDimensions: Dimensions,
lastDrag: DragState,
rotation: Rotation,
yScales: Map<GroupId, Scale<number | string>>,
yScales: Map<GroupId, Scale<number>>,
smallMultipleScales: SmallMultipleScales,
minBrushDelta?: number,
): GroupBrushExtent[] | undefined {
Expand All @@ -212,8 +212,8 @@ function getYBrushExtents(

const minPosScaled = yScale.invert(minPos);
const maxPosScaled = yScale.invert(maxPos);
const minValue = clamp(minPosScaled, (yScale as Scale<number>).domain[0], maxPosScaled);
const maxValue = clamp(minPosScaled, maxPosScaled, (yScale as Scale<number>).domain[1]);
const minValue = clamp(minPosScaled, yScale.domain[0], maxPosScaled);
const maxValue = clamp(minPosScaled, maxPosScaled, yScale.domain[1]);
yValues.push({ extent: [minValue, maxValue], groupId });
});
return yValues.length === 0 ? undefined : yValues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface GeometriesCounts {
/** @internal */
export interface ComputedScales {
xScale: Scale<number | string>;
yScales: Map<GroupId, Scale<number | string>>;
yScales: Map<GroupId, Scale<number>>;
}

/** @internal */
Expand Down
10 changes: 5 additions & 5 deletions packages/charts/src/chart_types/xy_chart/state/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export function computeXScaleOffset(
function renderGeometries(
dataSeries: DataSeries[],
xDomain: XDomain,
yScales: Map<GroupId, Scale<number | string>>,
yScales: Map<GroupId, Scale<number>>,
smVScale: Scale<number | string>,
smHScale: Scale<number | string>,
barIndexOrderPerPanel: Record<string, string[]>,
Expand Down Expand Up @@ -379,7 +379,7 @@ function renderGeometries(
shift,
ds,
xScale,
yScale as Scale<number>,
yScale,
panel,
chartRotation,
spec.minBarHeight ?? 0,
Expand All @@ -405,7 +405,7 @@ function renderGeometries(
(xScale.bandwidth * bubbleShift) / 2,
ds,
xScale,
yScale as Scale<number>,
yScale,
color,
panel,
isBandedSpec(spec.y0Accessors),
Expand Down Expand Up @@ -438,7 +438,7 @@ function renderGeometries(
(xScale.bandwidth * lineShift) / 2,
ds,
xScale,
yScale as Scale<number>,
yScale,
panel,
color,
spec.curve || CurveType.LINEAR,
Expand Down Expand Up @@ -471,7 +471,7 @@ function renderGeometries(
(xScale.bandwidth * areaShift) / 2,
ds,
xScale,
yScale as Scale<number>,
yScale,
panel,
color,
spec.curve || CurveType.LINEAR,
Expand Down
27 changes: 12 additions & 15 deletions packages/charts/src/chart_types/xy_chart/utils/axis_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ function axisMinMax(axisPosition: Position, chartRotation: Rotation, { width, he
/** @internal */
export function getAvailableTicks(
axisSpec: AxisSpec,
scale: Scale<number>,
scale: Scale<number | string>,
totalBarsInCluster: number,
enableHistogramMode: boolean,
fallBackTickFormatter: TickFormatter,
Expand All @@ -263,18 +263,15 @@ export function getAvailableTicks(
const isSingleValueScale = scale.domain[0] === scale.domain[1];
const hasAdditionalTicks = enableHistogramMode && scale.bandwidth > 0;

if (hasAdditionalTicks) {
const lastComputedTick = ticks[ticks.length - 1];
if (hasAdditionalTicks && !isSingleValueScale) {
// todo sure hope something ascertains this, otherwise we can't subtract in runtime:
const numericalTicks = ticks as number[];
const lastComputedTick = numericalTicks[numericalTicks.length - 1];
const penultimateComputedTick = numericalTicks[numericalTicks.length - 2];
const computedTickDistance = lastComputedTick - penultimateComputedTick;
const numTicks = scale.minInterval / computedTickDistance;

if (!isSingleValueScale) {
const penultimateComputedTick = ticks[ticks.length - 2];
const computedTickDistance = lastComputedTick - penultimateComputedTick;
const numTicks = scale.minInterval / computedTickDistance;

for (let i = 1; i <= numTicks; i++) {
ticks.push(i * computedTickDistance + lastComputedTick);
}
}
for (let i = 1; i <= numTicks; i++) ticks.push(i * computedTickDistance + lastComputedTick);
}
const shift = totalBarsInCluster > 0 ? totalBarsInCluster : 1;
const band = scale.bandwidth / (1 - scale.barsPadding);
Expand All @@ -285,15 +282,15 @@ export function getAvailableTicks(
const labelFormatter = axisSpec.labelFormat ?? tickFormatter;

if (isSingleValueScale && hasAdditionalTicks) {
const [firstTickValue] = ticks;
// todo sure hope something ascertains this, otherwise we can't add in runtime:
const [firstTickValue] = ticks as number[];
const firstLabel = tickFormatter(firstTickValue, tickFormatOptions);
const firstTick = {
value: firstTickValue,
label: firstLabel,
axisTickLabel: labelFormatter(firstTickValue, tickFormatOptions),
position: (scale.scale(firstTickValue) ?? 0) + offset,
};

const lastTickValue = firstTickValue + scale.minInterval;
const lastLabel = tickFormatter(lastTickValue, tickFormatOptions);
const lastTick = {
Expand All @@ -311,7 +308,7 @@ export function getAvailableTicks(
/** @internal */
export function enableDuplicatedTicks(
axisSpec: AxisSpec,
scale: Scale<number>,
scale: Scale<number | string>,
offset: number,
fallBackTickFormatter: TickFormatter,
tickFormatOptions?: TickFormatterOptions,
Expand Down
11 changes: 3 additions & 8 deletions packages/charts/src/chart_types/xy_chart/utils/scales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ interface YScaleOptions {
* Compute the y scales, one per groupId for the y axis.
* @internal
*/
export function computeYScales(options: YScaleOptions): Map<GroupId, Scale<number | string>> {
export function computeYScales(options: YScaleOptions): Map<GroupId, Scale<number>> {
const { yDomains, range, integersOnly } = options;
return yDomains.reduce(
(
Expand All @@ -128,12 +128,7 @@ export function computeYScales(options: YScaleOptions): Map<GroupId, Scale<numbe
},
) => {
const yScale = new ScaleContinuous(
{
type,
domain,
range,
nice,
},
{ type, domain, range, nice },
{
desiredTickCount,
integersOnly,
Expand All @@ -146,6 +141,6 @@ export function computeYScales(options: YScaleOptions): Map<GroupId, Scale<numbe
yScales.set(groupId, yScale);
return yScales;
},
new Map<GroupId, Scale<number | string>>(),
new Map<GroupId, Scale<number>>(),
);
}
3 changes: 2 additions & 1 deletion packages/charts/src/components/chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ interface ChartState {
const getMiddlware = (id: string): StoreEnhancer => {
const middlware: Middleware<any, any, any>[] = [];

// eslint-disable-next-line no-underscore-dangle
if (typeof window !== 'undefined' && (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,no-underscore-dangle
return (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
trace: true,
name: `@elastic/charts (id: ${id})`,
Expand Down
30 changes: 10 additions & 20 deletions packages/charts/src/components/portal/tooltip_portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
*/

import { createPopper, Instance } from '@popperjs/core';
import { useRef, useEffect, useCallback, ReactNode, useMemo } from 'react';
import { ReactNode, useCallback, useEffect, useMemo, useRef } from 'react';
import { createPortal } from 'react-dom';

import { mergePartial, isDefined } from '../../utils/common';
import { isDefined, mergePartial } from '../../utils/common';
import { Padding } from '../../utils/dimensions';
import { TooltipPortalSettings, PortalAnchorRef } from './types';
import { PortalAnchorRef, TooltipPortalSettings } from './types';
import { DEFAULT_POPPER_SETTINGS, getOrCreateNode, isHTMLElement } from './utils';

/**
Expand Down Expand Up @@ -94,16 +94,12 @@ const TooltipPortalComponent = ({
* Popper instance used to manage position of tooltip.
*/
const popper = useRef<Instance | null>(null);

const popperSettings = useMemo(
() => mergePartial(DEFAULT_POPPER_SETTINGS, settings, { mergeOptionalPartialValues: true }),

[settings],
);

const base = DEFAULT_POPPER_SETTINGS;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const ps = useMemo(() => mergePartial(base, settings, { mergeOptionalPartialValues: true }), [settings, base]);
const anchorPosition = (anchor as PortalAnchorRef)?.position;
const position = useMemo(() => (isHTMLElement(anchor) ? null : anchorPosition), [anchor, anchorPosition]);

const destroyPopper = useCallback(() => {
if (popper.current) {
popper.current.destroy();
Expand All @@ -116,7 +112,7 @@ const TooltipPortalComponent = ({
return;
}

const { fallbackPlacements, placement, boundary, offset, boundaryPadding } = popperSettings;
const { fallbackPlacements, placement, boundary, offset, boundaryPadding } = ps;
popper.current = createPopper(anchorNode.current, portalNode.current, {
strategy: 'absolute',
placement,
Expand Down Expand Up @@ -148,13 +144,7 @@ const TooltipPortalComponent = ({
],
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
visible,
popperSettings.fallbackPlacements,
popperSettings.placement,
popperSettings.boundary,
popperSettings.offset,
]);
}, [visible, ps.fallbackPlacements, ps.placement, ps.boundary, ps.offset]);

useEffect(() => {
setPopper();
Expand All @@ -173,7 +163,7 @@ const TooltipPortalComponent = ({
useEffect(() => {
destroyPopper();
setPopper();
}, [destroyPopper, setPopper, popperSettings]);
}, [destroyPopper, setPopper, ps]);

useEffect(() => {
if (!visible) {
Expand Down
2 changes: 2 additions & 0 deletions packages/charts/src/mocks/specs/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ export class MockGlobalSpec {
};

static settings(partial?: Partial<SettingsSpec>): SettingsSpec {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return mergePartial<SettingsSpec>(MockGlobalSpec.settingsBase, partial, { mergeOptionalPartialValues: true });
}

Expand Down
5 changes: 3 additions & 2 deletions packages/charts/src/scales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ export interface Scale<T> {
step: number;
ticks: () => T[];
scale: (value?: PrimitiveValue) => number | null;
scaleOrThrow(value?: PrimitiveValue): number;
pureScale: (value?: PrimitiveValue) => number | null;
invert: (value: number) => any;
invert: (value: number) => T;
invertWithStep: (
value: number,
data: any[],
Expand All @@ -61,6 +60,8 @@ export interface Scale<T> {
unit?: string;
isInverted: boolean;
barsPadding: number;

scaleOrThrow(value?: PrimitiveValue): number;
}

/** @internal */
Expand Down
Loading