@alfalab/core-components-chart 3.3.3 → 3.4.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.
Files changed (128) hide show
  1. package/Component.js +1 -1
  2. package/components/Dot/index.css +8 -8
  3. package/components/Dot/index.js +1 -1
  4. package/components/Legends/index.css +12 -11
  5. package/components/Legends/index.js +1 -1
  6. package/components/Tick/index.css +4 -4
  7. package/components/Tick/index.js +1 -1
  8. package/components/TooltipContent/index.css +18 -14
  9. package/components/TooltipContent/index.js +1 -1
  10. package/cssm/components/Legends/index.module.css +4 -3
  11. package/cssm/components/TooltipContent/index.module.css +11 -7
  12. package/esm/Component.js +1 -1
  13. package/esm/components/Dot/index.css +8 -8
  14. package/esm/components/Dot/index.js +1 -1
  15. package/esm/components/Legends/index.css +12 -11
  16. package/esm/components/Legends/index.js +1 -1
  17. package/esm/components/Tick/index.css +4 -4
  18. package/esm/components/Tick/index.js +1 -1
  19. package/esm/components/TooltipContent/index.css +18 -14
  20. package/esm/components/TooltipContent/index.js +1 -1
  21. package/esm/index.css +5 -5
  22. package/index.css +5 -5
  23. package/modern/Component.js +1 -1
  24. package/modern/components/Dot/index.css +8 -8
  25. package/modern/components/Dot/index.js +1 -1
  26. package/modern/components/Legends/index.css +12 -11
  27. package/modern/components/Legends/index.js +1 -1
  28. package/modern/components/Tick/index.css +4 -4
  29. package/modern/components/Tick/index.js +1 -1
  30. package/modern/components/TooltipContent/index.css +18 -14
  31. package/modern/components/TooltipContent/index.js +1 -1
  32. package/modern/index.css +5 -5
  33. package/moderncssm/Component.d.ts +8 -0
  34. package/moderncssm/Component.js +251 -0
  35. package/moderncssm/components/CustomizedLabel.d.ts +4 -0
  36. package/moderncssm/components/CustomizedLabel.js +11 -0
  37. package/moderncssm/components/Dot/index.d.ts +5 -0
  38. package/moderncssm/components/Dot/index.js +43 -0
  39. package/moderncssm/components/Dot/index.module.css +22 -0
  40. package/moderncssm/components/Legends/index.d.ts +14 -0
  41. package/moderncssm/components/Legends/index.js +36 -0
  42. package/moderncssm/components/Legends/index.module.css +36 -0
  43. package/moderncssm/components/LinearGradient.d.ts +5 -0
  44. package/moderncssm/components/LinearGradient.js +5 -0
  45. package/moderncssm/components/RectBar.d.ts +3 -0
  46. package/moderncssm/components/RectBar.js +27 -0
  47. package/moderncssm/components/Tick/index.d.ts +5 -0
  48. package/moderncssm/components/Tick/index.js +16 -0
  49. package/moderncssm/components/Tick/index.module.css +18 -0
  50. package/moderncssm/components/TooltipContent/index.d.ts +11 -0
  51. package/moderncssm/components/TooltipContent/index.js +26 -0
  52. package/moderncssm/components/TooltipContent/index.module.css +51 -0
  53. package/moderncssm/hooks/usePathBar/index.d.ts +14 -0
  54. package/moderncssm/hooks/usePathBar/index.js +37 -0
  55. package/moderncssm/hooks/usePathBar/utils/getRadius.d.ts +2 -0
  56. package/moderncssm/hooks/usePathBar/utils/getRadius.js +6 -0
  57. package/moderncssm/hooks/useSettings/index.d.ts +19 -0
  58. package/moderncssm/hooks/useSettings/index.js +43 -0
  59. package/moderncssm/hooks/useSettings/utils/setComposedChartsMargin.d.ts +12 -0
  60. package/moderncssm/hooks/useSettings/utils/setComposedChartsMargin.js +12 -0
  61. package/moderncssm/hooks/useSettings/utils/setDatas.d.ts +5 -0
  62. package/moderncssm/hooks/useSettings/utils/setDatas.js +32 -0
  63. package/moderncssm/hooks/useSettings/utils/setGradientCharts.d.ts +3 -0
  64. package/moderncssm/hooks/useSettings/utils/setGradientCharts.js +35 -0
  65. package/moderncssm/hooks/useSettings/utils/setLegendMargin.d.ts +4 -0
  66. package/moderncssm/hooks/useSettings/utils/setLegendMargin.js +14 -0
  67. package/moderncssm/hooks/useSettings/utils/sortByIndex.d.ts +3 -0
  68. package/moderncssm/hooks/useSettings/utils/sortByIndex.js +8 -0
  69. package/moderncssm/icons/Circle.d.ts +8 -0
  70. package/moderncssm/icons/Circle.js +6 -0
  71. package/moderncssm/icons/CircleLine.d.ts +8 -0
  72. package/moderncssm/icons/CircleLine.js +7 -0
  73. package/moderncssm/icons/FilledCircle.d.ts +8 -0
  74. package/moderncssm/icons/FilledCircle.js +10 -0
  75. package/moderncssm/icons/Point.d.ts +8 -0
  76. package/moderncssm/icons/Point.js +7 -0
  77. package/moderncssm/icons/StrokeCircle.d.ts +8 -0
  78. package/moderncssm/icons/StrokeCircle.js +6 -0
  79. package/moderncssm/index.d.ts +2 -0
  80. package/moderncssm/index.js +1 -0
  81. package/moderncssm/index.module.css +19 -0
  82. package/moderncssm/types/brush.types.d.ts +41 -0
  83. package/moderncssm/types/brush.types.js +1 -0
  84. package/moderncssm/types/cartesianGrid.types.d.ts +23 -0
  85. package/moderncssm/types/cartesianGrid.types.js +1 -0
  86. package/moderncssm/types/chart.types.d.ts +61 -0
  87. package/moderncssm/types/chart.types.js +1 -0
  88. package/moderncssm/types/composedChart.types.d.ts +33 -0
  89. package/moderncssm/types/composedChart.types.js +1 -0
  90. package/moderncssm/types/index.d.ts +14 -0
  91. package/moderncssm/types/index.js +1 -0
  92. package/moderncssm/types/labelList.types.d.ts +5 -0
  93. package/moderncssm/types/labelList.types.js +1 -0
  94. package/moderncssm/types/legend.types.d.ts +30 -0
  95. package/moderncssm/types/legend.types.js +1 -0
  96. package/moderncssm/types/options.types.d.ts +59 -0
  97. package/moderncssm/types/options.types.js +1 -0
  98. package/moderncssm/types/payload.types.d.ts +29 -0
  99. package/moderncssm/types/payload.types.js +1 -0
  100. package/moderncssm/types/responsiveContainer.types.d.ts +10 -0
  101. package/moderncssm/types/responsiveContainer.types.js +1 -0
  102. package/moderncssm/types/seria.types.d.ts +72 -0
  103. package/moderncssm/types/seria.types.js +1 -0
  104. package/moderncssm/types/tooltip.types.d.ts +70 -0
  105. package/moderncssm/types/tooltip.types.js +1 -0
  106. package/moderncssm/types/utils/axis.types.d.ts +68 -0
  107. package/moderncssm/types/utils/axis.types.js +1 -0
  108. package/moderncssm/types/utils/coordinates.types.d.ts +11 -0
  109. package/moderncssm/types/utils/coordinates.types.js +1 -0
  110. package/moderncssm/types/utils/data.types.d.ts +17 -0
  111. package/moderncssm/types/utils/data.types.js +1 -0
  112. package/moderncssm/types/utils/dot.types.d.ts +73 -0
  113. package/moderncssm/types/utils/dot.types.js +1 -0
  114. package/moderncssm/types/utils/gradient.types.d.ts +29 -0
  115. package/moderncssm/types/utils/gradient.types.js +1 -0
  116. package/moderncssm/types/utils/index.d.ts +7 -0
  117. package/moderncssm/types/utils/index.js +1 -0
  118. package/moderncssm/types/utils/tick.types.d.ts +19 -0
  119. package/moderncssm/types/utils/tick.types.js +1 -0
  120. package/moderncssm/types/xAxis.types.d.ts +16 -0
  121. package/moderncssm/types/xAxis.types.js +1 -0
  122. package/moderncssm/types/yAxis.types.d.ts +8 -0
  123. package/moderncssm/types/yAxis.types.js +1 -0
  124. package/package.json +4 -4
  125. package/src/components/Legends/index.module.css +4 -4
  126. package/src/components/Tick/index.module.css +1 -1
  127. package/src/components/TooltipContent/index.module.css +7 -7
  128. package/src/index.module.css +1 -1
@@ -0,0 +1,37 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { getRadius } from './utils/getRadius.js';
3
+
4
+ const usePathBar = (props) => {
5
+ const [topRadius, setTopRadius] = useState(0);
6
+ const [bottomRadius, setBottomRadius] = useState(0);
7
+ const [initHeight, setInitHeight] = useState(0);
8
+ const [initY, setInitY] = useState(0);
9
+ useEffect(() => {
10
+ const { radius, height, background, y } = props;
11
+ const radiusTop = radius?.top ? getRadius(height, radius.top) : 0;
12
+ const radiusBottom = radius?.bottom ? getRadius(height, radius.bottom) : 0;
13
+ const heightCheck = (radius && height !== 0 && height / 2 < (radius?.top || 0)) ||
14
+ height / 2 < (radius?.bottom || 0);
15
+ // eslint-disable-next-line no-nested-ternary
16
+ const heightInit = heightCheck
17
+ ? (radiusTop || radiusBottom) && radiusTop + radiusBottom
18
+ : height > 0 && height < 2
19
+ ? 2
20
+ : height;
21
+ if (background && y) {
22
+ const yInit = heightCheck
23
+ ? background.height + background.y - (radiusTop + radiusBottom)
24
+ : y;
25
+ setInitY(yInit);
26
+ }
27
+ if (radiusTop !== 0)
28
+ setTopRadius(radiusTop);
29
+ if (radiusBottom !== 0)
30
+ setBottomRadius(radiusBottom);
31
+ if (heightInit !== 0)
32
+ setInitHeight(heightInit);
33
+ }, [props]);
34
+ return [initHeight, topRadius, bottomRadius, initY];
35
+ };
36
+
37
+ export { usePathBar };
@@ -0,0 +1,2 @@
1
+ declare const getRadius: (height: number, radius: number) => number;
2
+ export { getRadius };
@@ -0,0 +1,6 @@
1
+ const getRadius = (height, radius) => {
2
+ const result = radius && height / 2 < radius ? Math.ceil(height / 2) : radius || 0;
3
+ return result;
4
+ };
5
+
6
+ export { getRadius };
@@ -0,0 +1,19 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { OptionsProps } from "../../types/options.types";
3
+ import { DataDynamicBooleanProps, DataDynamicProps } from "../../types/utils/data.types";
4
+ type Settings = [
5
+ {
6
+ state: OptionsProps | null;
7
+ data: DataDynamicProps[];
8
+ charts: DataDynamicBooleanProps;
9
+ filterCount: number;
10
+ },
11
+ {
12
+ setState: Dispatch<SetStateAction<OptionsProps | null>>;
13
+ setData: Dispatch<SetStateAction<DataDynamicProps[]>>;
14
+ setCharts: Dispatch<SetStateAction<DataDynamicBooleanProps>>;
15
+ setFilterCount: Dispatch<SetStateAction<number>>;
16
+ }
17
+ ];
18
+ declare const useSettings: (options: OptionsProps) => Settings;
19
+ export { useSettings };
@@ -0,0 +1,43 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { setComposedChartsMargin } from './utils/setComposedChartsMargin.js';
3
+ import { setDatas } from './utils/setDatas.js';
4
+ import { setGradientCharts } from './utils/setGradientCharts.js';
5
+ import { setLegendMargin } from './utils/setLegendMargin.js';
6
+ import { sortByIndex } from './utils/sortByIndex.js';
7
+
8
+ const useSettings = (options) => {
9
+ const [state, setState] = useState(null);
10
+ const [charts, setCharts] = useState({});
11
+ const [data, setData] = useState([]);
12
+ const [filterCount, setFilterCount] = useState(0);
13
+ useEffect(() => {
14
+ const settings = { ...options };
15
+ const { brush, legend, series, labels, composeChart, xAxis } = settings;
16
+ if (settings.legend?.margin && brush && legend)
17
+ settings.legend.margin.top = setLegendMargin(brush, legend);
18
+ settings.series = setGradientCharts(series);
19
+ const [initData, chartsNames, count] = setDatas(settings.series, labels);
20
+ settings.composeChart.margin = setComposedChartsMargin(composeChart, legend, brush, xAxis);
21
+ settings.series = sortByIndex(settings.series);
22
+ setState(settings);
23
+ setData(initData);
24
+ setCharts(chartsNames);
25
+ setFilterCount(count);
26
+ }, [options]);
27
+ return [
28
+ {
29
+ state,
30
+ data,
31
+ charts,
32
+ filterCount,
33
+ },
34
+ {
35
+ setState,
36
+ setData,
37
+ setCharts,
38
+ setFilterCount,
39
+ },
40
+ ];
41
+ };
42
+
43
+ export { useSettings };
@@ -0,0 +1,12 @@
1
+ import { BrushProps } from "../../../types/brush.types";
2
+ import { ComposedChartProps } from "../../../types/composedChart.types";
3
+ import { LegendProps } from "../../../types/legend.types";
4
+ import { XAxisProps } from "../../../types/xAxis.types";
5
+ type ComposedChartsMarginResultProps = {
6
+ top: number;
7
+ bottom: number;
8
+ left: number;
9
+ right: number;
10
+ };
11
+ declare const setComposedChartsMargin: (composeChart: ComposedChartProps, legend: LegendProps | undefined, brush: BrushProps | undefined, xAxis: XAxisProps) => ComposedChartsMarginResultProps;
12
+ export { setComposedChartsMargin };
@@ -0,0 +1,12 @@
1
+ const setComposedChartsMargin = (composeChart, legend, brush, xAxis) => ({
2
+ top: (composeChart?.initMargin?.top || 0) +
3
+ (legend?.verticalAlign === 'top' && legend?.marginTop ? Math.abs(legend.marginTop) : 0),
4
+ bottom: (composeChart?.initMargin?.bottom || 0) +
5
+ (xAxis?.tickMargin || 0) +
6
+ (brush?.brushMargin || 0) +
7
+ (legend?.verticalAlign !== 'top' && legend?.marginTop ? legend.marginTop : 0),
8
+ left: composeChart?.initMargin?.left || 0,
9
+ right: composeChart?.initMargin?.right || 0,
10
+ });
11
+
12
+ export { setComposedChartsMargin };
@@ -0,0 +1,5 @@
1
+ import { SeriaProps } from "../../../types/seria.types";
2
+ import { DataDynamicBooleanProps, DataDynamicProps } from "../../../types/utils/data.types";
3
+ type DatasResultProps = [DataDynamicProps[], DataDynamicBooleanProps, number];
4
+ declare const setDatas: (series: SeriaProps[], labels: Array<string | number>) => DatasResultProps;
5
+ export { setDatas };
@@ -0,0 +1,32 @@
1
+ const setDatas = (series, labels) => {
2
+ const initData = [];
3
+ const chartsNames = {};
4
+ let count = 0;
5
+ for (let i = 0; i < series.length; i++) {
6
+ const { properties: { dataKey = '' } = {}, data: seriaData = [], hideLegend, hide, } = series[i];
7
+ if (!hideLegend && !hide)
8
+ count += 1;
9
+ labels.map((label) => {
10
+ const item = seriaData.find((d) => d.label === label);
11
+ if (item) {
12
+ const obj = {
13
+ label,
14
+ };
15
+ obj[`${dataKey}`] = item.value;
16
+ if (!chartsNames[`${dataKey}`])
17
+ chartsNames[`${dataKey}`] = true;
18
+ const index = initData
19
+ .map((dataItem) => dataItem.label)
20
+ .indexOf(label);
21
+ if (index === -1)
22
+ initData.push(obj);
23
+ else
24
+ initData[index] = { ...initData[index], ...obj };
25
+ }
26
+ return null;
27
+ });
28
+ }
29
+ return [initData, chartsNames, count];
30
+ };
31
+
32
+ export { setDatas };
@@ -0,0 +1,3 @@
1
+ import { SeriaProps } from "../../../types/seria.types";
2
+ declare const setGradientCharts: (series: SeriaProps[]) => SeriaProps[];
3
+ export { setGradientCharts };
@@ -0,0 +1,35 @@
1
+ const setGradientCharts = (series) => {
2
+ const filterSeries = series.filter((item) => item.chart !== 'gradient');
3
+ return filterSeries.reduce((accum, item) => {
4
+ const { chart, data: dataSeria, offset, fill } = item;
5
+ if (chart === 'area') {
6
+ let newData = null;
7
+ if (offset) {
8
+ newData = dataSeria.map((d) => {
9
+ const { label, value } = d;
10
+ return {
11
+ label,
12
+ value: Math.ceil(value - value * offset),
13
+ };
14
+ });
15
+ }
16
+ accum.push({
17
+ ...item,
18
+ zIndex: -100,
19
+ chart: 'gradient',
20
+ hideLegend: true,
21
+ hideTooltip: true,
22
+ properties: {
23
+ ...item.properties,
24
+ dataKey: `${item.properties.dataKey}-gradient`,
25
+ fill,
26
+ },
27
+ data: newData || item.data,
28
+ });
29
+ }
30
+ accum.push(item);
31
+ return accum;
32
+ }, []);
33
+ };
34
+
35
+ export { setGradientCharts };
@@ -0,0 +1,4 @@
1
+ import { BrushProps } from "../../../types/brush.types";
2
+ import { LegendProps } from "../../../types/legend.types";
3
+ declare const setLegendMargin: (brush: BrushProps, legend: LegendProps) => number;
4
+ export { setLegendMargin };
@@ -0,0 +1,14 @@
1
+ const setLegendMargin = (brush, legend) => {
2
+ let top = 0;
3
+ if (typeof brush?.brushMargin !== 'number' || !legend?.verticalAlign)
4
+ return top;
5
+ if (legend.verticalAlign === 'top') {
6
+ top = legend.marginTop ? Number(legend.marginTop * -1) : 0;
7
+ }
8
+ else {
9
+ top = legend?.marginTop ? legend.marginTop + (brush?.brushMargin || 0) : brush?.brushMargin;
10
+ }
11
+ return top;
12
+ };
13
+
14
+ export { setLegendMargin };
@@ -0,0 +1,3 @@
1
+ import { SeriaProps } from "../../../types/seria.types";
2
+ declare const sortByIndex: (series: SeriaProps[]) => SeriaProps[];
3
+ export { sortByIndex };
@@ -0,0 +1,8 @@
1
+ const sortByIndex = (series) => series.sort((a, b) => {
2
+ if (a?.zIndex && b?.zIndex && a?.zIndex > b?.zIndex) {
3
+ return 1;
4
+ }
5
+ return -1;
6
+ });
7
+
8
+ export { sortByIndex };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ type Props = {
4
+ fill?: string;
5
+ height?: number;
6
+ };
7
+ declare const CircleIcon: ({ fill, height }: Props) => React.JSX.Element;
8
+ export { CircleIcon };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+
3
+ const CircleIcon = ({ fill = '#FF5C5C', height = 16 }) => (React.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', height: height, viewBox: '0 0 16 16', fill: 'none' },
4
+ React.createElement("circle", { cx: '8', cy: '8', r: '8', fill: fill })));
5
+
6
+ export { CircleIcon };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ type Props = {
4
+ fill?: string;
5
+ height?: number;
6
+ };
7
+ declare const CircleLineIcon: ({ fill, height }: Props) => React.ReactElement;
8
+ export { CircleLineIcon };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+
3
+ const CircleLineIcon = ({ fill = '#FF5C5C', height = 16 }) => (React.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', height: height, viewBox: '0 0 22 12', fill: 'none' },
4
+ React.createElement("circle", { cx: '11', cy: '6', r: '6', fill: fill }),
5
+ React.createElement("rect", { y: '5', width: '22', height: '2', fill: fill })));
6
+
7
+ export { CircleLineIcon };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ type Props = {
4
+ fill?: string;
5
+ height?: number;
6
+ };
7
+ declare const FilledCircleIcon: ({ fill, height }: Props) => React.JSX.Element;
8
+ export { FilledCircleIcon };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+
3
+ const FilledCircleIcon = ({ fill = '#5A8ECF', height = 16 }) => (React.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', height: height, viewBox: '0 0 22 22', fill: 'none' },
4
+ React.createElement("circle", { cx: '11', cy: '11', r: '10', fill: 'url(#paint0_linear)', stroke: fill, strokeWidth: '2' }),
5
+ React.createElement("defs", null,
6
+ React.createElement("linearGradient", { id: 'paint0_linear', x1: '11', y1: '1', x2: '11', y2: '21', gradientUnits: 'userSpaceOnUse' },
7
+ React.createElement("stop", { stopColor: fill, stopOpacity: '0.2' }),
8
+ React.createElement("stop", { offset: '1', stopColor: fill, stopOpacity: '0' })))));
9
+
10
+ export { FilledCircleIcon };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ type Props = {
4
+ fill?: string;
5
+ height?: number;
6
+ };
7
+ declare const PointIcon: ({ fill, height }: Props) => React.JSX.Element;
8
+ export { PointIcon };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+
3
+ const PointIcon = ({ fill = '#5A8ECF', height = 16 }) => (React.createElement("svg", { height: height, viewBox: '0 0 18 18' },
4
+ React.createElement("circle", { cx: '9', cy: '9', r: '9', strokeWidth: '1', fill: fill, fillOpacity: '0.4' }),
5
+ React.createElement("circle", { cx: '9', cy: '9', r: '3', strokeWidth: '2', stroke: '#fff', fill: fill })));
6
+
7
+ export { PointIcon };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ type Props = {
4
+ fill?: string;
5
+ height?: number;
6
+ };
7
+ declare const StrokeCircleIcon: ({ fill, height }: Props) => React.JSX.Element;
8
+ export { StrokeCircleIcon };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+
3
+ const StrokeCircleIcon = ({ fill = '#5A8ECF', height = 16 }) => (React.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', height: height, viewBox: '0 0 22 22', fill: 'none' },
4
+ React.createElement("circle", { cx: '11', cy: '11', r: '10', stroke: fill, strokeWidth: '2', strokeDasharray: '8 8' })));
5
+
6
+ export { StrokeCircleIcon };
@@ -0,0 +1,2 @@
1
+ export * from "./Component";
2
+ export * from "./types/index";
@@ -0,0 +1 @@
1
+ export { Chart } from './Component.js';
@@ -0,0 +1,19 @@
1
+ /* */
2
+
3
+ .coreChart :global(.recharts-line path) {
4
+ transition: d 0.2s ease-out;
5
+ }
6
+
7
+ .coreChart :global(.recharts-text tspan) {
8
+ fill: var(--color-light-text-primary);
9
+ font-size: 16px;
10
+ line-height: 22px;
11
+ }
12
+
13
+ .bar {
14
+ transition: opacity 0.2s ease-out, d 0.2s ease-out;
15
+ }
16
+
17
+ .unfocused {
18
+ opacity: 0.3;
19
+ }
@@ -0,0 +1,41 @@
1
+ import { ReactText } from 'react';
2
+ import { DataKey } from 'recharts/types/util/types';
3
+ interface BrushProps {
4
+ /**
5
+ * Ключ данных
6
+ */
7
+ dataKey?: DataKey<string>;
8
+ /**
9
+ * Ширина ползунков
10
+ */
11
+ travallerWidth?: number;
12
+ /**
13
+ * Начальный индекс интервала показа
14
+ */
15
+ startIndex?: number;
16
+ /**
17
+ * Конечный индекс интервала показа
18
+ */
19
+ endIndex?: number;
20
+ /**
21
+ * Отступ
22
+ */
23
+ brushMargin?: number;
24
+ /**
25
+ * Высота
26
+ */
27
+ height: number;
28
+ /**
29
+ * Форматирование значений
30
+ */
31
+ tickFormatter?: (value: any, index: number) => ReactText;
32
+ /**
33
+ * Всегда показывать значение текущего интервала
34
+ */
35
+ alwaysShowText?: boolean;
36
+ /**
37
+ * Цвет
38
+ */
39
+ stroke?: string;
40
+ }
41
+ export { BrushProps };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,23 @@
1
+ interface CartesianGridProps {
2
+ /**
3
+ * Отображение горизонтальной сетки
4
+ */
5
+ horizontal?: boolean;
6
+ /**
7
+ * Отображение вертикальной сетки
8
+ */
9
+ vertical?: boolean;
10
+ /**
11
+ * Штрихи для осей
12
+ */
13
+ strokeDasharray?: string;
14
+ /**
15
+ * Цвет разметки сетки
16
+ */
17
+ stroke?: string;
18
+ /**
19
+ * Цвет заливки графика
20
+ */
21
+ fill?: string;
22
+ }
23
+ export { CartesianGridProps };
@@ -0,0 +1,61 @@
1
+ import { ReactElement } from 'react';
2
+ import { RectangleProps } from 'recharts';
3
+ import { DataKey } from 'recharts/types/util/types';
4
+ import { DataProps } from "./utils/data.types";
5
+ import { DotSettingProps } from "./utils/dot.types";
6
+ type CurveType = 'linear' | 'monotone' | 'step';
7
+ type RectangleShapeType = ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>) | RectangleProps | boolean;
8
+ interface ChartProps {
9
+ /**
10
+ * Название графика (отображается в легендах и тултипе)
11
+ */
12
+ name?: string;
13
+ /**
14
+ * Ключ данных
15
+ */
16
+ dataKey: DataKey<number | string>;
17
+ /**
18
+ * Цвет заливки графика
19
+ */
20
+ fill?: string;
21
+ /**
22
+ * Цвет линии графика
23
+ */
24
+ stroke?: string;
25
+ /**
26
+ * Отображение точек на графике
27
+ */
28
+ dot?: boolean;
29
+ /**
30
+ * Параметры для точек грфика (если dot: true)
31
+ */
32
+ dotSettings?: DotSettingProps[] | DotSettingProps;
33
+ /**
34
+ * Наследование цвета
35
+ */
36
+ inheritStroke?: boolean;
37
+ /**
38
+ * Форматирование значения графика для тултипа
39
+ */
40
+ formatter?: Function;
41
+ /**
42
+ * Тип линии
43
+ */
44
+ type?: CurveType;
45
+ /**
46
+ * Толщина линии
47
+ */
48
+ strokeWidth?: number;
49
+ /**
50
+ * Прерывистость линии
51
+ */
52
+ strokeDasharray?: string | number;
53
+ }
54
+ interface ToggleChartProps {
55
+ chart?: 'line' | 'area' | 'bar' | 'gradient';
56
+ data?: DataProps[];
57
+ icon?: 'circleLine' | 'filledCircle' | 'strokeCircle' | 'circle';
58
+ order?: number;
59
+ properties: ChartProps;
60
+ }
61
+ export { RectangleShapeType, ChartProps, ToggleChartProps };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,33 @@
1
+ interface ComposedChartProps {
2
+ /**
3
+ * Отступы графика на момент инициализации компонента
4
+ */
5
+ initMargin?: {
6
+ top?: number;
7
+ bottom?: number;
8
+ left?: number;
9
+ right?: number;
10
+ };
11
+ /**
12
+ * Отступы которые высчитываются автоматически, основаны на initMargin и отступах разных елементов
13
+ */
14
+ margin?: {
15
+ top?: number;
16
+ right?: number;
17
+ left?: number;
18
+ bottom?: number;
19
+ };
20
+ /**
21
+ * Максимальная ширина графиков типа bar
22
+ */
23
+ maxBarSize?: number;
24
+ /**
25
+ * Разрыв между двумя категориями столбцов, который может быть процентным или фиксированным значением
26
+ */
27
+ barCategoryGap?: string | number;
28
+ /**
29
+ * Разрыв между двумя столбцами одной категории
30
+ */
31
+ barGap?: number;
32
+ }
33
+ export { ComposedChartProps };
@@ -0,0 +1,14 @@
1
+ export * from "./utils/index";
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 @@
1
+
@@ -0,0 +1,5 @@
1
+ interface LabelListProps {
2
+ formatter: Function;
3
+ ofsset: number;
4
+ }
5
+ export { LabelListProps };
@@ -0,0 +1,30 @@
1
+ import { Formatter } from 'recharts/types/component/DefaultLegendContent';
2
+ interface LegendProps {
3
+ /**
4
+ * Выравнивание элементов легенды в вертикальном направлении.
5
+ */
6
+ verticalAlign?: 'top' | 'middle' | 'bottom';
7
+ /**
8
+ * Функция форматирования каждого текста в легенде.
9
+ */
10
+ formatter?: Formatter;
11
+ /**
12
+ * Выравнивание элементов легенды в горизонтальном направлении.
13
+ */
14
+ align?: 'left' | 'center' | 'right';
15
+ /**
16
+ * Вертикальный отступ
17
+ */
18
+ marginTop?: number;
19
+ /**
20
+ * Выщитывается автоматически
21
+ */
22
+ margin?: {
23
+ top?: number;
24
+ };
25
+ /**
26
+ * Высота иконок
27
+ */
28
+ iconHeight?: number;
29
+ }
30
+ export { LegendProps };
@@ -0,0 +1 @@
1
+