@gravity-ui/charts 1.51.7 → 1.52.0

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 (199) hide show
  1. package/dist/cjs/components/ChartInner/useChartInnerHandlers.d.ts +3 -2
  2. package/dist/cjs/components/ChartInner/useChartInnerHandlers.js +1 -3
  3. package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +3 -2
  4. package/dist/cjs/components/ChartInner/useDefaultState.d.ts +3 -2
  5. package/dist/cjs/components/index.d.ts +1 -0
  6. package/dist/cjs/components/index.js +1 -0
  7. package/dist/cjs/core/series/plugin.d.ts +47 -2
  8. package/dist/cjs/core/series/types.d.ts +4 -0
  9. package/dist/cjs/core/shapes/area/prepare-data.js +29 -19
  10. package/dist/cjs/core/shapes/area/renderer.d.ts +0 -5
  11. package/dist/cjs/core/shapes/area/renderer.js +0 -75
  12. package/dist/cjs/core/shapes/area/types.d.ts +2 -8
  13. package/dist/cjs/core/shapes/bar-x/prepare-data.js +18 -7
  14. package/dist/cjs/core/shapes/bar-x/renderer.d.ts +0 -1
  15. package/dist/cjs/core/shapes/bar-x/renderer.js +0 -18
  16. package/dist/cjs/core/shapes/bar-x/types.d.ts +2 -1
  17. package/dist/cjs/core/shapes/bar-y/get-tooltip-data.js +4 -2
  18. package/dist/cjs/core/shapes/bar-y/prepare-data.js +8 -2
  19. package/dist/cjs/core/shapes/funnel/prepare-data.js +121 -68
  20. package/dist/cjs/core/shapes/heatmap/prepare-data.js +11 -2
  21. package/dist/cjs/core/shapes/line/prepare-data.js +27 -17
  22. package/dist/cjs/core/shapes/line/renderer.d.ts +0 -5
  23. package/dist/cjs/core/shapes/line/renderer.js +0 -75
  24. package/dist/cjs/core/shapes/line/types.d.ts +2 -8
  25. package/dist/cjs/core/shapes/marker.d.ts +30 -0
  26. package/dist/cjs/core/shapes/marker.js +68 -0
  27. package/dist/cjs/core/shapes/pie/prepare-data.js +24 -9
  28. package/dist/cjs/core/shapes/radar/prepare-data.js +3 -0
  29. package/dist/cjs/core/shapes/sankey/prepare-data.js +10 -1
  30. package/dist/cjs/core/shapes/scatter/prepare-data.js +8 -1
  31. package/dist/cjs/core/shapes/scatter/renderer.js +3 -2
  32. package/dist/cjs/core/shapes/scatter/types.d.ts +1 -1
  33. package/dist/cjs/core/shapes/treemap/prepare-data.js +9 -1
  34. package/dist/cjs/core/shapes/types.d.ts +35 -0
  35. package/dist/cjs/core/shapes/waterfall/prepare-data.js +5 -2
  36. package/dist/cjs/core/shapes/x-range/prepare-data.js +7 -2
  37. package/dist/cjs/core/types/chart/base.d.ts +22 -2
  38. package/dist/cjs/core/types/chart/funnel.d.ts +25 -1
  39. package/dist/cjs/core/types/chart/tooltip.d.ts +6 -1
  40. package/dist/cjs/core/utils/data-labels.d.ts +34 -0
  41. package/dist/cjs/core/utils/data-labels.js +26 -0
  42. package/dist/cjs/core/utils/get-closest-data.d.ts +2 -2
  43. package/dist/cjs/core/utils/get-closest-data.js +14 -34
  44. package/dist/cjs/core/utils/tooltip-helpers.d.ts +16 -0
  45. package/dist/cjs/core/utils/tooltip-helpers.js +12 -0
  46. package/dist/cjs/hooks/useShapes/AnnotationLayer.d.ts +9 -0
  47. package/dist/cjs/hooks/useShapes/AnnotationLayer.js +17 -0
  48. package/dist/cjs/hooks/useShapes/HoverMarkerLayer.d.ts +10 -0
  49. package/dist/cjs/hooks/useShapes/HoverMarkerLayer.js +22 -0
  50. package/dist/cjs/hooks/useShapes/MarkerLayer.d.ts +7 -0
  51. package/dist/cjs/hooks/useShapes/MarkerLayer.js +12 -0
  52. package/dist/cjs/hooks/useShapes/SeriesShapes.d.ts +18 -0
  53. package/dist/cjs/hooks/useShapes/SeriesShapes.js +32 -0
  54. package/dist/cjs/hooks/useShapes/index.d.ts +5 -18
  55. package/dist/cjs/hooks/useShapes/index.js +39 -229
  56. package/dist/cjs/index.d.ts +0 -1
  57. package/dist/cjs/index.js +0 -1
  58. package/dist/cjs/plugins/area/index.js +42 -0
  59. package/dist/cjs/plugins/bar-x/index.js +42 -0
  60. package/dist/cjs/plugins/bar-y/index.js +26 -0
  61. package/dist/cjs/plugins/funnel/index.js +18 -0
  62. package/dist/cjs/plugins/funnel/prepare.js +17 -12
  63. package/dist/cjs/plugins/heatmap/index.js +23 -0
  64. package/dist/cjs/plugins/line/index.js +28 -0
  65. package/dist/cjs/plugins/pie/index.js +18 -0
  66. package/dist/cjs/plugins/radar/index.js +18 -0
  67. package/dist/cjs/plugins/sankey/index.js +18 -0
  68. package/dist/cjs/plugins/scatter/index.js +26 -0
  69. package/dist/cjs/plugins/treemap/index.js +18 -0
  70. package/dist/cjs/plugins/waterfall/index.js +39 -0
  71. package/dist/cjs/plugins/x-range/index.js +25 -0
  72. package/dist/cjs/setup-jsdom.d.ts +0 -1
  73. package/dist/cjs/setup-jsdom.js +1 -1
  74. package/dist/esm/components/ChartInner/useChartInnerHandlers.d.ts +3 -2
  75. package/dist/esm/components/ChartInner/useChartInnerHandlers.js +1 -3
  76. package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +3 -2
  77. package/dist/esm/components/ChartInner/useDefaultState.d.ts +3 -2
  78. package/dist/esm/components/index.d.ts +1 -0
  79. package/dist/esm/components/index.js +1 -0
  80. package/dist/esm/core/series/plugin.d.ts +47 -2
  81. package/dist/esm/core/series/types.d.ts +4 -0
  82. package/dist/esm/core/shapes/area/prepare-data.js +29 -19
  83. package/dist/esm/core/shapes/area/renderer.d.ts +0 -5
  84. package/dist/esm/core/shapes/area/renderer.js +0 -75
  85. package/dist/esm/core/shapes/area/types.d.ts +2 -8
  86. package/dist/esm/core/shapes/bar-x/prepare-data.js +18 -7
  87. package/dist/esm/core/shapes/bar-x/renderer.d.ts +0 -1
  88. package/dist/esm/core/shapes/bar-x/renderer.js +0 -18
  89. package/dist/esm/core/shapes/bar-x/types.d.ts +2 -1
  90. package/dist/esm/core/shapes/bar-y/get-tooltip-data.js +4 -2
  91. package/dist/esm/core/shapes/bar-y/prepare-data.js +8 -2
  92. package/dist/esm/core/shapes/funnel/prepare-data.js +121 -68
  93. package/dist/esm/core/shapes/heatmap/prepare-data.js +11 -2
  94. package/dist/esm/core/shapes/line/prepare-data.js +27 -17
  95. package/dist/esm/core/shapes/line/renderer.d.ts +0 -5
  96. package/dist/esm/core/shapes/line/renderer.js +0 -75
  97. package/dist/esm/core/shapes/line/types.d.ts +2 -8
  98. package/dist/esm/core/shapes/marker.d.ts +30 -0
  99. package/dist/esm/core/shapes/marker.js +68 -0
  100. package/dist/esm/core/shapes/pie/prepare-data.js +24 -9
  101. package/dist/esm/core/shapes/radar/prepare-data.js +3 -0
  102. package/dist/esm/core/shapes/sankey/prepare-data.js +10 -1
  103. package/dist/esm/core/shapes/scatter/prepare-data.js +8 -1
  104. package/dist/esm/core/shapes/scatter/renderer.js +3 -2
  105. package/dist/esm/core/shapes/scatter/types.d.ts +1 -1
  106. package/dist/esm/core/shapes/treemap/prepare-data.js +9 -1
  107. package/dist/esm/core/shapes/types.d.ts +35 -0
  108. package/dist/esm/core/shapes/waterfall/prepare-data.js +5 -2
  109. package/dist/esm/core/shapes/x-range/prepare-data.js +7 -2
  110. package/dist/esm/core/types/chart/base.d.ts +22 -2
  111. package/dist/esm/core/types/chart/funnel.d.ts +25 -1
  112. package/dist/esm/core/types/chart/tooltip.d.ts +6 -1
  113. package/dist/esm/core/utils/data-labels.d.ts +34 -0
  114. package/dist/esm/core/utils/data-labels.js +26 -0
  115. package/dist/esm/core/utils/get-closest-data.d.ts +2 -2
  116. package/dist/esm/core/utils/get-closest-data.js +14 -34
  117. package/dist/esm/core/utils/tooltip-helpers.d.ts +16 -0
  118. package/dist/esm/core/utils/tooltip-helpers.js +12 -0
  119. package/dist/esm/hooks/useShapes/AnnotationLayer.d.ts +9 -0
  120. package/dist/esm/hooks/useShapes/AnnotationLayer.js +17 -0
  121. package/dist/esm/hooks/useShapes/HoverMarkerLayer.d.ts +10 -0
  122. package/dist/esm/hooks/useShapes/HoverMarkerLayer.js +22 -0
  123. package/dist/esm/hooks/useShapes/MarkerLayer.d.ts +7 -0
  124. package/dist/esm/hooks/useShapes/MarkerLayer.js +12 -0
  125. package/dist/esm/hooks/useShapes/SeriesShapes.d.ts +18 -0
  126. package/dist/esm/hooks/useShapes/SeriesShapes.js +32 -0
  127. package/dist/esm/hooks/useShapes/index.d.ts +5 -18
  128. package/dist/esm/hooks/useShapes/index.js +39 -229
  129. package/dist/esm/index.d.ts +0 -1
  130. package/dist/esm/index.js +0 -1
  131. package/dist/esm/plugins/area/index.js +42 -0
  132. package/dist/esm/plugins/bar-x/index.js +42 -0
  133. package/dist/esm/plugins/bar-y/index.js +26 -0
  134. package/dist/esm/plugins/funnel/index.js +18 -0
  135. package/dist/esm/plugins/funnel/prepare.js +17 -12
  136. package/dist/esm/plugins/heatmap/index.js +23 -0
  137. package/dist/esm/plugins/line/index.js +28 -0
  138. package/dist/esm/plugins/pie/index.js +18 -0
  139. package/dist/esm/plugins/radar/index.js +18 -0
  140. package/dist/esm/plugins/sankey/index.js +18 -0
  141. package/dist/esm/plugins/scatter/index.js +26 -0
  142. package/dist/esm/plugins/treemap/index.js +18 -0
  143. package/dist/esm/plugins/waterfall/index.js +39 -0
  144. package/dist/esm/plugins/x-range/index.js +25 -0
  145. package/dist/esm/setup-jsdom.d.ts +0 -1
  146. package/dist/esm/setup-jsdom.js +1 -1
  147. package/package.json +2 -3
  148. package/dist/cjs/hooks/useShapes/area/index.d.ts +0 -15
  149. package/dist/cjs/hooks/useShapes/area/index.js +0 -52
  150. package/dist/cjs/hooks/useShapes/bar-x/index.d.ts +0 -16
  151. package/dist/cjs/hooks/useShapes/bar-x/index.js +0 -45
  152. package/dist/cjs/hooks/useShapes/bar-y/index.d.ts +0 -13
  153. package/dist/cjs/hooks/useShapes/bar-y/index.js +0 -19
  154. package/dist/cjs/hooks/useShapes/funnel/index.d.ts +0 -13
  155. package/dist/cjs/hooks/useShapes/funnel/index.js +0 -21
  156. package/dist/cjs/hooks/useShapes/heatmap/index.d.ts +0 -13
  157. package/dist/cjs/hooks/useShapes/heatmap/index.js +0 -20
  158. package/dist/cjs/hooks/useShapes/line/index.d.ts +0 -15
  159. package/dist/cjs/hooks/useShapes/line/index.js +0 -38
  160. package/dist/cjs/hooks/useShapes/pie/index.d.ts +0 -12
  161. package/dist/cjs/hooks/useShapes/pie/index.js +0 -20
  162. package/dist/cjs/hooks/useShapes/radar/index.d.ts +0 -12
  163. package/dist/cjs/hooks/useShapes/radar/index.js +0 -19
  164. package/dist/cjs/hooks/useShapes/sankey/index.d.ts +0 -12
  165. package/dist/cjs/hooks/useShapes/sankey/index.js +0 -18
  166. package/dist/cjs/hooks/useShapes/scatter/index.d.ts +0 -13
  167. package/dist/cjs/hooks/useShapes/scatter/index.js +0 -22
  168. package/dist/cjs/hooks/useShapes/treemap/index.d.ts +0 -12
  169. package/dist/cjs/hooks/useShapes/treemap/index.js +0 -18
  170. package/dist/cjs/hooks/useShapes/waterfall/index.d.ts +0 -14
  171. package/dist/cjs/hooks/useShapes/waterfall/index.js +0 -31
  172. package/dist/cjs/hooks/useShapes/x-range/index.d.ts +0 -14
  173. package/dist/cjs/hooks/useShapes/x-range/index.js +0 -20
  174. package/dist/esm/hooks/useShapes/area/index.d.ts +0 -15
  175. package/dist/esm/hooks/useShapes/area/index.js +0 -52
  176. package/dist/esm/hooks/useShapes/bar-x/index.d.ts +0 -16
  177. package/dist/esm/hooks/useShapes/bar-x/index.js +0 -45
  178. package/dist/esm/hooks/useShapes/bar-y/index.d.ts +0 -13
  179. package/dist/esm/hooks/useShapes/bar-y/index.js +0 -19
  180. package/dist/esm/hooks/useShapes/funnel/index.d.ts +0 -13
  181. package/dist/esm/hooks/useShapes/funnel/index.js +0 -21
  182. package/dist/esm/hooks/useShapes/heatmap/index.d.ts +0 -13
  183. package/dist/esm/hooks/useShapes/heatmap/index.js +0 -20
  184. package/dist/esm/hooks/useShapes/line/index.d.ts +0 -15
  185. package/dist/esm/hooks/useShapes/line/index.js +0 -38
  186. package/dist/esm/hooks/useShapes/pie/index.d.ts +0 -12
  187. package/dist/esm/hooks/useShapes/pie/index.js +0 -20
  188. package/dist/esm/hooks/useShapes/radar/index.d.ts +0 -12
  189. package/dist/esm/hooks/useShapes/radar/index.js +0 -19
  190. package/dist/esm/hooks/useShapes/sankey/index.d.ts +0 -12
  191. package/dist/esm/hooks/useShapes/sankey/index.js +0 -18
  192. package/dist/esm/hooks/useShapes/scatter/index.d.ts +0 -13
  193. package/dist/esm/hooks/useShapes/scatter/index.js +0 -22
  194. package/dist/esm/hooks/useShapes/treemap/index.d.ts +0 -12
  195. package/dist/esm/hooks/useShapes/treemap/index.js +0 -18
  196. package/dist/esm/hooks/useShapes/waterfall/index.d.ts +0 -14
  197. package/dist/esm/hooks/useShapes/waterfall/index.js +0 -31
  198. package/dist/esm/hooks/useShapes/x-range/index.d.ts +0 -14
  199. package/dist/esm/hooks/useShapes/x-range/index.js +0 -20
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { renderTreemap } from '../../../core/shapes/treemap/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- const b = block('treemap');
6
- export const TreemapSeriesShape = (props) => {
7
- const { dispatcher, preparedData, seriesOptions, htmlLayout } = props;
8
- const ref = React.useRef(null);
9
- React.useEffect(() => {
10
- if (!ref.current) {
11
- return () => { };
12
- }
13
- return renderTreemap({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
14
- }, [dispatcher, preparedData, seriesOptions]);
15
- return (React.createElement(React.Fragment, null,
16
- React.createElement("g", { ref: ref, className: b() }),
17
- React.createElement(HtmlLayer, { preparedData: { htmlElements: preparedData.htmlLabels }, htmlLayout: htmlLayout })));
18
- };
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedWaterfallData } from '../../../core/shapes/waterfall/types';
5
- export { prepareWaterfallData } from '../../../core/shapes/waterfall/prepare-data';
6
- export * from '../../../core/shapes/waterfall/types';
7
- type Args = {
8
- clipPathId: string;
9
- htmlLayout: HTMLElement | null;
10
- preparedData: PreparedWaterfallData[];
11
- seriesOptions: PreparedSeriesOptions;
12
- dispatcher?: Dispatch<object>;
13
- };
14
- export declare const WaterfallSeriesShapes: (args: Args) => React.JSX.Element;
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- import { renderWaterfall } from '../../../core/shapes/waterfall/renderer';
3
- import { filterOverlappingLabels } from '../../../core/utils';
4
- import { block } from '../../../utils';
5
- import { HtmlLayer } from '../HtmlLayer';
6
- export { prepareWaterfallData } from '../../../core/shapes/waterfall/prepare-data';
7
- export * from '../../../core/shapes/waterfall/types';
8
- const b = block('waterfall');
9
- export const WaterfallSeriesShapes = (args) => {
10
- const { dispatcher, preparedData, seriesOptions, htmlLayout, clipPathId } = args;
11
- const ref = React.useRef(null);
12
- const allowOverlapDataLabels = React.useMemo(() => {
13
- return preparedData.some((d) => d === null || d === void 0 ? void 0 : d.series.dataLabels.allowOverlap);
14
- }, [preparedData]);
15
- React.useEffect(() => {
16
- if (!ref.current) {
17
- return () => { };
18
- }
19
- return renderWaterfall({ plot: ref.current }, preparedData, seriesOptions, allowOverlapDataLabels, dispatcher);
20
- }, [allowOverlapDataLabels, dispatcher, preparedData, seriesOptions]);
21
- const htmlLayerData = React.useMemo(() => {
22
- const items = preparedData.map((d) => d === null || d === void 0 ? void 0 : d.htmlLabels).flat();
23
- if (allowOverlapDataLabels) {
24
- return { htmlElements: items };
25
- }
26
- return { htmlElements: filterOverlappingLabels(items) };
27
- }, [allowOverlapDataLabels, preparedData]);
28
- return (React.createElement(React.Fragment, null,
29
- React.createElement("g", { ref: ref, className: b(), clipPath: `url(#${clipPathId})` }),
30
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
31
- };
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedXRangeData } from '../../../core/shapes/x-range/types';
5
- export { prepareXRangeData } from '../../../core/shapes/x-range/prepare-data';
6
- export type { PreparedXRangeData } from '../../../core/shapes/x-range/types';
7
- type Args = {
8
- clipPathId: string;
9
- htmlLayout: HTMLElement | null;
10
- preparedData: PreparedXRangeData[];
11
- seriesOptions: PreparedSeriesOptions;
12
- dispatcher?: Dispatch<object>;
13
- };
14
- export declare function XRangeSeriesShapes(args: Args): React.JSX.Element;
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { renderXRange } from '../../../core/shapes/x-range/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- export { prepareXRangeData } from '../../../core/shapes/x-range/prepare-data';
6
- const b = block('x-range');
7
- export function XRangeSeriesShapes(args) {
8
- const { dispatcher, preparedData, seriesOptions, htmlLayout, clipPathId } = args;
9
- const ref = React.useRef(null);
10
- React.useEffect(() => {
11
- if (!ref.current) {
12
- return () => { };
13
- }
14
- return renderXRange({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
15
- }, [dispatcher, preparedData, seriesOptions]);
16
- const htmlLayerData = React.useMemo(() => ({ htmlElements: preparedData.flatMap((d) => d.htmlLabels) }), [preparedData]);
17
- return (React.createElement(React.Fragment, null,
18
- React.createElement("g", { ref: ref, className: b(), clipPath: `url(#${clipPathId})` }),
19
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
20
- }
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedAreaData } from '../../../core/shapes/area/types';
5
- type Args = {
6
- boundsHeight: number;
7
- boundsWidth: number;
8
- clipPathId: string;
9
- htmlLayout: HTMLElement | null;
10
- preparedData: PreparedAreaData[];
11
- seriesOptions: PreparedSeriesOptions;
12
- dispatcher?: Dispatch<object>;
13
- };
14
- export declare const AreaSeriesShapes: (args: Args) => React.JSX.Element;
15
- export {};
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import { renderArea } from '../../../core/shapes/area/renderer';
3
- import { filterOverlappingLabels } from '../../../core/utils';
4
- import { block } from '../../../utils';
5
- import { HtmlLayer } from '../HtmlLayer';
6
- const b = block('area');
7
- export const AreaSeriesShapes = (args) => {
8
- const { boundsHeight, boundsWidth, dispatcher, preparedData, seriesOptions, htmlLayout, clipPathId, } = args;
9
- const plotRef = React.useRef(null);
10
- const markersRef = React.useRef(null);
11
- const hoverMarkersRef = React.useRef(null);
12
- const annotationsRef = React.useRef(null);
13
- const allowOverlapDataLabels = React.useMemo(() => {
14
- return preparedData.some((d) => d === null || d === void 0 ? void 0 : d.series.dataLabels.allowOverlap);
15
- }, [preparedData]);
16
- React.useEffect(() => {
17
- if (!plotRef.current ||
18
- !markersRef.current ||
19
- !hoverMarkersRef.current ||
20
- !annotationsRef.current) {
21
- return () => { };
22
- }
23
- return renderArea({
24
- plot: plotRef.current,
25
- markers: markersRef.current,
26
- hoverMarkers: hoverMarkersRef.current,
27
- annotations: annotationsRef.current,
28
- boundsWidth,
29
- boundsHeight,
30
- }, preparedData, seriesOptions, allowOverlapDataLabels, dispatcher);
31
- }, [
32
- allowOverlapDataLabels,
33
- boundsHeight,
34
- boundsWidth,
35
- dispatcher,
36
- preparedData,
37
- seriesOptions,
38
- ]);
39
- const htmlLayerData = React.useMemo(() => {
40
- const items = preparedData.map((d) => d === null || d === void 0 ? void 0 : d.htmlLabels).flat();
41
- if (allowOverlapDataLabels) {
42
- return { htmlElements: items };
43
- }
44
- return { htmlElements: filterOverlappingLabels(items) };
45
- }, [allowOverlapDataLabels, preparedData]);
46
- return (React.createElement(React.Fragment, null,
47
- React.createElement("g", { ref: plotRef, className: b(), clipPath: `url(#${clipPathId})` }),
48
- React.createElement("g", { ref: markersRef }),
49
- React.createElement("g", { ref: hoverMarkersRef }),
50
- React.createElement("g", { ref: annotationsRef }),
51
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
52
- };
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedBarXData } from '../../../core/shapes/bar-x/types';
5
- export { prepareBarXData } from '../../../core/shapes/bar-x/prepare-data';
6
- export * from '../../../core/shapes/bar-x/types';
7
- type Args = {
8
- boundsHeight: number;
9
- boundsWidth: number;
10
- clipPathId: string;
11
- htmlLayout: HTMLElement | null;
12
- preparedData: PreparedBarXData[];
13
- seriesOptions: PreparedSeriesOptions;
14
- dispatcher?: Dispatch<object>;
15
- };
16
- export declare const BarXSeriesShapes: (args: Args) => React.JSX.Element;
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import { renderBarX } from '../../../core/shapes/bar-x/renderer';
3
- import { filterOverlappingLabels } from '../../../core/utils';
4
- import { block } from '../../../utils';
5
- import { HtmlLayer } from '../HtmlLayer';
6
- export { prepareBarXData } from '../../../core/shapes/bar-x/prepare-data';
7
- export * from '../../../core/shapes/bar-x/types';
8
- const b = block('bar-x');
9
- export const BarXSeriesShapes = (args) => {
10
- const { boundsHeight, boundsWidth, dispatcher, preparedData, seriesOptions, htmlLayout, clipPathId, } = args;
11
- const ref = React.useRef(null);
12
- const annotationsRef = React.useRef(null);
13
- const allowOverlapDataLabels = React.useMemo(() => {
14
- return preparedData.some((d) => d === null || d === void 0 ? void 0 : d.series.dataLabels.allowOverlap);
15
- }, [preparedData]);
16
- React.useEffect(() => {
17
- if (!ref.current || !annotationsRef.current) {
18
- return () => { };
19
- }
20
- return renderBarX({
21
- plot: ref.current,
22
- annotations: annotationsRef.current,
23
- boundsWidth,
24
- boundsHeight,
25
- }, preparedData, seriesOptions, allowOverlapDataLabels, dispatcher);
26
- }, [
27
- allowOverlapDataLabels,
28
- boundsHeight,
29
- boundsWidth,
30
- dispatcher,
31
- preparedData,
32
- seriesOptions,
33
- ]);
34
- const htmlLayerData = React.useMemo(() => {
35
- const items = preparedData.map((d) => d === null || d === void 0 ? void 0 : d.htmlLabels).flat();
36
- if (allowOverlapDataLabels) {
37
- return { htmlElements: items };
38
- }
39
- return { htmlElements: filterOverlappingLabels(items) };
40
- }, [allowOverlapDataLabels, preparedData]);
41
- return (React.createElement(React.Fragment, null,
42
- React.createElement("g", { ref: ref, className: b(), clipPath: `url(#${clipPathId})` }),
43
- React.createElement("g", { ref: annotationsRef }),
44
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
45
- };
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { BarYShapesArgs } from '../../../core/shapes/bar-y/types';
5
- export { prepareBarYData } from '../../../core/shapes/bar-y/prepare-data';
6
- type Args = {
7
- clipPathId: string;
8
- htmlLayout: HTMLElement | null;
9
- preparedData: BarYShapesArgs;
10
- seriesOptions: PreparedSeriesOptions;
11
- dispatcher?: Dispatch<object>;
12
- };
13
- export declare function BarYSeriesShapes(args: Args): React.JSX.Element;
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { renderBarY } from '../../../core/shapes/bar-y/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- export { prepareBarYData } from '../../../core/shapes/bar-y/prepare-data';
6
- const b = block('bar-y');
7
- export function BarYSeriesShapes(args) {
8
- const { dispatcher, preparedData: { htmlLabels: htmlElements }, seriesOptions, htmlLayout, clipPathId, } = args;
9
- const ref = React.useRef(null);
10
- React.useEffect(() => {
11
- if (!ref.current) {
12
- return () => { };
13
- }
14
- return renderBarY({ plot: ref.current }, args.preparedData, seriesOptions, dispatcher);
15
- }, [args.preparedData, dispatcher, seriesOptions]);
16
- return (React.createElement(React.Fragment, null,
17
- React.createElement("g", { ref: ref, className: b(), clipPath: `url(#${clipPathId})` }),
18
- React.createElement(HtmlLayer, { preparedData: { htmlElements }, htmlLayout: htmlLayout })));
19
- }
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedFunnelData } from '../../../core/shapes/funnel/types';
5
- export { prepareFunnelData } from '../../../core/shapes/funnel/prepare-data';
6
- export * from '../../../core/shapes/funnel/types';
7
- type Args = {
8
- dispatcher?: Dispatch<object>;
9
- preparedData: PreparedFunnelData;
10
- seriesOptions: PreparedSeriesOptions;
11
- htmlLayout: HTMLElement | null;
12
- };
13
- export declare const FunnelSeriesShapes: (args: Args) => React.JSX.Element;
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { renderFunnel } from '../../../core/shapes/funnel/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- export { prepareFunnelData } from '../../../core/shapes/funnel/prepare-data';
6
- export * from '../../../core/shapes/funnel/types';
7
- const b = block('funnel');
8
- export const FunnelSeriesShapes = (args) => {
9
- const { dispatcher, htmlLayout, preparedData, seriesOptions } = args;
10
- const ref = React.useRef(null);
11
- React.useEffect(() => {
12
- if (!ref.current) {
13
- return () => { };
14
- }
15
- return renderFunnel({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
16
- }, [dispatcher, preparedData, seriesOptions]);
17
- const htmlLayerData = React.useMemo(() => ({ htmlElements: preparedData.htmlLabels }), [preparedData.htmlLabels]);
18
- return (React.createElement(React.Fragment, null,
19
- React.createElement("g", { ref: ref, className: b() }),
20
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
21
- };
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedHeatmapData } from '../../../core/shapes/heatmap/types';
5
- export { prepareHeatmapData } from '../../../core/shapes/heatmap/prepare-data';
6
- export * from '../../../core/shapes/heatmap/types';
7
- type Args = {
8
- htmlLayout: HTMLElement | null;
9
- preparedData: PreparedHeatmapData;
10
- seriesOptions: PreparedSeriesOptions;
11
- dispatcher?: Dispatch<object>;
12
- };
13
- export declare const HeatmapSeriesShapes: (args: Args) => React.JSX.Element;
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { renderHeatmap } from '../../../core/shapes/heatmap/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- export { prepareHeatmapData } from '../../../core/shapes/heatmap/prepare-data';
6
- export * from '../../../core/shapes/heatmap/types';
7
- const b = block('heatmap');
8
- export const HeatmapSeriesShapes = (args) => {
9
- const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
10
- const ref = React.useRef(null);
11
- React.useEffect(() => {
12
- if (!ref.current) {
13
- return () => { };
14
- }
15
- return renderHeatmap({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
16
- }, [dispatcher, preparedData, seriesOptions]);
17
- return (React.createElement(React.Fragment, null,
18
- React.createElement("g", { ref: ref, className: b() }),
19
- React.createElement(HtmlLayer, { preparedData: { htmlElements: preparedData.htmlLabels }, htmlLayout: htmlLayout })));
20
- };
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedLineData } from '../../../core/shapes/line/types';
5
- type Args = {
6
- boundsHeight: number;
7
- boundsWidth: number;
8
- clipPathId: string;
9
- htmlLayout: HTMLElement | null;
10
- preparedData: PreparedLineData[];
11
- seriesOptions: PreparedSeriesOptions;
12
- dispatcher?: Dispatch<object>;
13
- };
14
- export declare const LineSeriesShapes: (args: Args) => React.JSX.Element;
15
- export {};
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import { renderLine } from '../../../core/shapes/line/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- const b = block('line');
6
- export const LineSeriesShapes = (args) => {
7
- const { boundsHeight, boundsWidth, dispatcher, preparedData, seriesOptions, htmlLayout, clipPathId, } = args;
8
- const plotRef = React.useRef(null);
9
- const markersRef = React.useRef(null);
10
- const hoverMarkersRef = React.useRef(null);
11
- const annotationsRef = React.useRef(null);
12
- React.useEffect(() => {
13
- if (!plotRef.current ||
14
- !markersRef.current ||
15
- !hoverMarkersRef.current ||
16
- !annotationsRef.current) {
17
- return () => { };
18
- }
19
- return renderLine({
20
- plot: plotRef.current,
21
- markers: markersRef.current,
22
- hoverMarkers: hoverMarkersRef.current,
23
- annotations: annotationsRef.current,
24
- boundsWidth,
25
- boundsHeight,
26
- }, preparedData, seriesOptions, dispatcher);
27
- }, [boundsHeight, boundsWidth, dispatcher, preparedData, seriesOptions]);
28
- const htmlLayerData = React.useMemo(() => {
29
- const items = preparedData.flatMap((d) => d.htmlLabels);
30
- return { htmlElements: items };
31
- }, [preparedData]);
32
- return (React.createElement(React.Fragment, null,
33
- React.createElement("g", { ref: plotRef, className: b(), clipPath: `url(#${clipPathId})` }),
34
- React.createElement("g", { ref: markersRef }),
35
- React.createElement("g", { ref: hoverMarkersRef }),
36
- React.createElement("g", { ref: annotationsRef }),
37
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
38
- };
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedPieData } from '../../../core/shapes/pie/types';
5
- export { getHaloVisibility } from '../../../core/shapes/pie/renderer';
6
- type PreparePieSeriesArgs = {
7
- htmlLayout: HTMLElement | null;
8
- preparedData: PreparedPieData[];
9
- seriesOptions: PreparedSeriesOptions;
10
- dispatcher?: Dispatch<object>;
11
- };
12
- export declare function PieSeriesShapes(args: PreparePieSeriesArgs): React.JSX.Element;
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { renderPie } from '../../../core/shapes/pie/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- export { getHaloVisibility } from '../../../core/shapes/pie/renderer';
6
- const b = block('pie');
7
- export function PieSeriesShapes(args) {
8
- const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
9
- const ref = React.useRef(null);
10
- React.useEffect(() => {
11
- if (!ref.current) {
12
- return () => { };
13
- }
14
- return renderPie({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
15
- }, [dispatcher, preparedData, seriesOptions]);
16
- const htmlElements = preparedData.map((d) => d.htmlLabels).flat();
17
- return (React.createElement(React.Fragment, null,
18
- React.createElement("g", { ref: ref, className: b(), style: { zIndex: 9 } }),
19
- React.createElement(HtmlLayer, { preparedData: { htmlElements }, htmlLayout: htmlLayout })));
20
- }
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedRadarData } from '../../../core/shapes/radar/types';
5
- type PrepareRadarSeriesArgs = {
6
- htmlLayout: HTMLElement | null;
7
- series: PreparedRadarData[];
8
- seriesOptions: PreparedSeriesOptions;
9
- dispatcher?: Dispatch<object>;
10
- };
11
- export declare function RadarSeriesShapes(args: PrepareRadarSeriesArgs): React.JSX.Element;
12
- export {};
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { renderRadar } from '../../../core/shapes/radar/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- const b = block('radar');
6
- export function RadarSeriesShapes(args) {
7
- const { dispatcher, series: preparedData, seriesOptions, htmlLayout } = args;
8
- const ref = React.useRef(null);
9
- React.useEffect(() => {
10
- if (!ref.current) {
11
- return () => { };
12
- }
13
- return renderRadar({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
14
- }, [dispatcher, preparedData, seriesOptions]);
15
- const htmlElements = preparedData.map((d) => d.htmlLabels).flat();
16
- return (React.createElement(React.Fragment, null,
17
- React.createElement("g", { ref: ref, className: b() }),
18
- React.createElement(HtmlLayer, { preparedData: { htmlElements }, htmlLayout: htmlLayout })));
19
- }
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedSankeyData } from '../../../core/shapes/sankey/types';
5
- type ShapeProps = {
6
- htmlLayout: HTMLElement | null;
7
- preparedData: PreparedSankeyData;
8
- seriesOptions: PreparedSeriesOptions;
9
- dispatcher?: Dispatch<object>;
10
- };
11
- export declare const SankeySeriesShape: (props: ShapeProps) => React.JSX.Element;
12
- export {};
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { renderSankey } from '../../../core/shapes/sankey/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- const b = block('sankey');
6
- export const SankeySeriesShape = (props) => {
7
- const { dispatcher, preparedData, seriesOptions, htmlLayout } = props;
8
- const ref = React.useRef(null);
9
- React.useEffect(() => {
10
- if (!ref.current) {
11
- return () => { };
12
- }
13
- return renderSankey({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
14
- }, [dispatcher, preparedData, seriesOptions]);
15
- return (React.createElement(React.Fragment, null,
16
- React.createElement("g", { ref: ref, className: b() }),
17
- React.createElement(HtmlLayer, { preparedData: { htmlElements: preparedData.htmlLabels }, htmlLayout: htmlLayout })));
18
- };
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedScatterShapeData } from '../../../core/shapes/scatter/types';
5
- export { prepareScatterData } from '../../../core/shapes/scatter/prepare-data';
6
- type ScatterSeriesShapeProps = {
7
- htmlLayout: HTMLElement | null;
8
- preparedData: PreparedScatterShapeData;
9
- seriesOptions: PreparedSeriesOptions;
10
- clipPathId?: string;
11
- dispatcher?: Dispatch<object>;
12
- };
13
- export declare function ScatterSeriesShape(props: ScatterSeriesShapeProps): React.JSX.Element;
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import { renderScatter } from '../../../core/shapes/scatter/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- export { prepareScatterData } from '../../../core/shapes/scatter/prepare-data';
6
- const b = block('scatter');
7
- export function ScatterSeriesShape(props) {
8
- const { clipPathId, dispatcher, preparedData, seriesOptions, htmlLayout } = props;
9
- const ref = React.useRef(null);
10
- React.useEffect(() => {
11
- if (!ref.current) {
12
- return () => { };
13
- }
14
- return renderScatter({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
15
- }, [dispatcher, preparedData, seriesOptions]);
16
- const htmlLayerData = React.useMemo(() => {
17
- return { htmlElements: preparedData.htmlLabels };
18
- }, [preparedData]);
19
- return (React.createElement(React.Fragment, null,
20
- React.createElement("g", { ref: ref, className: b(), clipPath: clipPathId ? `url(#${clipPathId})` : undefined }),
21
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
22
- }
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedTreemapData } from '../../../core/shapes/treemap/types';
5
- type ShapeProps = {
6
- htmlLayout: HTMLElement | null;
7
- preparedData: PreparedTreemapData;
8
- seriesOptions: PreparedSeriesOptions;
9
- dispatcher?: Dispatch<object>;
10
- };
11
- export declare const TreemapSeriesShape: (props: ShapeProps) => React.JSX.Element;
12
- export {};
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { renderTreemap } from '../../../core/shapes/treemap/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- const b = block('treemap');
6
- export const TreemapSeriesShape = (props) => {
7
- const { dispatcher, preparedData, seriesOptions, htmlLayout } = props;
8
- const ref = React.useRef(null);
9
- React.useEffect(() => {
10
- if (!ref.current) {
11
- return () => { };
12
- }
13
- return renderTreemap({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
14
- }, [dispatcher, preparedData, seriesOptions]);
15
- return (React.createElement(React.Fragment, null,
16
- React.createElement("g", { ref: ref, className: b() }),
17
- React.createElement(HtmlLayer, { preparedData: { htmlElements: preparedData.htmlLabels }, htmlLayout: htmlLayout })));
18
- };
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedWaterfallData } from '../../../core/shapes/waterfall/types';
5
- export { prepareWaterfallData } from '../../../core/shapes/waterfall/prepare-data';
6
- export * from '../../../core/shapes/waterfall/types';
7
- type Args = {
8
- clipPathId: string;
9
- htmlLayout: HTMLElement | null;
10
- preparedData: PreparedWaterfallData[];
11
- seriesOptions: PreparedSeriesOptions;
12
- dispatcher?: Dispatch<object>;
13
- };
14
- export declare const WaterfallSeriesShapes: (args: Args) => React.JSX.Element;
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- import { renderWaterfall } from '../../../core/shapes/waterfall/renderer';
3
- import { filterOverlappingLabels } from '../../../core/utils';
4
- import { block } from '../../../utils';
5
- import { HtmlLayer } from '../HtmlLayer';
6
- export { prepareWaterfallData } from '../../../core/shapes/waterfall/prepare-data';
7
- export * from '../../../core/shapes/waterfall/types';
8
- const b = block('waterfall');
9
- export const WaterfallSeriesShapes = (args) => {
10
- const { dispatcher, preparedData, seriesOptions, htmlLayout, clipPathId } = args;
11
- const ref = React.useRef(null);
12
- const allowOverlapDataLabels = React.useMemo(() => {
13
- return preparedData.some((d) => d === null || d === void 0 ? void 0 : d.series.dataLabels.allowOverlap);
14
- }, [preparedData]);
15
- React.useEffect(() => {
16
- if (!ref.current) {
17
- return () => { };
18
- }
19
- return renderWaterfall({ plot: ref.current }, preparedData, seriesOptions, allowOverlapDataLabels, dispatcher);
20
- }, [allowOverlapDataLabels, dispatcher, preparedData, seriesOptions]);
21
- const htmlLayerData = React.useMemo(() => {
22
- const items = preparedData.map((d) => d === null || d === void 0 ? void 0 : d.htmlLabels).flat();
23
- if (allowOverlapDataLabels) {
24
- return { htmlElements: items };
25
- }
26
- return { htmlElements: filterOverlappingLabels(items) };
27
- }, [allowOverlapDataLabels, preparedData]);
28
- return (React.createElement(React.Fragment, null,
29
- React.createElement("g", { ref: ref, className: b(), clipPath: `url(#${clipPathId})` }),
30
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
31
- };
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedXRangeData } from '../../../core/shapes/x-range/types';
5
- export { prepareXRangeData } from '../../../core/shapes/x-range/prepare-data';
6
- export type { PreparedXRangeData } from '../../../core/shapes/x-range/types';
7
- type Args = {
8
- clipPathId: string;
9
- htmlLayout: HTMLElement | null;
10
- preparedData: PreparedXRangeData[];
11
- seriesOptions: PreparedSeriesOptions;
12
- dispatcher?: Dispatch<object>;
13
- };
14
- export declare function XRangeSeriesShapes(args: Args): React.JSX.Element;