@aura-react-comp/charts 0.3.1 → 0.4.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 (68) hide show
  1. package/esm/charts/area-chart/index.js +27 -23
  2. package/esm/charts/bar-chart/index.js +17 -21
  3. package/esm/charts/candlestick-chart/index.js +242 -180
  4. package/esm/charts/combo-chart/index.js +8 -20
  5. package/esm/charts/funnel-chart/index.js +133 -108
  6. package/esm/charts/gauge-chart/index.js +102 -105
  7. package/esm/charts/graph-chart/index.js +154 -114
  8. package/esm/charts/heatmap-chart/index.js +179 -135
  9. package/esm/charts/line-chart/index.js +28 -24
  10. package/esm/charts/pie-chart/index.d.ts.map +1 -1
  11. package/esm/charts/pie-chart/index.js +198 -139
  12. package/esm/charts/radar-chart/index.d.ts.map +1 -1
  13. package/esm/charts/radar-chart/index.js +154 -128
  14. package/esm/charts/ring-progress/index.js +81 -82
  15. package/esm/charts/sankey-chart/index.js +171 -141
  16. package/esm/charts/scatter-chart/index.d.ts.map +1 -1
  17. package/esm/charts/scatter-chart/index.js +225 -159
  18. package/esm/charts/sparkline/index.js +81 -66
  19. package/esm/charts/tree-chart/index.js +128 -102
  20. package/esm/charts/treemap-chart/index.js +162 -141
  21. package/esm/charts/waterfall-chart/index.js +165 -121
  22. package/esm/components/Legend.d.ts +3 -2
  23. package/esm/components/Legend.d.ts.map +1 -1
  24. package/esm/components/Legend.js +79 -48
  25. package/esm/components/Tooltip.js +62 -71
  26. package/esm/components/chart/index.d.ts +4 -1
  27. package/esm/components/chart/index.d.ts.map +1 -1
  28. package/esm/components/chart/index.js +80 -102
  29. package/esm/components/chart.less +13 -0
  30. package/esm/core/animation.js +31 -43
  31. package/esm/core/export.d.ts +34 -0
  32. package/esm/core/export.d.ts.map +1 -0
  33. package/esm/core/export.js +390 -0
  34. package/esm/core/force.js +22 -45
  35. package/esm/core/format.js +48 -52
  36. package/esm/core/hierarchy.js +60 -92
  37. package/esm/core/layout.js +32 -50
  38. package/esm/core/sampling.js +30 -53
  39. package/esm/core/sankey.js +35 -55
  40. package/esm/core/scale.js +72 -86
  41. package/esm/core/shape.js +101 -133
  42. package/esm/core/sync.d.ts +41 -0
  43. package/esm/core/sync.d.ts.map +1 -0
  44. package/esm/core/sync.js +120 -0
  45. package/esm/hooks/useChartExport.d.ts +19 -0
  46. package/esm/hooks/useChartExport.d.ts.map +1 -0
  47. package/esm/hooks/useChartExport.js +35 -0
  48. package/esm/hooks/useChartTheme.js +17 -19
  49. package/esm/hooks/useChartTransition.js +58 -73
  50. package/esm/hooks/useElementSize.js +19 -28
  51. package/esm/hooks/usePlotPointer.d.ts +23 -0
  52. package/esm/hooks/usePlotPointer.d.ts.map +1 -0
  53. package/esm/hooks/usePlotPointer.js +94 -0
  54. package/esm/index.d.ts +6 -0
  55. package/esm/index.d.ts.map +1 -1
  56. package/esm/index.js +136 -47
  57. package/esm/internal/CartesianChart.d.ts.map +1 -1
  58. package/esm/internal/CartesianChart.js +666 -485
  59. package/esm/internal/model.js +44 -60
  60. package/esm/scene/canvas.js +100 -107
  61. package/esm/scene/svg.js +106 -99
  62. package/esm/scene/types.js +8 -15
  63. package/esm/style.css +10 -0
  64. package/esm/theme/index.js +143 -171
  65. package/esm/types.d.ts +4 -0
  66. package/esm/types.d.ts.map +1 -1
  67. package/esm/types.js +0 -1
  68. package/package.json +1 -1
@@ -1,31 +1,35 @@
1
1
  'use client';
2
- import React, { useMemo } from 'react';
2
+ // src/charts/area-chart/index.tsx
3
+ import { useMemo } from "react";
3
4
  import { CartesianChart } from "../../internal/CartesianChart";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- /**
6
- * 面积图。
7
- *
8
- * 单系列面积图用来强调「量级」,多系列时**必须**开 stack,
9
- * 否则后画的系列会遮住前面的 —— 这是面积图最常见的误用。
10
- */
11
- export function AreaChart({
12
- curve = 'monotone',
5
+ import { jsx } from "react/jsx-runtime";
6
+ function AreaChart({
7
+ curve = "monotone",
13
8
  smooth = false,
14
9
  stack = false,
15
10
  areaOpacity,
16
11
  series,
17
12
  ...rest
18
13
  }) {
19
- const merged = useMemo(() => (series ?? []).map(item => ({
20
- type: 'area',
21
- curve: smooth ? 'smooth' : curve,
22
- areaOpacity,
23
- ...item
24
- })), [series, smooth, curve, areaOpacity]);
25
- return /*#__PURE__*/_jsx(CartesianChart, {
26
- ...rest,
27
- series: merged,
28
- defaultType: "area",
29
- stack: stack
30
- });
31
- }
14
+ const merged = useMemo(
15
+ () => (series ?? []).map((item) => ({
16
+ type: "area",
17
+ curve: smooth ? "smooth" : curve,
18
+ areaOpacity,
19
+ ...item
20
+ })),
21
+ [series, smooth, curve, areaOpacity]
22
+ );
23
+ return /* @__PURE__ */ jsx(
24
+ CartesianChart,
25
+ {
26
+ ...rest,
27
+ series: merged,
28
+ defaultType: "area",
29
+ stack
30
+ }
31
+ );
32
+ }
33
+ export {
34
+ AreaChart
35
+ };
@@ -1,28 +1,24 @@
1
1
  'use client';
2
- import React, { useMemo } from 'react';
2
+ // src/charts/bar-chart/index.tsx
3
+ import { useMemo } from "react";
3
4
  import { CartesianChart } from "../../internal/CartesianChart";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- /**
6
- * 柱状图。
7
- *
8
- * y 轴默认从 0 起(startFromZero),这是柱状图的硬性要求:
9
- * 柱子用「长度」编码数值,基线不在 0 会让长度比例失真。
10
- */
11
- export function BarChart({
5
+ import { jsx } from "react/jsx-runtime";
6
+ function BarChart({
12
7
  stack = false,
13
8
  barMaxWidth,
14
9
  series,
15
10
  ...rest
16
11
  }) {
17
- const merged = useMemo(() => (series ?? []).map(item => ({
18
- type: 'bar',
19
- barMaxWidth,
20
- ...item
21
- })), [series, barMaxWidth]);
22
- return /*#__PURE__*/_jsx(CartesianChart, {
23
- ...rest,
24
- series: merged,
25
- defaultType: "bar",
26
- stack: stack
27
- });
28
- }
12
+ const merged = useMemo(
13
+ () => (series ?? []).map((item) => ({
14
+ type: "bar",
15
+ barMaxWidth,
16
+ ...item
17
+ })),
18
+ [series, barMaxWidth]
19
+ );
20
+ return /* @__PURE__ */ jsx(CartesianChart, { ...rest, series: merged, defaultType: "bar", stack });
21
+ }
22
+ export {
23
+ BarChart
24
+ };