@gravity-ui/charts 1.33.0 → 1.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/ChartInner/index.js +5 -2
- package/dist/cjs/components/ChartInner/useChartInnerProps.js +4 -2
- package/dist/cjs/components/RangeSlider/index.js +1 -0
- package/dist/cjs/components/Tooltip/DefaultTooltipContent/index.js +5 -1
- package/dist/cjs/hooks/index.d.ts +1 -0
- package/dist/cjs/hooks/index.js +1 -0
- package/dist/cjs/hooks/useAxis/index.d.ts +5 -3
- package/dist/cjs/hooks/useAxis/index.js +3 -3
- package/dist/cjs/hooks/useAxis/types.d.ts +6 -0
- package/dist/cjs/hooks/useAxis/y-axis.d.ts +10 -0
- package/dist/cjs/hooks/useAxis/y-axis.js +30 -21
- package/dist/cjs/hooks/useAxisScales/index.d.ts +2 -16
- package/dist/cjs/hooks/useAxisScales/index.js +17 -475
- package/dist/cjs/hooks/useAxisScales/utils.d.ts +10 -13
- package/dist/cjs/hooks/useAxisScales/utils.js +29 -63
- package/dist/cjs/hooks/useAxisScales/x-scale.d.ts +15 -0
- package/dist/cjs/hooks/useAxisScales/x-scale.js +247 -0
- package/dist/cjs/hooks/useAxisScales/y-scale.d.ts +10 -0
- package/dist/cjs/hooks/useAxisScales/y-scale.js +299 -0
- package/dist/cjs/hooks/useBrush/index.js +24 -5
- package/dist/cjs/hooks/useBrush/types.d.ts +1 -0
- package/dist/cjs/hooks/useBrush/utils.d.ts +4 -0
- package/dist/cjs/hooks/useBrush/utils.js +4 -0
- package/dist/cjs/hooks/useShapes/index.d.ts +2 -0
- package/dist/cjs/hooks/useShapes/index.js +9 -2
- package/dist/cjs/hooks/useShapes/utils.d.ts +10 -0
- package/dist/cjs/hooks/useShapes/utils.js +15 -0
- package/dist/cjs/hooks/useYAxisLabelWidth/index.d.ts +11 -0
- package/dist/cjs/hooks/useYAxisLabelWidth/index.js +48 -0
- package/dist/cjs/hooks/utils/bar-x.js +1 -1
- package/dist/cjs/hooks/utils/bar-y.js +1 -1
- package/dist/cjs/types/chart/tooltip.d.ts +3 -2
- package/dist/cjs/utils/chart/axis/common.d.ts +1 -0
- package/dist/cjs/utils/chart/axis/common.js +6 -0
- package/dist/esm/components/ChartInner/index.js +5 -2
- package/dist/esm/components/ChartInner/useChartInnerProps.js +4 -2
- package/dist/esm/components/RangeSlider/index.js +1 -0
- package/dist/esm/components/Tooltip/DefaultTooltipContent/index.js +5 -1
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/useAxis/index.d.ts +5 -3
- package/dist/esm/hooks/useAxis/index.js +3 -3
- package/dist/esm/hooks/useAxis/types.d.ts +6 -0
- package/dist/esm/hooks/useAxis/y-axis.d.ts +10 -0
- package/dist/esm/hooks/useAxis/y-axis.js +30 -21
- package/dist/esm/hooks/useAxisScales/index.d.ts +2 -16
- package/dist/esm/hooks/useAxisScales/index.js +17 -475
- package/dist/esm/hooks/useAxisScales/utils.d.ts +10 -13
- package/dist/esm/hooks/useAxisScales/utils.js +29 -63
- package/dist/esm/hooks/useAxisScales/x-scale.d.ts +15 -0
- package/dist/esm/hooks/useAxisScales/x-scale.js +247 -0
- package/dist/esm/hooks/useAxisScales/y-scale.d.ts +10 -0
- package/dist/esm/hooks/useAxisScales/y-scale.js +299 -0
- package/dist/esm/hooks/useBrush/index.js +24 -5
- package/dist/esm/hooks/useBrush/types.d.ts +1 -0
- package/dist/esm/hooks/useBrush/utils.d.ts +4 -0
- package/dist/esm/hooks/useBrush/utils.js +4 -0
- package/dist/esm/hooks/useShapes/index.d.ts +2 -0
- package/dist/esm/hooks/useShapes/index.js +9 -2
- package/dist/esm/hooks/useShapes/utils.d.ts +10 -0
- package/dist/esm/hooks/useShapes/utils.js +15 -0
- package/dist/esm/hooks/useYAxisLabelWidth/index.d.ts +11 -0
- package/dist/esm/hooks/useYAxisLabelWidth/index.js +48 -0
- package/dist/esm/hooks/utils/bar-x.js +1 -1
- package/dist/esm/hooks/utils/bar-y.js +1 -1
- package/dist/esm/types/chart/tooltip.d.ts +3 -2
- package/dist/esm/utils/chart/axis/common.d.ts +1 -0
- package/dist/esm/utils/chart/axis/common.js +6 -0
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import { getPreparedRangeSlider } from '../../hooks/useAxis/range-slider';
|
|
|
6
6
|
import { getPreparedChart } from '../../hooks/useChartOptions/chart';
|
|
7
7
|
import { getPreparedTitle } from '../../hooks/useChartOptions/title';
|
|
8
8
|
import { getPreparedTooltip } from '../../hooks/useChartOptions/tooltip';
|
|
9
|
+
import { getClipPathIdByBounds } from '../../hooks/useShapes/utils';
|
|
9
10
|
import { EventType, block, getDispatcher, isBandScale } from '../../utils';
|
|
10
11
|
import { AxisX } from '../AxisX/AxisX';
|
|
11
12
|
import { prepareXAxisData } from '../AxisX/prepare-axis-data';
|
|
@@ -214,8 +215,10 @@ export const ChartInner = (props) => {
|
|
|
214
215
|
}, [height, areShapesReady, onReady, width]);
|
|
215
216
|
const chartContent = (React.createElement(React.Fragment, null,
|
|
216
217
|
React.createElement("defs", null,
|
|
217
|
-
React.createElement("clipPath", { id: clipPathId },
|
|
218
|
-
React.createElement("rect", { x: 0, y: 0, width: boundsWidth, height: boundsHeight }))
|
|
218
|
+
React.createElement("clipPath", { id: getClipPathIdByBounds({ clipPathId }) },
|
|
219
|
+
React.createElement("rect", { x: 0, y: 0, width: boundsWidth, height: boundsHeight })),
|
|
220
|
+
React.createElement("clipPath", { id: getClipPathIdByBounds({ clipPathId, bounds: 'horizontal' }) },
|
|
221
|
+
React.createElement("rect", { x: 0, y: -boundsHeight, width: boundsWidth, height: boundsHeight * 3 }))),
|
|
219
222
|
preparedTitle && React.createElement(Title, Object.assign({}, preparedTitle, { chartWidth: width })),
|
|
220
223
|
React.createElement("g", { transform: `translate(0, ${boundsOffsetTop})` }, preparedSplit.plots.map((plot, index) => {
|
|
221
224
|
return React.createElement(PlotTitle, { key: `plot-${index}`, title: plot.title });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DEFAULT_PALETTE, SERIES_TYPE } from '../../constants';
|
|
3
|
-
import { useAxis, useAxisScales, useChartDimensions, useNormalizedOriginalData, usePrevious, useSeries, useShapes, useSplit, useZoom, } from '../../hooks';
|
|
3
|
+
import { useAxis, useAxisScales, useChartDimensions, useNormalizedOriginalData, usePrevious, useSeries, useShapes, useSplit, useYAxisLabelWidth, useZoom, } from '../../hooks';
|
|
4
4
|
import { getYAxisWidth } from '../../hooks/useChartDimensions/utils';
|
|
5
5
|
import { getLegendComponents } from '../../hooks/useSeries/prepare-legend';
|
|
6
6
|
import { getPreparedOptions } from '../../hooks/useSeries/prepare-options';
|
|
@@ -77,7 +77,7 @@ export function useChartInnerProps(props) {
|
|
|
77
77
|
preparedLegend,
|
|
78
78
|
});
|
|
79
79
|
}, [width, height, preparedChart.margin, preparedSeries, preparedLegend]);
|
|
80
|
-
const { xAxis, yAxis } = useAxis({
|
|
80
|
+
const { xAxis, yAxis, setAxes } = useAxis({
|
|
81
81
|
height,
|
|
82
82
|
preparedChart,
|
|
83
83
|
preparedLegend,
|
|
@@ -107,6 +107,7 @@ export function useChartInnerProps(props) {
|
|
|
107
107
|
yAxis,
|
|
108
108
|
zoomState,
|
|
109
109
|
});
|
|
110
|
+
useYAxisLabelWidth({ seriesData: preparedSeries, setAxes, yAxis, yScale });
|
|
110
111
|
const isOutsideBounds = React.useCallback((x, y) => {
|
|
111
112
|
return x < 0 || x > boundsWidth || y < 0 || y > boundsHeight;
|
|
112
113
|
}, [boundsHeight, boundsWidth]);
|
|
@@ -125,6 +126,7 @@ export function useChartInnerProps(props) {
|
|
|
125
126
|
htmlLayout,
|
|
126
127
|
clipPathId,
|
|
127
128
|
isOutsideBounds,
|
|
129
|
+
zoomState,
|
|
128
130
|
});
|
|
129
131
|
const handleAttemptToSetZoomState = React.useCallback((nextZoomState) => {
|
|
130
132
|
const { preparedSeries: nextZoomedSeriesData } = getZoomedSeriesData({
|
|
@@ -23,7 +23,7 @@ export const DefaultTooltipContent = ({ hovered, pinned, rowRenderer, totals, va
|
|
|
23
23
|
const restHoveredValues = pinned || !visibleRows ? [] : hoveredValues.slice(visibleRows);
|
|
24
24
|
const renderRow = ({ id, name, color, active, striped, value, formattedValue, series, }) => {
|
|
25
25
|
if (typeof rowRenderer === 'function') {
|
|
26
|
-
|
|
26
|
+
const result = rowRenderer({
|
|
27
27
|
id,
|
|
28
28
|
name,
|
|
29
29
|
color,
|
|
@@ -34,6 +34,10 @@ export const DefaultTooltipContent = ({ hovered, pinned, rowRenderer, totals, va
|
|
|
34
34
|
className: b('content-row', { active, striped }),
|
|
35
35
|
hovered,
|
|
36
36
|
});
|
|
37
|
+
if (typeof result === 'string') {
|
|
38
|
+
return React.createElement("div", { key: id, dangerouslySetInnerHTML: { __html: result } });
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
37
41
|
}
|
|
38
42
|
const colorSymbol = getTooltipRowColorSymbol({ series, color });
|
|
39
43
|
return (React.createElement(Row, { key: id, active: active, color: color, colorSymbol: colorSymbol ? (React.createElement("div", { dangerouslySetInnerHTML: { __html: colorSymbol.outerHTML } })) : undefined, label: React.createElement("span", { dangerouslySetInnerHTML: { __html: name } }), striped: striped, value: formattedValue }));
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { ChartXAxis, ChartYAxis } from '../../types';
|
|
2
3
|
import type { PreparedChart } from '../useChartOptions/types';
|
|
3
4
|
import type { PreparedLegend, PreparedSeries, PreparedSeriesOptions } from '../useSeries/types';
|
|
4
|
-
import type {
|
|
5
|
+
import type { AxesState } from './types';
|
|
5
6
|
interface UseAxesProps {
|
|
6
7
|
height: number;
|
|
7
8
|
preparedChart: PreparedChart;
|
|
@@ -14,7 +15,8 @@ interface UseAxesProps {
|
|
|
14
15
|
yAxis?: ChartYAxis[];
|
|
15
16
|
}
|
|
16
17
|
export declare function useAxis(props: UseAxesProps): {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
setAxes: React.Dispatch<React.SetStateAction<AxesState>>;
|
|
19
|
+
xAxis: import("./types").PreparedXAxis | null;
|
|
20
|
+
yAxis: import("./types").PreparedYAxis[];
|
|
19
21
|
};
|
|
20
22
|
export {};
|
|
@@ -5,7 +5,7 @@ import { getPreparedXAxis } from './x-axis';
|
|
|
5
5
|
import { getPreparedYAxis } from './y-axis';
|
|
6
6
|
export function useAxis(props) {
|
|
7
7
|
const { boundsHeight, height, preparedChart, preparedLegend, preparedSeries, preparedSeriesOptions, width, xAxis, yAxis, } = props;
|
|
8
|
-
const [axesState,
|
|
8
|
+
const [axesState, setAxes] = React.useState({ xAxis: null, yAxis: [] });
|
|
9
9
|
const axesStateRunRef = React.useRef(0);
|
|
10
10
|
const prevAxesStateValue = React.useRef(axesState);
|
|
11
11
|
const axesStateReady = React.useRef(false);
|
|
@@ -55,7 +55,7 @@ export function useAxis(props) {
|
|
|
55
55
|
const newStateValue = { xAxis: preparedXAxis, yAxis: preparedYAxis };
|
|
56
56
|
if (axesStateRunRef.current === currentRun) {
|
|
57
57
|
if (!isEqual(prevAxesStateValue.current, newStateValue)) {
|
|
58
|
-
|
|
58
|
+
setAxes(newStateValue);
|
|
59
59
|
prevAxesStateValue.current = newStateValue;
|
|
60
60
|
}
|
|
61
61
|
axesStateReady.current = true;
|
|
@@ -72,5 +72,5 @@ export function useAxis(props) {
|
|
|
72
72
|
xAxis,
|
|
73
73
|
yAxis,
|
|
74
74
|
]);
|
|
75
|
-
return axesStateReady.current ? axesState : { xAxis: null, yAxis: [] };
|
|
75
|
+
return axesStateReady.current ? Object.assign(Object.assign({}, axesState), { setAxes }) : { xAxis: null, yAxis: [], setAxes };
|
|
76
76
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type React from 'react';
|
|
1
2
|
import type { DashStyle } from '../../constants';
|
|
2
3
|
import type { AxisCrosshair, AxisPlotBand, BaseTextStyle, ChartAxis, ChartAxisLabels, ChartAxisRangeSlider, ChartAxisTitleAlignment, ChartAxisType, DeepRequired, PlotLayerPlacement } from '../../types';
|
|
3
4
|
type PreparedAxisLabels = Omit<ChartAxisLabels, 'enabled' | 'padding' | 'style' | 'autoRotation'> & Required<Pick<ChartAxisLabels, 'enabled' | 'padding' | 'margin' | 'rotation' | 'html'>> & {
|
|
@@ -68,4 +69,9 @@ export type PreparedXAxis = PreparedBaseAxis & {
|
|
|
68
69
|
};
|
|
69
70
|
export type PreparedYAxis = PreparedBaseAxis;
|
|
70
71
|
export type PreparedAxis = PreparedXAxis | PreparedYAxis;
|
|
72
|
+
export type AxesState = {
|
|
73
|
+
xAxis: PreparedXAxis | null;
|
|
74
|
+
yAxis: PreparedYAxis[];
|
|
75
|
+
};
|
|
76
|
+
export type SetAxes = React.Dispatch<React.SetStateAction<AxesState>>;
|
|
71
77
|
export {};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { ChartSeries, ChartYAxis } from '../../types';
|
|
2
|
+
import type { ChartScale } from '../useAxisScales/types';
|
|
3
|
+
import type { PreparedSeries } from '../useSeries/types';
|
|
2
4
|
import type { PreparedYAxis } from './types';
|
|
5
|
+
export declare const getYAxisLabelMaxWidth: (args: {
|
|
6
|
+
axis: PreparedYAxis;
|
|
7
|
+
seriesData: PreparedSeries[] | ChartSeries[];
|
|
8
|
+
scale?: ChartScale;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
height: number;
|
|
11
|
+
width: number;
|
|
12
|
+
}>;
|
|
3
13
|
export declare const getPreparedYAxis: ({ height, boundsHeight, width, seriesData, yAxis, }: {
|
|
4
14
|
height: number;
|
|
5
15
|
boundsHeight: number;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import { getTickValues } from '../../components/AxisY/utils';
|
|
3
3
|
import { DASH_STYLE, DEFAULT_AXIS_LABEL_FONT_SIZE, DEFAULT_AXIS_TYPE, SERIES_TYPE, axisCrosshairDefaults, axisLabelsDefaults, yAxisTitleDefaults, } from '../../constants';
|
|
4
|
-
import { calculateNumericProperty, formatAxisTickLabel, getDefaultDateFormat, getDefaultMinYAxisValue, getHorizontalHtmlTextHeight, getHorizontalSvgTextHeight, getLabelsSize, getMinSpaceBetween, getTextSizeFn, isAxisRelatedSeries, wrapText, } from '../../utils';
|
|
4
|
+
import { calculateNumericProperty, formatAxisTickLabel, getDefaultDateFormat, getDefaultMinYAxisValue, getHorizontalHtmlTextHeight, getHorizontalSvgTextHeight, getLabelsSize, getMinSpaceBetween, getTextSizeFn, isAxisRelatedSeries, shouldSyncAxisWithPrimary, wrapText, } from '../../utils';
|
|
5
5
|
import { createYScale } from '../useAxisScales';
|
|
6
6
|
import { prepareAxisPlotLabel } from './utils';
|
|
7
|
-
const
|
|
8
|
-
const { axis,
|
|
9
|
-
if (!axis.labels.enabled) {
|
|
10
|
-
return { height: 0, width: 0 };
|
|
11
|
-
}
|
|
12
|
-
const scale = createYScale({
|
|
13
|
-
axis,
|
|
14
|
-
boundsHeight: height,
|
|
15
|
-
series: seriesData,
|
|
16
|
-
});
|
|
17
|
-
if (!scale) {
|
|
7
|
+
export const getYAxisLabelMaxWidth = async (args) => {
|
|
8
|
+
const { axis, scale, seriesData } = args;
|
|
9
|
+
if (!axis.labels.enabled || !scale) {
|
|
18
10
|
return { height: 0, width: 0 };
|
|
19
11
|
}
|
|
20
12
|
const getTextSize = getTextSizeFn({ style: axis.labels.style });
|
|
@@ -104,6 +96,21 @@ export const getPreparedYAxis = ({ height, boundsHeight, width, seriesData, yAxi
|
|
|
104
96
|
const axisType = get(axisItem, 'type', DEFAULT_AXIS_TYPE);
|
|
105
97
|
const shouldHideGrid = axisItem.visible === false ||
|
|
106
98
|
axisSeriesData.some((s) => s.type === SERIES_TYPE.Heatmap);
|
|
99
|
+
let gridEnabled;
|
|
100
|
+
if (shouldHideGrid) {
|
|
101
|
+
gridEnabled = false;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
const gridEnabledProp = get(axisItem, 'grid.enabled');
|
|
105
|
+
if (firstPlotAxis) {
|
|
106
|
+
gridEnabled = gridEnabledProp !== null && gridEnabledProp !== void 0 ? gridEnabledProp : true;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
gridEnabled = shouldSyncAxisWithPrimary(axisItem, axisByPlot[plotIndex][0])
|
|
110
|
+
? false
|
|
111
|
+
: !((_g = axisByPlot[plotIndex][0].visible) !== null && _g !== void 0 ? _g : true);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
107
114
|
const preparedAxis = {
|
|
108
115
|
type: axisType,
|
|
109
116
|
labels: {
|
|
@@ -119,7 +126,7 @@ export const getPreparedYAxis = ({ height, boundsHeight, width, seriesData, yAxi
|
|
|
119
126
|
width: 0,
|
|
120
127
|
height: 0,
|
|
121
128
|
lineHeight: labelsLineHeight,
|
|
122
|
-
maxWidth: (
|
|
129
|
+
maxWidth: (_j = calculateNumericProperty({ base: width, value: (_h = axisItem.labels) === null || _h === void 0 ? void 0 : _h.maxWidth })) !== null && _j !== void 0 ? _j : axisLabelsDefaults.maxWidth,
|
|
123
130
|
html: labelsHtml,
|
|
124
131
|
},
|
|
125
132
|
lineColor: get(axisItem, 'lineColor'),
|
|
@@ -133,20 +140,17 @@ export const getPreparedYAxis = ({ height, boundsHeight, width, seriesData, yAxi
|
|
|
133
140
|
height: titleSize.maxHeight * estimatedTitleRows.length,
|
|
134
141
|
align: get(axisItem, 'title.align', yAxisTitleDefaults.align),
|
|
135
142
|
maxRowCount: titleMaxRowsCount,
|
|
136
|
-
html: (
|
|
143
|
+
html: (_l = (_k = axisItem.title) === null || _k === void 0 ? void 0 : _k.html) !== null && _l !== void 0 ? _l : false,
|
|
137
144
|
maxWidth: titleMaxWidth !== null && titleMaxWidth !== void 0 ? titleMaxWidth : Infinity,
|
|
138
145
|
rotation: titleRotation,
|
|
139
146
|
},
|
|
140
|
-
min: (
|
|
147
|
+
min: (_m = get(axisItem, 'min')) !== null && _m !== void 0 ? _m : getDefaultMinYAxisValue(axisSeriesData),
|
|
141
148
|
max: get(axisItem, 'max'),
|
|
142
149
|
startOnTick: get(axisItem, 'startOnTick'),
|
|
143
150
|
endOnTick: get(axisItem, 'endOnTick'),
|
|
144
151
|
maxPadding: get(axisItem, 'maxPadding', getMaxPaddingBySeries({ series: axisSeriesData })),
|
|
145
152
|
grid: {
|
|
146
|
-
enabled:
|
|
147
|
-
? false
|
|
148
|
-
: get(axisItem, 'grid.enabled', firstPlotAxis ||
|
|
149
|
-
(!firstPlotAxis && !((_m = axisByPlot[plotIndex][0].visible) !== null && _m !== void 0 ? _m : true))),
|
|
153
|
+
enabled: gridEnabled,
|
|
150
154
|
},
|
|
151
155
|
ticks: {
|
|
152
156
|
pixelInterval: ((_o = axisItem.ticks) === null || _o === void 0 ? void 0 : _o.interval)
|
|
@@ -188,10 +192,15 @@ export const getPreparedYAxis = ({ height, boundsHeight, width, seriesData, yAxi
|
|
|
188
192
|
order: axisItem.order,
|
|
189
193
|
};
|
|
190
194
|
if (labelsEnabled) {
|
|
191
|
-
const
|
|
195
|
+
const scale = createYScale({
|
|
196
|
+
axis: preparedAxis,
|
|
197
|
+
boundsHeight,
|
|
198
|
+
series: axisSeriesData,
|
|
199
|
+
});
|
|
200
|
+
const { height: labelsHeight, width: labelsWidth } = await getYAxisLabelMaxWidth({
|
|
192
201
|
axis: preparedAxis,
|
|
193
202
|
seriesData: axisSeriesData,
|
|
194
|
-
|
|
203
|
+
scale,
|
|
195
204
|
});
|
|
196
205
|
preparedAxis.labels.height = labelsHeight;
|
|
197
206
|
preparedAxis.labels.width = Math.min(preparedAxis.labels.maxWidth, labelsWidth);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PreparedAxis, PreparedSeries, PreparedSplit, RangeSliderState, ZoomState } from '../../hooks';
|
|
2
|
-
import type { ChartAxis, ChartSeries } from '../../types';
|
|
3
2
|
import type { ChartScale } from './types';
|
|
3
|
+
export { createXScale } from './x-scale';
|
|
4
|
+
export { createYScale } from './y-scale';
|
|
4
5
|
type Args = {
|
|
5
6
|
boundsWidth: number;
|
|
6
7
|
boundsHeight: number;
|
|
@@ -16,22 +17,7 @@ type ReturnValue = {
|
|
|
16
17
|
xScale?: ChartScale;
|
|
17
18
|
yScale?: (ChartScale | undefined)[];
|
|
18
19
|
};
|
|
19
|
-
export declare function createYScale(args: {
|
|
20
|
-
axis: PreparedAxis;
|
|
21
|
-
boundsHeight: number;
|
|
22
|
-
series: PreparedSeries[] | ChartSeries[];
|
|
23
|
-
primaryTickPositions?: number[];
|
|
24
|
-
zoomStateY?: [number, number];
|
|
25
|
-
}): import("d3-scale").ScaleBand<string> | import("d3-scale").ScaleLinear<number, number, never> | import("d3-scale").ScaleTime<number, number, never> | undefined;
|
|
26
|
-
export declare function createXScale(args: {
|
|
27
|
-
axis: PreparedAxis | ChartAxis;
|
|
28
|
-
boundsWidth: number;
|
|
29
|
-
series: (PreparedSeries | ChartSeries)[];
|
|
30
|
-
rangeSliderState?: RangeSliderState;
|
|
31
|
-
zoomStateX?: [number, number];
|
|
32
|
-
}): import("d3-scale").ScaleBand<string> | import("d3-scale").ScaleLinear<number, number, never> | import("d3-scale").ScaleTime<number, number, never> | undefined;
|
|
33
20
|
/**
|
|
34
21
|
* Uses to create scales for axis related series
|
|
35
22
|
*/
|
|
36
23
|
export declare const useAxisScales: (args: Args) => ReturnValue;
|
|
37
|
-
export {};
|