@aura-react-comp/charts 0.2.0 → 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 (98) hide show
  1. package/esm/charts/area-chart/index.d.ts +2 -2
  2. package/esm/charts/area-chart/index.js +28 -23
  3. package/esm/charts/bar-chart/index.d.ts +1 -1
  4. package/esm/charts/bar-chart/index.js +18 -21
  5. package/esm/charts/candlestick-chart/index.d.ts +2 -2
  6. package/esm/charts/candlestick-chart/index.js +243 -180
  7. package/esm/charts/combo-chart/index.d.ts +1 -1
  8. package/esm/charts/combo-chart/index.js +9 -20
  9. package/esm/charts/funnel-chart/index.d.ts +2 -2
  10. package/esm/charts/funnel-chart/index.js +134 -108
  11. package/esm/charts/gauge-chart/index.d.ts +1 -1
  12. package/esm/charts/gauge-chart/index.js +103 -105
  13. package/esm/charts/graph-chart/index.d.ts +3 -3
  14. package/esm/charts/graph-chart/index.js +155 -114
  15. package/esm/charts/heatmap-chart/index.d.ts +2 -2
  16. package/esm/charts/heatmap-chart/index.js +180 -135
  17. package/esm/charts/line-chart/index.d.ts +2 -2
  18. package/esm/charts/line-chart/index.js +29 -24
  19. package/esm/charts/pie-chart/index.d.ts +2 -2
  20. package/esm/charts/pie-chart/index.d.ts.map +1 -1
  21. package/esm/charts/pie-chart/index.js +199 -139
  22. package/esm/charts/radar-chart/index.d.ts +2 -2
  23. package/esm/charts/radar-chart/index.d.ts.map +1 -1
  24. package/esm/charts/radar-chart/index.js +155 -128
  25. package/esm/charts/ring-progress/index.d.ts +1 -1
  26. package/esm/charts/ring-progress/index.js +82 -82
  27. package/esm/charts/sankey-chart/index.d.ts +3 -3
  28. package/esm/charts/sankey-chart/index.js +172 -141
  29. package/esm/charts/scatter-chart/index.d.ts +3 -3
  30. package/esm/charts/scatter-chart/index.d.ts.map +1 -1
  31. package/esm/charts/scatter-chart/index.js +226 -159
  32. package/esm/charts/sparkline/index.d.ts +1 -1
  33. package/esm/charts/sparkline/index.js +82 -66
  34. package/esm/charts/tree-chart/index.d.ts +3 -3
  35. package/esm/charts/tree-chart/index.js +129 -102
  36. package/esm/charts/treemap-chart/index.d.ts +3 -3
  37. package/esm/charts/treemap-chart/index.js +163 -141
  38. package/esm/charts/waterfall-chart/index.d.ts +2 -2
  39. package/esm/charts/waterfall-chart/index.js +166 -121
  40. package/esm/components/Legend.d.ts +5 -4
  41. package/esm/components/Legend.d.ts.map +1 -1
  42. package/esm/components/Legend.js +80 -48
  43. package/esm/components/Tooltip.d.ts +2 -2
  44. package/esm/components/Tooltip.js +63 -71
  45. package/esm/components/chart/index.d.ts +5 -2
  46. package/esm/components/chart/index.d.ts.map +1 -1
  47. package/esm/components/chart/index.js +81 -102
  48. package/esm/components/chart.less +13 -0
  49. package/esm/core/animation.js +32 -43
  50. package/esm/core/export.d.ts +34 -0
  51. package/esm/core/export.d.ts.map +1 -0
  52. package/esm/core/export.js +390 -0
  53. package/esm/core/force.js +23 -45
  54. package/esm/core/format.js +49 -52
  55. package/esm/core/hierarchy.d.ts +1 -1
  56. package/esm/core/hierarchy.js +61 -92
  57. package/esm/core/layout.d.ts +1 -1
  58. package/esm/core/layout.js +33 -50
  59. package/esm/core/sampling.js +31 -53
  60. package/esm/core/sankey.js +36 -55
  61. package/esm/core/scale.js +73 -86
  62. package/esm/core/shape.js +102 -133
  63. package/esm/core/sync.d.ts +41 -0
  64. package/esm/core/sync.d.ts.map +1 -0
  65. package/esm/core/sync.js +120 -0
  66. package/esm/hooks/useChartExport.d.ts +19 -0
  67. package/esm/hooks/useChartExport.d.ts.map +1 -0
  68. package/esm/hooks/useChartExport.js +35 -0
  69. package/esm/hooks/useChartTheme.d.ts +6 -5
  70. package/esm/hooks/useChartTheme.d.ts.map +1 -1
  71. package/esm/hooks/useChartTheme.js +18 -18
  72. package/esm/hooks/useChartTransition.d.ts +1 -1
  73. package/esm/hooks/useChartTransition.js +59 -73
  74. package/esm/hooks/useElementSize.js +20 -28
  75. package/esm/hooks/usePlotPointer.d.ts +23 -0
  76. package/esm/hooks/usePlotPointer.d.ts.map +1 -0
  77. package/esm/hooks/usePlotPointer.js +94 -0
  78. package/esm/index.d.ts +56 -50
  79. package/esm/index.d.ts.map +1 -1
  80. package/esm/index.js +137 -47
  81. package/esm/internal/CartesianChart.d.ts +1 -1
  82. package/esm/internal/CartesianChart.d.ts.map +1 -1
  83. package/esm/internal/CartesianChart.js +667 -485
  84. package/esm/internal/model.d.ts +2 -2
  85. package/esm/internal/model.js +45 -60
  86. package/esm/scene/canvas.d.ts +1 -1
  87. package/esm/scene/canvas.js +101 -107
  88. package/esm/scene/svg.d.ts +1 -1
  89. package/esm/scene/svg.js +107 -99
  90. package/esm/scene/types.js +9 -15
  91. package/esm/style.css +10 -0
  92. package/esm/theme/index.d.ts +2 -2
  93. package/esm/theme/index.d.ts.map +1 -1
  94. package/esm/theme/index.js +145 -170
  95. package/esm/types.d.ts +7 -3
  96. package/esm/types.d.ts.map +1 -1
  97. package/esm/types.js +1 -1
  98. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import type { BaseChartProps } from '../../types';
3
- import type { CurveType } from '../../core/shape';
2
+ import type { BaseChartProps } from '../../types.js';
3
+ import type { CurveType } from '../../core/shape.js';
4
4
  export interface AreaChartProps extends BaseChartProps {
5
5
  curve?: CurveType;
6
6
  smooth?: boolean;
@@ -1,30 +1,35 @@
1
- import React, { useMemo } from 'react';
1
+ 'use client';
2
+ // src/charts/area-chart/index.tsx
3
+ import { useMemo } from "react";
2
4
  import { CartesianChart } from "../../internal/CartesianChart";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- /**
5
- * 面积图。
6
- *
7
- * 单系列面积图用来强调「量级」,多系列时**必须**开 stack,
8
- * 否则后画的系列会遮住前面的 —— 这是面积图最常见的误用。
9
- */
10
- export function AreaChart({
11
- curve = 'monotone',
5
+ import { jsx } from "react/jsx-runtime";
6
+ function AreaChart({
7
+ curve = "monotone",
12
8
  smooth = false,
13
9
  stack = false,
14
10
  areaOpacity,
15
11
  series,
16
12
  ...rest
17
13
  }) {
18
- const merged = useMemo(() => (series ?? []).map(item => ({
19
- type: 'area',
20
- curve: smooth ? 'smooth' : curve,
21
- areaOpacity,
22
- ...item
23
- })), [series, smooth, curve, areaOpacity]);
24
- return /*#__PURE__*/_jsx(CartesianChart, {
25
- ...rest,
26
- series: merged,
27
- defaultType: "area",
28
- stack: stack
29
- });
30
- }
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,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { BaseChartProps } from '../../types';
2
+ import type { BaseChartProps } from '../../types.js';
3
3
  export interface BarChartProps extends BaseChartProps {
4
4
  /** 堆叠:同一 x 下的系列累加 */
5
5
  stack?: boolean;
@@ -1,27 +1,24 @@
1
- import React, { useMemo } from 'react';
1
+ 'use client';
2
+ // src/charts/bar-chart/index.tsx
3
+ import { useMemo } from "react";
2
4
  import { CartesianChart } from "../../internal/CartesianChart";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- /**
5
- * 柱状图。
6
- *
7
- * y 轴默认从 0 起(startFromZero),这是柱状图的硬性要求:
8
- * 柱子用「长度」编码数值,基线不在 0 会让长度比例失真。
9
- */
10
- export function BarChart({
5
+ import { jsx } from "react/jsx-runtime";
6
+ function BarChart({
11
7
  stack = false,
12
8
  barMaxWidth,
13
9
  series,
14
10
  ...rest
15
11
  }) {
16
- const merged = useMemo(() => (series ?? []).map(item => ({
17
- type: 'bar',
18
- barMaxWidth,
19
- ...item
20
- })), [series, barMaxWidth]);
21
- return /*#__PURE__*/_jsx(CartesianChart, {
22
- ...rest,
23
- series: merged,
24
- defaultType: "bar",
25
- stack: stack
26
- });
27
- }
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
+ };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { type ChartThemeInput } from '../../theme';
3
- import type { ChartAnimationInput, TooltipConfig } from '../../types';
2
+ import { type ChartThemeInput } from '../../theme/index.js';
3
+ import type { ChartAnimationInput, TooltipConfig } from '../../types.js';
4
4
  export interface CandlestickItem {
5
5
  /** 时间标签(交易日、周、月) */
6
6
  date: string;