@alfalab/core-components-chart 3.1.12 → 3.2.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/Component.d.ts +2 -1
- package/Component.js +1 -1
- package/components/Dot/index.css +8 -8
- package/components/Dot/index.js +1 -1
- package/components/Legends/index.css +8 -8
- package/components/Legends/index.js +1 -1
- package/components/Tick/index.css +4 -4
- package/components/Tick/index.d.ts +2 -1
- package/components/Tick/index.js +1 -1
- package/components/TooltipContent/index.css +7 -7
- package/components/TooltipContent/index.d.ts +2 -1
- package/components/TooltipContent/index.js +1 -1
- package/cssm/Component.d.ts +2 -1
- package/cssm/components/Tick/index.d.ts +2 -1
- package/cssm/components/TooltipContent/index.d.ts +2 -1
- package/cssm/icons/Circle.d.ts +2 -1
- package/cssm/icons/FilledCircle.d.ts +2 -1
- package/cssm/icons/Point.d.ts +2 -1
- package/cssm/icons/StrokeCircle.d.ts +2 -1
- package/esm/Component.d.ts +2 -1
- package/esm/Component.js +1 -1
- package/esm/components/Dot/index.css +8 -8
- package/esm/components/Dot/index.js +1 -1
- package/esm/components/Legends/index.css +8 -8
- package/esm/components/Legends/index.js +1 -1
- package/esm/components/Tick/index.css +4 -4
- package/esm/components/Tick/index.d.ts +2 -1
- package/esm/components/Tick/index.js +1 -1
- package/esm/components/TooltipContent/index.css +7 -7
- package/esm/components/TooltipContent/index.d.ts +2 -1
- package/esm/components/TooltipContent/index.js +1 -1
- package/esm/icons/Circle.d.ts +2 -1
- package/esm/icons/FilledCircle.d.ts +2 -1
- package/esm/icons/Point.d.ts +2 -1
- package/esm/icons/StrokeCircle.d.ts +2 -1
- package/esm/index.css +5 -5
- package/icons/Circle.d.ts +2 -1
- package/icons/FilledCircle.d.ts +2 -1
- package/icons/Point.d.ts +2 -1
- package/icons/StrokeCircle.d.ts +2 -1
- package/index.css +5 -5
- package/modern/Component.d.ts +2 -1
- package/modern/Component.js +1 -1
- package/modern/components/Dot/index.css +8 -8
- package/modern/components/Dot/index.js +1 -1
- package/modern/components/Legends/index.css +8 -8
- package/modern/components/Legends/index.js +1 -1
- package/modern/components/Tick/index.css +4 -4
- package/modern/components/Tick/index.d.ts +2 -1
- package/modern/components/Tick/index.js +1 -1
- package/modern/components/TooltipContent/index.css +7 -7
- package/modern/components/TooltipContent/index.d.ts +2 -1
- package/modern/components/TooltipContent/index.js +1 -1
- package/modern/icons/Circle.d.ts +2 -1
- package/modern/icons/FilledCircle.d.ts +2 -1
- package/modern/icons/Point.d.ts +2 -1
- package/modern/icons/StrokeCircle.d.ts +2 -1
- package/modern/index.css +5 -5
- package/package.json +2 -2
- package/src/Component.tsx +404 -0
- package/src/components/CustomizedLabel.tsx +29 -0
- package/src/components/Dot/index.module.css +22 -0
- package/src/components/Dot/index.tsx +79 -0
- package/src/components/Legends/index.module.css +36 -0
- package/src/components/Legends/index.tsx +85 -0
- package/src/components/LinearGradient.tsx +16 -0
- package/src/components/RectBar.tsx +50 -0
- package/src/components/Tick/index.module.css +16 -0
- package/src/components/Tick/index.tsx +32 -0
- package/src/components/TooltipContent/index.module.css +51 -0
- package/src/components/TooltipContent/index.tsx +83 -0
- package/src/hoc/Customized.jsx +7 -0
- package/src/hooks/usePathBar/index.tsx +56 -0
- package/src/hooks/usePathBar/utils/getRadius.ts +5 -0
- package/src/hooks/useSettings/index.tsx +66 -0
- package/src/hooks/useSettings/utils/setComposedChartsMargin.ts +29 -0
- package/src/hooks/useSettings/utils/setDatas.ts +53 -0
- package/src/hooks/useSettings/utils/setGradientCharts.ts +43 -0
- package/src/hooks/useSettings/utils/setLegendMargin.ts +16 -0
- package/src/hooks/useSettings/utils/sortByIndex.ts +10 -0
- package/src/icons/Circle.tsx +12 -0
- package/src/icons/CircleLine.tsx +13 -0
- package/src/icons/FilledCircle.tsx +25 -0
- package/src/icons/Point.tsx +13 -0
- package/src/icons/StrokeCircle.tsx +12 -0
- package/src/index.module.css +21 -0
- package/src/index.ts +2 -0
- package/src/types/brush.types.ts +50 -0
- package/src/types/cartesianGrid.types.ts +26 -0
- package/src/types/chart.types.ts +81 -0
- package/src/types/composedChart.types.ts +36 -0
- package/src/types/index.ts +14 -0
- package/src/types/labelList.types.ts +5 -0
- package/src/types/legend.types.ts +35 -0
- package/src/types/options.types.ts +69 -0
- package/src/types/payload.types.ts +33 -0
- package/src/types/responsiveContainer.types.ts +9 -0
- package/src/types/seria.types.ts +86 -0
- package/src/types/tooltip.types.ts +85 -0
- package/src/types/utils/axis.types.ts +88 -0
- package/src/types/utils/coordinates.types.ts +11 -0
- package/src/types/utils/data.types.ts +19 -0
- package/src/types/utils/dot.types.ts +88 -0
- package/src/types/utils/gradient.types.ts +33 -0
- package/src/types/utils/index.ts +6 -0
- package/src/types/utils/tick.types.ts +38 -0
- package/src/types/xAxis.types.ts +18 -0
- package/src/types/yAxis.types.ts +8 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { ReactText } from 'react';
|
|
3
|
+
import { DataKey } from 'recharts/types/util/types';
|
|
4
|
+
|
|
5
|
+
export interface BrushProps {
|
|
6
|
+
/**
|
|
7
|
+
* Ключ данных
|
|
8
|
+
*/
|
|
9
|
+
dataKey?: DataKey<string>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Ширина ползунков
|
|
13
|
+
*/
|
|
14
|
+
travallerWidth?: number;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Начальный индекс интервала показа
|
|
18
|
+
*/
|
|
19
|
+
startIndex?: number;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Конечный индекс интервала показа
|
|
23
|
+
*/
|
|
24
|
+
endIndex?: number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Отступ
|
|
28
|
+
*/
|
|
29
|
+
brushMargin?: number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Высота
|
|
33
|
+
*/
|
|
34
|
+
height: number;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Форматирование значений
|
|
38
|
+
*/
|
|
39
|
+
tickFormatter?: (value: any, index: number) => ReactText;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Всегда показывать значение текущего интервала
|
|
43
|
+
*/
|
|
44
|
+
alwaysShowText?: boolean;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Цвет
|
|
48
|
+
*/
|
|
49
|
+
stroke?: string;
|
|
50
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface CartesianGridProps {
|
|
2
|
+
/**
|
|
3
|
+
* Отображение горизонтальной сетки
|
|
4
|
+
*/
|
|
5
|
+
horizontal?: boolean;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Отображение вертикальной сетки
|
|
9
|
+
*/
|
|
10
|
+
vertical?: boolean;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Штрихи для осей
|
|
14
|
+
*/
|
|
15
|
+
strokeDasharray?: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Цвет разметки сетки
|
|
19
|
+
*/
|
|
20
|
+
stroke?: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Цвет заливки графика
|
|
24
|
+
*/
|
|
25
|
+
fill?: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { RectangleProps } from 'recharts';
|
|
4
|
+
import { DataKey } from 'recharts/types/util/types';
|
|
5
|
+
|
|
6
|
+
import { DataProps } from './utils/data.types';
|
|
7
|
+
import { DotSettingProps } from './utils/dot.types';
|
|
8
|
+
|
|
9
|
+
type CurveType = 'linear' | 'monotone' | 'step';
|
|
10
|
+
|
|
11
|
+
export type RectangleShapeType =
|
|
12
|
+
| ReactElement<SVGElement>
|
|
13
|
+
| ((props: any) => ReactElement<SVGElement>)
|
|
14
|
+
| RectangleProps
|
|
15
|
+
| boolean;
|
|
16
|
+
|
|
17
|
+
export interface ChartProps {
|
|
18
|
+
/**
|
|
19
|
+
* Название графика (отображается в легендах и тултипе)
|
|
20
|
+
*/
|
|
21
|
+
name?: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Ключ данных
|
|
25
|
+
*/
|
|
26
|
+
dataKey: DataKey<number | string>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Цвет заливки графика
|
|
30
|
+
*/
|
|
31
|
+
fill?: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Цвет линии графика
|
|
35
|
+
*/
|
|
36
|
+
stroke?: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Отображение точек на графике
|
|
40
|
+
*/
|
|
41
|
+
dot?: boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Параметры для точек грфика (если dot: true)
|
|
45
|
+
*/
|
|
46
|
+
dotSettings?: DotSettingProps[] | DotSettingProps;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Наследование цвета
|
|
50
|
+
*/
|
|
51
|
+
inheritStroke?: boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Форматирование значения графика для тултипа
|
|
55
|
+
*/
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
57
|
+
formatter?: Function;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Тип линии
|
|
61
|
+
*/
|
|
62
|
+
type?: CurveType;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Толщина линии
|
|
66
|
+
*/
|
|
67
|
+
strokeWidth?: number;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Прерывистость линии
|
|
71
|
+
*/
|
|
72
|
+
strokeDasharray?: string | number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ToggleChartProps {
|
|
76
|
+
chart?: 'line' | 'area' | 'bar' | 'gradient';
|
|
77
|
+
data?: DataProps[];
|
|
78
|
+
icon?: 'circleLine' | 'filledCircle' | 'strokeCircle' | 'circle';
|
|
79
|
+
order?: number;
|
|
80
|
+
properties: ChartProps;
|
|
81
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface ComposedChartProps {
|
|
2
|
+
/**
|
|
3
|
+
* Отступы графика на момент инициализации компонента
|
|
4
|
+
*/
|
|
5
|
+
initMargin?: {
|
|
6
|
+
top?: number;
|
|
7
|
+
bottom?: number;
|
|
8
|
+
left?: number;
|
|
9
|
+
right?: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Отступы которые высчитываются автоматически, основаны на initMargin и отступах разных елементов
|
|
14
|
+
*/
|
|
15
|
+
margin?: {
|
|
16
|
+
top?: number;
|
|
17
|
+
right?: number;
|
|
18
|
+
left?: number;
|
|
19
|
+
bottom?: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Максимальная ширина графиков типа bar
|
|
24
|
+
*/
|
|
25
|
+
maxBarSize?: number;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Разрыв между двумя категориями столбцов, который может быть процентным или фиксированным значением
|
|
29
|
+
*/
|
|
30
|
+
barCategoryGap?: string | number;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Разрыв между двумя столбцами одной категории
|
|
34
|
+
*/
|
|
35
|
+
barGap?: number;
|
|
36
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './utils';
|
|
2
|
+
export * from './brush.types';
|
|
3
|
+
export * from './cartesianGrid.types';
|
|
4
|
+
export * from './chart.types';
|
|
5
|
+
export * from './composedChart.types';
|
|
6
|
+
export * from './labelList.types';
|
|
7
|
+
export * from './legend.types';
|
|
8
|
+
export * from './options.types';
|
|
9
|
+
export * from './payload.types';
|
|
10
|
+
export * from './responsiveContainer.types';
|
|
11
|
+
export * from './seria.types';
|
|
12
|
+
export * from './tooltip.types';
|
|
13
|
+
export * from './xAxis.types';
|
|
14
|
+
export * from './yAxis.types';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Formatter } from 'recharts/types/component/DefaultLegendContent';
|
|
2
|
+
|
|
3
|
+
export interface LegendProps {
|
|
4
|
+
/**
|
|
5
|
+
* Выравнивание элементов легенды в вертикальном направлении.
|
|
6
|
+
*/
|
|
7
|
+
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Функция форматирования каждого текста в легенде.
|
|
11
|
+
*/
|
|
12
|
+
formatter?: Formatter;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Выравнивание элементов легенды в горизонтальном направлении.
|
|
16
|
+
*/
|
|
17
|
+
align?: 'left' | 'center' | 'right';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Вертикальный отступ
|
|
21
|
+
*/
|
|
22
|
+
marginTop?: number;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Выщитывается автоматически
|
|
26
|
+
*/
|
|
27
|
+
margin?: {
|
|
28
|
+
top?: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Высота иконок
|
|
33
|
+
*/
|
|
34
|
+
iconHeight?: number;
|
|
35
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { BrushProps } from './brush.types';
|
|
4
|
+
import { CartesianGridProps } from './cartesianGrid.types';
|
|
5
|
+
import { ComposedChartProps } from './composedChart.types';
|
|
6
|
+
import { LegendProps } from './legend.types';
|
|
7
|
+
import { ResponsiveContainerProps } from './responsiveContainer.types';
|
|
8
|
+
import { SeriaProps } from './seria.types';
|
|
9
|
+
import { TooltipProps } from './tooltip.types';
|
|
10
|
+
import { XAxisProps } from './xAxis.types';
|
|
11
|
+
import { YAxisProps } from './yAxis.types';
|
|
12
|
+
|
|
13
|
+
export interface OptionsProps {
|
|
14
|
+
/**
|
|
15
|
+
* Индефикатор графика
|
|
16
|
+
*/
|
|
17
|
+
id: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Компонент контейнера, позволяющий адаптировать диаграммы к размеру родительского контейнера
|
|
21
|
+
*/
|
|
22
|
+
responsiveContainer?: ResponsiveContainerProps;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Диаграмма, состоящая из bar, linear и area диаграмм
|
|
26
|
+
*/
|
|
27
|
+
composeChart: ComposedChartProps;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Отображение линий осей графика
|
|
31
|
+
*/
|
|
32
|
+
cartesianGrid?: CartesianGridProps;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Настройки оси Х
|
|
36
|
+
*/
|
|
37
|
+
xAxis: XAxisProps;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Настройки оси У
|
|
41
|
+
*/
|
|
42
|
+
yAxis: YAxisProps;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Всплывающаяся подсказка
|
|
46
|
+
*/
|
|
47
|
+
tooltip?: TooltipProps;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Компонент маштабирования графика
|
|
51
|
+
*/
|
|
52
|
+
brush?: BrushProps;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Компонент подписи графиков
|
|
56
|
+
*/
|
|
57
|
+
legend?: LegendProps;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Mассив объектов с параметрами грaфиков с обязательным полем
|
|
61
|
+
*/
|
|
62
|
+
series: SeriaProps[];
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Mассив меток
|
|
66
|
+
*/
|
|
67
|
+
labels: Array<string | number>;
|
|
68
|
+
children?: React.ReactNode;
|
|
69
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DataDynamicBooleanProps } from './utils/data.types';
|
|
2
|
+
|
|
3
|
+
export interface PayloadProps {
|
|
4
|
+
/**
|
|
5
|
+
* Цвет графика
|
|
6
|
+
*/
|
|
7
|
+
color: string;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Ключ графика
|
|
11
|
+
*/
|
|
12
|
+
dataKey: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Форматирование значения графика
|
|
16
|
+
*/
|
|
17
|
+
formatter: (value: number | string) => React.ReactText;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Имя графика
|
|
21
|
+
*/
|
|
22
|
+
name: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Полезная нагрузка
|
|
26
|
+
*/
|
|
27
|
+
payload: DataDynamicBooleanProps;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Значение графика
|
|
31
|
+
*/
|
|
32
|
+
value: number;
|
|
33
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { DataProps } from './utils/data.types';
|
|
2
|
+
import { GradientProps } from './utils/gradient.types';
|
|
3
|
+
import { ChartProps } from './chart.types';
|
|
4
|
+
import { LabelListProps } from './labelList.types';
|
|
5
|
+
|
|
6
|
+
export type RadiusProp = {
|
|
7
|
+
top?: number;
|
|
8
|
+
bottom?: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface SeriaProps {
|
|
12
|
+
/**
|
|
13
|
+
* Скрыть график
|
|
14
|
+
*/
|
|
15
|
+
hide?: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Скрыть график в легенде
|
|
19
|
+
*/
|
|
20
|
+
hideLegend?: boolean;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Скрыть график в тултипe
|
|
24
|
+
*/
|
|
25
|
+
hideTooltip?: boolean;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Z-index графика
|
|
29
|
+
*/
|
|
30
|
+
zIndex?: number;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Тип графика
|
|
34
|
+
*/
|
|
35
|
+
chart: 'line' | 'area' | 'bar' | 'gradient';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Радиус закругления углов графика типа bar
|
|
39
|
+
*/
|
|
40
|
+
radius?: RadiusProp;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Тип иконки для графика
|
|
44
|
+
*/
|
|
45
|
+
icon: 'circleLine' | 'filledCircle' | 'strokeCircle' | 'circle';
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Оффсет для градиента (только для типа area)
|
|
49
|
+
*/
|
|
50
|
+
offset: number;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Заливка графика
|
|
54
|
+
*/
|
|
55
|
+
fill?: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Прозрачность
|
|
59
|
+
*/
|
|
60
|
+
gradient: {
|
|
61
|
+
/**
|
|
62
|
+
* Индефикатор градиента
|
|
63
|
+
*/
|
|
64
|
+
gid: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Параметра точек для градиента
|
|
68
|
+
*/
|
|
69
|
+
points: GradientProps[];
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Параметры labels для графика типа bar
|
|
74
|
+
*/
|
|
75
|
+
labelList?: LabelListProps;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Параметры графика
|
|
79
|
+
*/
|
|
80
|
+
properties: ChartProps;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Данные для построения графика
|
|
84
|
+
*/
|
|
85
|
+
data: DataProps[];
|
|
86
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { ReactElement, ReactText, SVGProps } from 'react';
|
|
3
|
+
import { AnimationTiming } from 'recharts/types/util/types';
|
|
4
|
+
|
|
5
|
+
export interface TooltipProps {
|
|
6
|
+
/**
|
|
7
|
+
* Разделитель между именем и значением.
|
|
8
|
+
*/
|
|
9
|
+
separator?: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Размер смещения между положением всплывающей подсказки и активной позицией.
|
|
13
|
+
*/
|
|
14
|
+
offset?: number;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Когда элемент полезной нагрузки имеет значение null или undefined, этот элемент не отображается.
|
|
18
|
+
*/
|
|
19
|
+
filterNull?: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Если установлено false, курсор не будет отображаться, когда всплывающая подсказка активна.
|
|
23
|
+
* Если установлен объект, опция - это конфигурация курсора.
|
|
24
|
+
* Если установлен элемент React, опция является настраиваемым элементом реакции курсора рисования.
|
|
25
|
+
*/
|
|
26
|
+
cursor?: boolean | ReactElement | SVGProps<SVGElement>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Если это поле установлено, положение всплывающей подсказки будет фиксированным и больше не будет перемещаться.
|
|
30
|
+
*/
|
|
31
|
+
position?: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Если установлено false, анимация всплывающей подсказки будет отключена.
|
|
38
|
+
*/
|
|
39
|
+
isAnimationActive?: boolean;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Указывает, когда должна начинаться анимация, единица измерения этого параметра - мс.
|
|
43
|
+
*/
|
|
44
|
+
animationBegin?: number;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Определяет продолжительность анимации, единица измерения этого параметра - мс.
|
|
48
|
+
*/
|
|
49
|
+
animationDuration?: number;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Тип функции плавности.
|
|
53
|
+
*/
|
|
54
|
+
animationEasing?: AnimationTiming;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Отображение стрелки тултипа
|
|
58
|
+
*/
|
|
59
|
+
arrow: boolean;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Высчитывается автоматичекси, направление стрелки
|
|
63
|
+
*/
|
|
64
|
+
tooltipArrowSide?: boolean;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Функция форматирования метки во всплывающей подсказке.
|
|
68
|
+
*/
|
|
69
|
+
labelFormatter?: (value: any) => ReactText;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Стиль метки всплывающей подсказки по умолчанию, которая является элементом p.
|
|
73
|
+
*/
|
|
74
|
+
labelStyle?: Record<string, unknown>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Значение метки, которое сейчас активно, обычно рассчитывается внутри компании.
|
|
78
|
+
*/
|
|
79
|
+
label?: string | number;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Контент для тултипа
|
|
83
|
+
*/
|
|
84
|
+
content?: any;
|
|
85
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { ReactElement, SVGProps } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface AxisProps {
|
|
5
|
+
/**
|
|
6
|
+
* Скрыть ось
|
|
7
|
+
*/
|
|
8
|
+
hide?: boolean;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Отображение линии оси.
|
|
12
|
+
*/
|
|
13
|
+
axisLine: boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Тип оси.
|
|
17
|
+
*/
|
|
18
|
+
type: 'number' | 'category';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Разрешить значениям оси быть десятичными или нет.
|
|
22
|
+
*/
|
|
23
|
+
allowDecimals?: boolean;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Разрешить или нет на оси дублировать категории, если "type" оси - "category".
|
|
27
|
+
*/
|
|
28
|
+
allowDuplicatedCategory?: boolean;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Угол наклона значений оси.
|
|
32
|
+
*/
|
|
33
|
+
angle?: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Количество делений оси. Не используется, если "тип" - "категория".
|
|
37
|
+
*/
|
|
38
|
+
tickCount?: number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Интревал линий деления оси
|
|
42
|
+
*/
|
|
43
|
+
interval?: 'preserveStart' | 'preserveEnd' | 'preserveStartEnd' | number;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Минимальный зазор между двумя соседними делениями оси.
|
|
47
|
+
*/
|
|
48
|
+
minTickGap?: number;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Отображение линий деления оси
|
|
52
|
+
*/
|
|
53
|
+
tickLine?: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Размер линий деления оси
|
|
57
|
+
*/
|
|
58
|
+
tickSize?: number;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Если установлено значение true, галочки переворачиваются вокруг оси, отображая метки внутри диаграммы, а не снаружи.
|
|
62
|
+
*/
|
|
63
|
+
mirror?: boolean;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Отображение горизонтальной сетки
|
|
67
|
+
*/
|
|
68
|
+
reversed?: boolean;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Реверсировать ось или нет
|
|
72
|
+
*/
|
|
73
|
+
tickMargin?: number;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Функция форматирования значения деления оси.
|
|
77
|
+
*/
|
|
78
|
+
tickFormatter?: (value: any, index: number) => string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Присваивается автоматически в зависимости от переданных данных
|
|
82
|
+
*/
|
|
83
|
+
tick?:
|
|
84
|
+
| SVGProps<SVGTextElement>
|
|
85
|
+
| ReactElement<SVGElement>
|
|
86
|
+
| ((props: any) => ReactElement<SVGElement>)
|
|
87
|
+
| boolean;
|
|
88
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface DataProps {
|
|
2
|
+
/**
|
|
3
|
+
* Метка
|
|
4
|
+
*/
|
|
5
|
+
label: string | number;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Значение
|
|
9
|
+
*/
|
|
10
|
+
value: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface DataDynamicProps {
|
|
14
|
+
[key: string]: number | string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface DataDynamicBooleanProps {
|
|
18
|
+
[key: string]: boolean;
|
|
19
|
+
}
|