@uniai-fe/ui-legacy 0.1.5 → 0.1.7
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/README.md +3 -1
- package/package.json +37 -38
- package/src/button/index.tsx +12 -12
- package/src/components.tsx +2 -2
- package/src/icon/icon.scss +1 -1
- package/src/icon/index.tsx +4 -4
- package/src/icon/styled.tsx +2 -2
- package/src/index.scss +2 -2
- package/src/index.tsx +0 -2
- package/src/types/index.d.ts +2 -2
- package/src/chart/chart.scss +0 -11
- package/src/chart/components/Contents.tsx +0 -17
- package/src/chart/components/control/Button.tsx +0 -39
- package/src/chart/components/control/Container.tsx +0 -27
- package/src/chart/components/control/Provider.tsx +0 -117
- package/src/chart/components/control/index.tsx +0 -12
- package/src/chart/components/custom/ActivePieSector.tsx +0 -29
- package/src/chart/components/graphs/ArcGauge.tsx +0 -58
- package/src/chart/components/graphs/ArcMeter.tsx +0 -112
- package/src/chart/components/graphs/Area.tsx +0 -132
- package/src/chart/components/graphs/Bar.tsx +0 -179
- package/src/chart/components/graphs/Doughnut.tsx +0 -90
- package/src/chart/components/graphs/Line.tsx +0 -123
- package/src/chart/components/graphs/index.tsx +0 -17
- package/src/chart/components/ticks/XAxis.tsx +0 -39
- package/src/chart/components/ticks/index.tsx +0 -7
- package/src/chart/index.tsx +0 -17
- package/src/chart/styled.tsx +0 -3
- package/src/chart/styles/scss/arc-gauge.scss +0 -11
- package/src/chart/styles/scss/arc-meter.scss +0 -6
- package/src/chart/styles/scss/control.scss +0 -34
- package/src/chart/styles/scss/filter.scss +0 -0
- package/src/chart/styles/scss/graph.scss +0 -3
- package/src/chart/styles/scss/legend.scss +0 -35
- package/src/chart/styles/scss/level.color.scss +0 -7
- package/src/chart/styles/scss/tick.scss +0 -48
- package/src/chart/styles/scss/tooltip.scss +0 -70
- package/src/chart/styles/styled/arc-gauge.ts +0 -65
- package/src/chart/styles/styled/arc-meter.ts +0 -42
- package/src/chart/styles/styled/common.ts +0 -14
- package/src/chart/styles/styled/control.ts +0 -31
- package/src/chart/styles/styled/legend.ts +0 -11
- package/src/chart/svg/gauge-track.min.svg +0 -1
- package/src/chart/utils/getLevel.ts +0 -23
- package/src/icon/components/chart/Control.tsx +0 -40
- package/src/icon/components/chart/index.tsx +0 -7
- package/src/icon/components/health-score/HealthScore.tsx +0 -46
- package/src/icon/components/health-score/index.tsx +0 -3
- package/src/icon/styles/scss/chart.scss +0 -3
- package/src/icon/styles/styled/chart.ts +0 -17
- package/src/icon/svg/chart/control/pan-left.svg +0 -4
- package/src/icon/svg/chart/control/pan-right.svg +0 -4
- package/src/icon/svg/chart/control/zoom-in.svg +0 -4
- package/src/icon/svg/chart/control/zoom-out.svg +0 -4
- package/src/styled.template.tsx +0 -5
- package/src/template/compare/compare.scss +0 -1
- package/src/template/compare/components/box/Container.tsx +0 -33
- package/src/template/compare/components/box/TextStrong.tsx +0 -15
- package/src/template/compare/components/box/TextSub.tsx +0 -15
- package/src/template/compare/components/box/index.tsx +0 -11
- package/src/template/compare/components/button/Remove.tsx +0 -28
- package/src/template/compare/components/button/index.tsx +0 -5
- package/src/template/compare/components/chart/Container.tsx +0 -33
- package/src/template/compare/components/chart/graph/Container.tsx +0 -15
- package/src/template/compare/components/chart/graph/Item.tsx +0 -13
- package/src/template/compare/components/chart/index.tsx +0 -16
- package/src/template/compare/components/chart/legend/Container.tsx +0 -23
- package/src/template/compare/components/chart/legend/Section.tsx +0 -31
- package/src/template/compare/components/select-list/Container.tsx +0 -15
- package/src/template/compare/components/select-list/Header.tsx +0 -15
- package/src/template/compare/components/select-list/Item.tsx +0 -15
- package/src/template/compare/components/select-list/List.tsx +0 -18
- package/src/template/compare/components/select-list/index.tsx +0 -13
- package/src/template/compare/index.tsx +0 -13
- package/src/template/compare/styled.tsx +0 -17
- package/src/template/compare/styles/scss/variables.scss +0 -17
- package/src/template/compare/styles/styled-components/chart/graph.ts +0 -26
- package/src/template/compare/styles/styled-components/chart/layout.ts +0 -38
- package/src/template/compare/styles/styled-components/chart/legend.ts +0 -64
- package/src/template/compare/styles/styled-components/common.ts +0 -57
- package/src/template/compare/styles/styled-components/select-list.ts +0 -36
- package/src/template/filter/components/Container.tsx +0 -39
- package/src/template/filter/components/Group.tsx +0 -100
- package/src/template/filter/components/ToggleButton.tsx +0 -27
- package/src/template/filter/index.tsx +0 -5
- package/src/template/filter/styled.tsx +0 -3
- package/src/template/filter/styles/styled-components/filter.ts +0 -66
- package/src/template/health-score/components/Chart.tsx +0 -38
- package/src/template/health-score/index.tsx +0 -3
- package/src/template/health-score/styled.tsx +0 -3
- package/src/template/health-score/styles/styled/chart.ts +0 -26
- package/src/template.tsx +0 -5
- package/src/types/chart/axis.d.ts +0 -15
- package/src/types/chart/control.d.ts +0 -109
- package/src/types/chart/data.d.ts +0 -41
- package/src/types/chart/dot.d.ts +0 -3
- package/src/types/chart/index.d.ts +0 -7
- package/src/types/chart/legend.d.ts +0 -124
- package/src/types/chart/props.d.ts +0 -271
- package/src/types/chart/tick.d.ts +0 -30
- package/src/types/template/compare/chart.d.ts +0 -8
- package/src/types/template/filter.d.ts +0 -39
- package/src/types/template/index.d.ts +0 -2
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
|
|
5
|
-
import ChartDoughnut from "./Doughnut";
|
|
6
|
-
import getChartLevel from "../../utils/getLevel";
|
|
7
|
-
|
|
8
|
-
import type { ChartDoughnutProps } from "../../../types";
|
|
9
|
-
import StyledArcMeter from "../../styles/styled/arc-meter";
|
|
10
|
-
import { lengthFormat } from "@uniai-fe/util-functions";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 차트 템플릿; 반원 미터
|
|
14
|
-
* - AI 건강지수 차트 등에 사용
|
|
15
|
-
* @param {ChartDoughnutProps} props
|
|
16
|
-
* @param {string} [props.className]
|
|
17
|
-
* @param {object} props.data 데이터
|
|
18
|
-
* @param {string} props.data.name 데이터 이름
|
|
19
|
-
* @param {number | ""} props.data.value 값 (스코어)
|
|
20
|
-
* @param {string} [props.data.unit] 데이터 단위
|
|
21
|
-
* @param {number} [props.max] 최대값 (기본값 100)
|
|
22
|
-
* @param {ChartDoughnutProps} [props.doughnutOptions] <ChartDoughnut /> Props 옵션
|
|
23
|
-
*/
|
|
24
|
-
export default function ChartArcMeter({
|
|
25
|
-
className,
|
|
26
|
-
data: d,
|
|
27
|
-
max = 100,
|
|
28
|
-
doughnutOptions,
|
|
29
|
-
}: {
|
|
30
|
-
className?: string;
|
|
31
|
-
data: { name: string; value: number | ""; unit?: string };
|
|
32
|
-
max?: number;
|
|
33
|
-
doughnutOptions?: ChartDoughnutProps;
|
|
34
|
-
}) {
|
|
35
|
-
const START_ANGLE = 180;
|
|
36
|
-
const WIDTH = 180;
|
|
37
|
-
const THICKNESS = 14;
|
|
38
|
-
|
|
39
|
-
const POINT_BORDER = 5;
|
|
40
|
-
const POINT_RADIUS = THICKNESS / 2 + POINT_BORDER / 2;
|
|
41
|
-
|
|
42
|
-
const point = useMemo((): { x: number; y: number } => {
|
|
43
|
-
const pos = { x: 0, y: 0 };
|
|
44
|
-
if (typeof d.value !== "number") return pos;
|
|
45
|
-
|
|
46
|
-
// -90 ~ 90
|
|
47
|
-
const startDegree = -90;
|
|
48
|
-
const rangeDegree = 180;
|
|
49
|
-
const angle = (d.value / max) * rangeDegree + startDegree;
|
|
50
|
-
const distance = WIDTH / 2 - THICKNESS / 2;
|
|
51
|
-
const radian = (angle * Math.PI) / rangeDegree;
|
|
52
|
-
|
|
53
|
-
pos.x = WIDTH / 2 + distance * Math.sin(radian);
|
|
54
|
-
pos.y = WIDTH / 2 - distance * Math.cos(radian);
|
|
55
|
-
|
|
56
|
-
return pos;
|
|
57
|
-
}, [max, d.value]);
|
|
58
|
-
|
|
59
|
-
const color = useMemo((): string => {
|
|
60
|
-
const level = getChartLevel(d.value, max);
|
|
61
|
-
return `var(--chart-level-color-${level})`;
|
|
62
|
-
}, [max, d.value]);
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<StyledArcMeter.container className={className} $height={WIDTH / 2}>
|
|
66
|
-
<ChartDoughnut
|
|
67
|
-
width={WIDTH}
|
|
68
|
-
height={WIDTH / 2}
|
|
69
|
-
thickness={THICKNESS}
|
|
70
|
-
startAngle={START_ANGLE}
|
|
71
|
-
endAngle={START_ANGLE - 180}
|
|
72
|
-
pieOptions={{
|
|
73
|
-
cy: WIDTH / 2,
|
|
74
|
-
cornerRadius: THICKNESS / 2,
|
|
75
|
-
dataKey: "value",
|
|
76
|
-
}}
|
|
77
|
-
chartData={[
|
|
78
|
-
{
|
|
79
|
-
name: d.name,
|
|
80
|
-
value: typeof d.value === "number" ? d.value : 0,
|
|
81
|
-
track: max,
|
|
82
|
-
fill: color,
|
|
83
|
-
unit: d.unit || "",
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: "",
|
|
87
|
-
value: typeof d.value === "number" ? max - d.value : max,
|
|
88
|
-
track: max,
|
|
89
|
-
fill: "transparent",
|
|
90
|
-
unit: "",
|
|
91
|
-
},
|
|
92
|
-
]}
|
|
93
|
-
{...doughnutOptions}
|
|
94
|
-
>
|
|
95
|
-
{typeof d.value === "number" && (
|
|
96
|
-
<circle
|
|
97
|
-
cx={point.x}
|
|
98
|
-
cy={point.y}
|
|
99
|
-
r={POINT_RADIUS}
|
|
100
|
-
fill="var(--color_0)"
|
|
101
|
-
stroke={color}
|
|
102
|
-
strokeWidth={POINT_BORDER}
|
|
103
|
-
/>
|
|
104
|
-
)}
|
|
105
|
-
</ChartDoughnut>
|
|
106
|
-
<StyledArcMeter.text $color={color}>
|
|
107
|
-
<strong>{lengthFormat(d.value)}</strong>
|
|
108
|
-
{d.unit && <span>{d.unit}</span>}
|
|
109
|
-
</StyledArcMeter.text>
|
|
110
|
-
</StyledArcMeter.container>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Area,
|
|
5
|
-
AreaChart,
|
|
6
|
-
CartesianGrid,
|
|
7
|
-
ResponsiveContainer,
|
|
8
|
-
Tooltip,
|
|
9
|
-
XAxis,
|
|
10
|
-
YAxis,
|
|
11
|
-
type XAxisProps,
|
|
12
|
-
type YAxisProps,
|
|
13
|
-
} from "recharts";
|
|
14
|
-
import type { ChartAreaDataLegendProps, ChartAreaProps } from "../../../types";
|
|
15
|
-
import { useChartSize } from "@uniai-fe/react-hooks";
|
|
16
|
-
|
|
17
|
-
export default function ChartArea({
|
|
18
|
-
chartData,
|
|
19
|
-
legendData,
|
|
20
|
-
yAxisData,
|
|
21
|
-
chartLayoutOptions,
|
|
22
|
-
xAxisOptions,
|
|
23
|
-
yAxisOptions,
|
|
24
|
-
isHideGrid,
|
|
25
|
-
tooltipOptions,
|
|
26
|
-
containerOptions,
|
|
27
|
-
children: extraComponents,
|
|
28
|
-
}: ChartAreaProps) {
|
|
29
|
-
const { sizeOptions } = useChartSize();
|
|
30
|
-
|
|
31
|
-
const iaValidGradient = ({ areaGradient }: ChartAreaDataLegendProps) =>
|
|
32
|
-
areaGradient && areaGradient.selectorId && areaGradient.gradient.length > 1;
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<ResponsiveContainer
|
|
36
|
-
width="100%"
|
|
37
|
-
height="100%"
|
|
38
|
-
{...sizeOptions(containerOptions)}
|
|
39
|
-
>
|
|
40
|
-
<AreaChart
|
|
41
|
-
// margin={{ top: 0, left: 0, right: 0, bottom: 0 }}
|
|
42
|
-
{...sizeOptions({
|
|
43
|
-
margin: { top: 0, left: 0, right: 0, bottom: 0 },
|
|
44
|
-
...chartLayoutOptions,
|
|
45
|
-
})}
|
|
46
|
-
data={chartData}
|
|
47
|
-
>
|
|
48
|
-
{!isHideGrid && yAxisData?.[0] && (
|
|
49
|
-
<CartesianGrid vertical={false} yAxisId={yAxisData[0].axisCategory} />
|
|
50
|
-
)}
|
|
51
|
-
{tooltipOptions && <Tooltip {...tooltipOptions} />}
|
|
52
|
-
<XAxis
|
|
53
|
-
axisLine={false}
|
|
54
|
-
{...sizeOptions<XAxisProps>({
|
|
55
|
-
padding: { left: 30, right: 30 },
|
|
56
|
-
tickSize: 0,
|
|
57
|
-
tickMargin: 10,
|
|
58
|
-
...xAxisOptions,
|
|
59
|
-
})}
|
|
60
|
-
/>
|
|
61
|
-
{yAxisData.map(({ key, axisCategory }) => (
|
|
62
|
-
<YAxis
|
|
63
|
-
key={key}
|
|
64
|
-
yAxisId={axisCategory}
|
|
65
|
-
axisLine={false}
|
|
66
|
-
hide={true}
|
|
67
|
-
{...sizeOptions<YAxisProps>({ tickSize: 0, ...yAxisOptions })}
|
|
68
|
-
/>
|
|
69
|
-
))}
|
|
70
|
-
{legendData.filter(iaValidGradient).length > 0 ? (
|
|
71
|
-
<defs>
|
|
72
|
-
{legendData.filter(iaValidGradient).map(
|
|
73
|
-
({ areaGradient }) =>
|
|
74
|
-
areaGradient && (
|
|
75
|
-
<linearGradient
|
|
76
|
-
key={areaGradient.selectorId}
|
|
77
|
-
id={areaGradient.selectorId}
|
|
78
|
-
x1="0"
|
|
79
|
-
y1="0"
|
|
80
|
-
x2="0"
|
|
81
|
-
y2="1"
|
|
82
|
-
>
|
|
83
|
-
{areaGradient.gradient.map(({ key, offset, color }) => (
|
|
84
|
-
<stop key={key} offset={offset} stopColor={color} />
|
|
85
|
-
))}
|
|
86
|
-
</linearGradient>
|
|
87
|
-
),
|
|
88
|
-
)}
|
|
89
|
-
</defs>
|
|
90
|
-
) : null}
|
|
91
|
-
{legendData
|
|
92
|
-
.filter(({ active }) => active)
|
|
93
|
-
.map(
|
|
94
|
-
({
|
|
95
|
-
key,
|
|
96
|
-
code,
|
|
97
|
-
axisCategory,
|
|
98
|
-
name,
|
|
99
|
-
unit,
|
|
100
|
-
color,
|
|
101
|
-
areaColor,
|
|
102
|
-
areaGradient,
|
|
103
|
-
highlight,
|
|
104
|
-
}) => (
|
|
105
|
-
<Area
|
|
106
|
-
key={key}
|
|
107
|
-
type="monotone"
|
|
108
|
-
dataKey={code}
|
|
109
|
-
yAxisId={axisCategory}
|
|
110
|
-
name={name}
|
|
111
|
-
unit={unit}
|
|
112
|
-
stroke={color}
|
|
113
|
-
strokeWidth="var(--chart-data-line-width)"
|
|
114
|
-
fill={
|
|
115
|
-
areaGradient?.selectorId
|
|
116
|
-
? `url(#${areaGradient.selectorId})`
|
|
117
|
-
: areaColor || undefined
|
|
118
|
-
}
|
|
119
|
-
{...(typeof highlight === "boolean" && highlight === false
|
|
120
|
-
? { strokeOpacity: 0.3 }
|
|
121
|
-
: {})}
|
|
122
|
-
dot={false}
|
|
123
|
-
isAnimationActive={false}
|
|
124
|
-
/>
|
|
125
|
-
),
|
|
126
|
-
)}
|
|
127
|
-
|
|
128
|
-
{extraComponents}
|
|
129
|
-
</AreaChart>
|
|
130
|
-
</ResponsiveContainer>
|
|
131
|
-
);
|
|
132
|
-
}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Bar,
|
|
5
|
-
BarChart,
|
|
6
|
-
CartesianGrid,
|
|
7
|
-
Cell,
|
|
8
|
-
ResponsiveContainer,
|
|
9
|
-
Tooltip,
|
|
10
|
-
XAxis,
|
|
11
|
-
YAxis,
|
|
12
|
-
type BarProps,
|
|
13
|
-
type CellProps,
|
|
14
|
-
type XAxisProps,
|
|
15
|
-
type YAxisProps,
|
|
16
|
-
} from "recharts";
|
|
17
|
-
import type { ChartBarProps } from "../../../types";
|
|
18
|
-
import { useChartSize } from "@uniai-fe/react-hooks";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 차트 템플릿; 막대 차트
|
|
22
|
-
* @param {ChartLineProps} props
|
|
23
|
-
*/
|
|
24
|
-
export default function ChartBar({
|
|
25
|
-
barSize = 25,
|
|
26
|
-
chartData,
|
|
27
|
-
legendData,
|
|
28
|
-
yAxisData,
|
|
29
|
-
chartLayoutOptions,
|
|
30
|
-
xAxisOptions,
|
|
31
|
-
yAxisOptions,
|
|
32
|
-
isHideGrid,
|
|
33
|
-
isUseCell,
|
|
34
|
-
tooltipOptions,
|
|
35
|
-
containerOptions,
|
|
36
|
-
barOptions,
|
|
37
|
-
cellOptions,
|
|
38
|
-
children: extraChartComponents,
|
|
39
|
-
}: ChartBarProps) {
|
|
40
|
-
const { singleSizeOptions, sizeOptions } = useChartSize();
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<ResponsiveContainer
|
|
44
|
-
width="100%"
|
|
45
|
-
height="100%"
|
|
46
|
-
{...sizeOptions(containerOptions)}
|
|
47
|
-
>
|
|
48
|
-
<BarChart
|
|
49
|
-
{...sizeOptions({
|
|
50
|
-
margin: { top: 10, left: 0, right: 0, bottom: 0 },
|
|
51
|
-
...chartLayoutOptions,
|
|
52
|
-
})}
|
|
53
|
-
// margin={{
|
|
54
|
-
// top: rem(10),
|
|
55
|
-
// left: 0,
|
|
56
|
-
// right: 0,
|
|
57
|
-
// bottom: 0,
|
|
58
|
-
// ...objectSizeOptions(chartLayoutOptions.margin),
|
|
59
|
-
// }}
|
|
60
|
-
data={chartData}
|
|
61
|
-
>
|
|
62
|
-
{!isHideGrid && yAxisData?.[0] && (
|
|
63
|
-
<CartesianGrid vertical={false} yAxisId={yAxisData[0].axisCategory} />
|
|
64
|
-
)}
|
|
65
|
-
{tooltipOptions && <Tooltip {...tooltipOptions} />}
|
|
66
|
-
<XAxis
|
|
67
|
-
axisLine={false}
|
|
68
|
-
{...sizeOptions<XAxisProps>({
|
|
69
|
-
tickSize: 0,
|
|
70
|
-
tickMargin: 10,
|
|
71
|
-
padding: { left: 30, right: 30 },
|
|
72
|
-
...xAxisOptions,
|
|
73
|
-
})}
|
|
74
|
-
// padding={{
|
|
75
|
-
// left: rem(30),
|
|
76
|
-
// right: rem(30),
|
|
77
|
-
// ...objectSizeOptions(xAxisOptions?.padding),
|
|
78
|
-
// }}
|
|
79
|
-
// tickSize={singleSizeOptions(xAxisOptions?.tickSize || 0)}
|
|
80
|
-
// tickMargin={singleSizeOptions(xAxisOptions?.tickMargin || 10)}
|
|
81
|
-
// height={singleSizeOptions(xAxisOptions?.height)}
|
|
82
|
-
/>
|
|
83
|
-
{yAxisData.map(({ key, axisCategory }) => (
|
|
84
|
-
<YAxis
|
|
85
|
-
key={key}
|
|
86
|
-
yAxisId={axisCategory}
|
|
87
|
-
axisLine={false}
|
|
88
|
-
hide={true}
|
|
89
|
-
{...sizeOptions<YAxisProps>({ tickSize: 0, ...yAxisOptions })}
|
|
90
|
-
// tickSize={singleSizeOptions(yAxisOptions?.tickSize || 0)}
|
|
91
|
-
// width={singleSizeOptions<YAxisWidth>(yAxisOptions?.width)}
|
|
92
|
-
/>
|
|
93
|
-
))}
|
|
94
|
-
{!isUseCell &&
|
|
95
|
-
legendData
|
|
96
|
-
.filter(({ active }) => active)
|
|
97
|
-
.map(
|
|
98
|
-
({
|
|
99
|
-
key,
|
|
100
|
-
code,
|
|
101
|
-
axisCategory,
|
|
102
|
-
name,
|
|
103
|
-
unit,
|
|
104
|
-
color,
|
|
105
|
-
strokeColor,
|
|
106
|
-
strokeStyle,
|
|
107
|
-
strokeWidth,
|
|
108
|
-
highlight,
|
|
109
|
-
}) => (
|
|
110
|
-
<Bar
|
|
111
|
-
key={key}
|
|
112
|
-
barSize={singleSizeOptions(barSize)}
|
|
113
|
-
type="monotone"
|
|
114
|
-
dataKey={code}
|
|
115
|
-
yAxisId={axisCategory}
|
|
116
|
-
name={name}
|
|
117
|
-
unit={unit}
|
|
118
|
-
fill={color}
|
|
119
|
-
{...(strokeColor
|
|
120
|
-
? {
|
|
121
|
-
strokeWidth:
|
|
122
|
-
strokeWidth || "var(--chart-data-line-width)",
|
|
123
|
-
stroke: strokeColor,
|
|
124
|
-
strokeDasharray: strokeStyle,
|
|
125
|
-
}
|
|
126
|
-
: {})}
|
|
127
|
-
{...(typeof highlight === "boolean" && highlight === false
|
|
128
|
-
? { strokeOpacity: 0.3 }
|
|
129
|
-
: {})}
|
|
130
|
-
isAnimationActive={false}
|
|
131
|
-
{...sizeOptions<BarProps>(barOptions)}
|
|
132
|
-
/>
|
|
133
|
-
),
|
|
134
|
-
)}
|
|
135
|
-
{isUseCell && (
|
|
136
|
-
<Bar
|
|
137
|
-
barSize={singleSizeOptions(barSize)}
|
|
138
|
-
type="monotone"
|
|
139
|
-
dataKey="value"
|
|
140
|
-
yAxisId={legendData[0].axisCategory}
|
|
141
|
-
isAnimationActive={false}
|
|
142
|
-
{...sizeOptions<BarProps>(barOptions)}
|
|
143
|
-
>
|
|
144
|
-
{legendData.map(
|
|
145
|
-
({
|
|
146
|
-
key,
|
|
147
|
-
name,
|
|
148
|
-
color,
|
|
149
|
-
strokeColor,
|
|
150
|
-
strokeStyle,
|
|
151
|
-
strokeWidth,
|
|
152
|
-
highlight,
|
|
153
|
-
}) => (
|
|
154
|
-
<Cell
|
|
155
|
-
key={key}
|
|
156
|
-
name={name}
|
|
157
|
-
fill={color}
|
|
158
|
-
{...(strokeColor
|
|
159
|
-
? {
|
|
160
|
-
strokeWidth:
|
|
161
|
-
strokeWidth || "var(--chart-data-line-width)",
|
|
162
|
-
stroke: strokeColor,
|
|
163
|
-
strokeDasharray: strokeStyle,
|
|
164
|
-
}
|
|
165
|
-
: {})}
|
|
166
|
-
{...(typeof highlight === "boolean" && highlight === false
|
|
167
|
-
? { strokeOpacity: 0.3 }
|
|
168
|
-
: {})}
|
|
169
|
-
{...sizeOptions<CellProps>(cellOptions)}
|
|
170
|
-
/>
|
|
171
|
-
),
|
|
172
|
-
)}
|
|
173
|
-
</Bar>
|
|
174
|
-
)}
|
|
175
|
-
{extraChartComponents}
|
|
176
|
-
</BarChart>
|
|
177
|
-
</ResponsiveContainer>
|
|
178
|
-
);
|
|
179
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { Pie, PieChart, ResponsiveContainer } from "recharts";
|
|
5
|
-
import type { ChartDoughnutProps } from "../../../types";
|
|
6
|
-
import type { Props } from "recharts/types/polar/Pie";
|
|
7
|
-
import { useChartSize } from "@uniai-fe/react-hooks";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 차트 템플릿; 도넛 차트
|
|
11
|
-
* @param {ChartDoughnutProps} props
|
|
12
|
-
*/
|
|
13
|
-
export default function ChartDoughnut({
|
|
14
|
-
width: size = 200,
|
|
15
|
-
height,
|
|
16
|
-
thickness = 30,
|
|
17
|
-
startAngle = 90,
|
|
18
|
-
endAngle = -360,
|
|
19
|
-
chartData,
|
|
20
|
-
chartLayoutOptions,
|
|
21
|
-
containerOptions,
|
|
22
|
-
pieOptions,
|
|
23
|
-
className,
|
|
24
|
-
children: extraChartComponents,
|
|
25
|
-
}: ChartDoughnutProps) {
|
|
26
|
-
const { rem, sizeOptions } = useChartSize();
|
|
27
|
-
|
|
28
|
-
const sizeRem = useMemo((): number => rem(size), [rem, size]);
|
|
29
|
-
const heightSize = useMemo(
|
|
30
|
-
(): number =>
|
|
31
|
-
typeof height === "number" && height > 0 ? rem(height) : sizeRem,
|
|
32
|
-
[height, sizeRem, rem],
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const defaultPieProps = useMemo(
|
|
36
|
-
(): Props => ({
|
|
37
|
-
cx: sizeRem / 2,
|
|
38
|
-
cy: heightSize / 2,
|
|
39
|
-
innerRadius: sizeRem / 2 - thickness,
|
|
40
|
-
outerRadius: sizeRem / 2,
|
|
41
|
-
startAngle,
|
|
42
|
-
endAngle,
|
|
43
|
-
paddingAngle: 0,
|
|
44
|
-
labelLine: false,
|
|
45
|
-
isAnimationActive: false,
|
|
46
|
-
strokeWidth: 0,
|
|
47
|
-
dataKey: "value",
|
|
48
|
-
...sizeOptions(pieOptions),
|
|
49
|
-
}),
|
|
50
|
-
[
|
|
51
|
-
endAngle,
|
|
52
|
-
heightSize,
|
|
53
|
-
pieOptions,
|
|
54
|
-
sizeRem,
|
|
55
|
-
startAngle,
|
|
56
|
-
thickness,
|
|
57
|
-
sizeOptions,
|
|
58
|
-
],
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<ResponsiveContainer
|
|
63
|
-
height="100%"
|
|
64
|
-
{...sizeOptions(containerOptions)}
|
|
65
|
-
width={containerOptions?.width || sizeRem || "100%"}
|
|
66
|
-
className={className}
|
|
67
|
-
>
|
|
68
|
-
<PieChart
|
|
69
|
-
// margin={{ top: 0, left: 0, right: 0, bottom: 0 }}
|
|
70
|
-
{...sizeOptions({
|
|
71
|
-
margin: { top: 0, left: 0, right: 0, bottom: 0 },
|
|
72
|
-
...chartLayoutOptions,
|
|
73
|
-
})}
|
|
74
|
-
width={sizeRem}
|
|
75
|
-
height={heightSize}
|
|
76
|
-
// preserveAspectRatio="xMinYMin meet"
|
|
77
|
-
>
|
|
78
|
-
{/* <Pie
|
|
79
|
-
{...defaultPieProps}
|
|
80
|
-
// 도넛 트랙
|
|
81
|
-
dataKey="track"
|
|
82
|
-
data={[{ ...chartData[0], fill: "var(--chart-level-color-0)" }]}
|
|
83
|
-
ref={null}
|
|
84
|
-
/> */}
|
|
85
|
-
<Pie {...defaultPieProps} data={chartData} />
|
|
86
|
-
{extraChartComponents}
|
|
87
|
-
</PieChart>
|
|
88
|
-
</ResponsiveContainer>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
CartesianGrid,
|
|
5
|
-
Line,
|
|
6
|
-
LineChart,
|
|
7
|
-
ResponsiveContainer,
|
|
8
|
-
Tooltip,
|
|
9
|
-
XAxis,
|
|
10
|
-
YAxis,
|
|
11
|
-
type LineProps,
|
|
12
|
-
type XAxisProps,
|
|
13
|
-
type YAxisProps,
|
|
14
|
-
} from "recharts";
|
|
15
|
-
import type { ChartLineProps } from "../../../types";
|
|
16
|
-
import { useChartSize } from "@uniai-fe/react-hooks";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 차트 템플릿; 라인 차트
|
|
20
|
-
* @param {ChartLineProps} props
|
|
21
|
-
*/
|
|
22
|
-
export default function ChartLine({
|
|
23
|
-
chartData,
|
|
24
|
-
legendData,
|
|
25
|
-
yAxisData,
|
|
26
|
-
chartLayoutOptions,
|
|
27
|
-
xAxisOptions,
|
|
28
|
-
yAxisOptions,
|
|
29
|
-
isHideGrid,
|
|
30
|
-
tooltipOptions,
|
|
31
|
-
containerOptions,
|
|
32
|
-
lineOptions,
|
|
33
|
-
children: extraChartComponents,
|
|
34
|
-
}: ChartLineProps) {
|
|
35
|
-
const { sizeOptions } = useChartSize();
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<ResponsiveContainer
|
|
39
|
-
width="100%"
|
|
40
|
-
height="100%"
|
|
41
|
-
{...sizeOptions(containerOptions)}
|
|
42
|
-
>
|
|
43
|
-
<LineChart
|
|
44
|
-
// margin={{ top: 0, left: 0, right: 0, bottom: 0 }}
|
|
45
|
-
{...sizeOptions({
|
|
46
|
-
margin: { top: 0, left: 0, right: 0, bottom: 0 },
|
|
47
|
-
...chartLayoutOptions,
|
|
48
|
-
})}
|
|
49
|
-
data={chartData}
|
|
50
|
-
>
|
|
51
|
-
{!isHideGrid && yAxisData?.[0] && (
|
|
52
|
-
<CartesianGrid vertical={false} yAxisId={yAxisData[0].axisCategory} />
|
|
53
|
-
)}
|
|
54
|
-
{tooltipOptions && <Tooltip {...tooltipOptions} />}
|
|
55
|
-
<XAxis
|
|
56
|
-
axisLine={false}
|
|
57
|
-
{...sizeOptions<XAxisProps>({
|
|
58
|
-
padding: { left: 30, right: 30 },
|
|
59
|
-
tickSize: 0,
|
|
60
|
-
tickMargin: 10,
|
|
61
|
-
...xAxisOptions,
|
|
62
|
-
})}
|
|
63
|
-
// padding={{
|
|
64
|
-
// left: rem(30),
|
|
65
|
-
// right: rem(30),
|
|
66
|
-
// ...objectSizeOptions(xAxisOptions?.padding),
|
|
67
|
-
// }}
|
|
68
|
-
// tickSize={singleSizeOptions(xAxisOptions?.tickSize || 0)}
|
|
69
|
-
// tickMargin={singleSizeOptions(xAxisOptions?.tickMargin || 10)}
|
|
70
|
-
// height={singleSizeOptions(xAxisOptions?.height)}
|
|
71
|
-
/>
|
|
72
|
-
{yAxisData.map(({ key, axisCategory }) => (
|
|
73
|
-
<YAxis
|
|
74
|
-
key={key}
|
|
75
|
-
yAxisId={axisCategory}
|
|
76
|
-
axisLine={false}
|
|
77
|
-
hide={true}
|
|
78
|
-
{...sizeOptions<YAxisProps>({ tickSize: 0, ...yAxisOptions })}
|
|
79
|
-
// tickSize={singleSizeOptions(yAxisOptions?.tickSize || 0)}
|
|
80
|
-
// width={singleSizeOptions<YAxisWidth>(yAxisOptions?.width)}
|
|
81
|
-
/>
|
|
82
|
-
))}
|
|
83
|
-
{legendData
|
|
84
|
-
.filter(({ active }) => active)
|
|
85
|
-
.map(
|
|
86
|
-
({
|
|
87
|
-
key,
|
|
88
|
-
code,
|
|
89
|
-
axisCategory,
|
|
90
|
-
name,
|
|
91
|
-
unit,
|
|
92
|
-
color,
|
|
93
|
-
highlight,
|
|
94
|
-
strokeStyle,
|
|
95
|
-
}) => (
|
|
96
|
-
<Line
|
|
97
|
-
key={key}
|
|
98
|
-
type="monotone"
|
|
99
|
-
dataKey={code}
|
|
100
|
-
yAxisId={axisCategory}
|
|
101
|
-
name={name}
|
|
102
|
-
unit={unit}
|
|
103
|
-
stroke={color}
|
|
104
|
-
strokeWidth="var(--chart-data-line-width)"
|
|
105
|
-
{...(strokeStyle
|
|
106
|
-
? {
|
|
107
|
-
strokeDasharray: strokeStyle,
|
|
108
|
-
}
|
|
109
|
-
: {})}
|
|
110
|
-
{...(typeof highlight === "boolean" && highlight === false
|
|
111
|
-
? { strokeOpacity: 0.3 }
|
|
112
|
-
: {})}
|
|
113
|
-
dot={false}
|
|
114
|
-
isAnimationActive={false}
|
|
115
|
-
{...sizeOptions<LineProps>(lineOptions)}
|
|
116
|
-
/>
|
|
117
|
-
),
|
|
118
|
-
)}
|
|
119
|
-
{extraChartComponents}
|
|
120
|
-
</LineChart>
|
|
121
|
-
</ResponsiveContainer>
|
|
122
|
-
);
|
|
123
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import ChartArcGauge from "./ArcGauge";
|
|
2
|
-
import ChartArcMeter from "./ArcMeter";
|
|
3
|
-
import ChartArea from "./Area";
|
|
4
|
-
import ChartBar from "./Bar";
|
|
5
|
-
import ChartDoughnut from "./Doughnut";
|
|
6
|
-
import ChartLine from "./Line";
|
|
7
|
-
|
|
8
|
-
const ChartGraph = {
|
|
9
|
-
Bar: ChartBar,
|
|
10
|
-
Line: ChartLine,
|
|
11
|
-
Area: ChartArea,
|
|
12
|
-
Doughnut: ChartDoughnut,
|
|
13
|
-
ArcGauge: ChartArcGauge,
|
|
14
|
-
ArcMeter: ChartArcMeter,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default ChartGraph;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { ChartTickXAxisProps } from "../../../types";
|
|
2
|
-
import { getXAxisTextAttr } from "@uniai-fe/util-react";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 차트 템플릿 > tick; XAxis
|
|
6
|
-
* @param {ChartTickXAxisProps} props
|
|
7
|
-
* @param {RechartsXAxisTickProps} props.xAxisProps x축 옵션
|
|
8
|
-
*/
|
|
9
|
-
export default function ChartTickXAxis({
|
|
10
|
-
className,
|
|
11
|
-
children,
|
|
12
|
-
xAxisProps,
|
|
13
|
-
groupProps,
|
|
14
|
-
tSpanPos,
|
|
15
|
-
customValue,
|
|
16
|
-
}: ChartTickXAxisProps) {
|
|
17
|
-
// recharts.js XAxis tick의 기본 props
|
|
18
|
-
const {
|
|
19
|
-
x,
|
|
20
|
-
// 추가 기본 정보; index, visibleTicksCount,
|
|
21
|
-
// index,
|
|
22
|
-
// payload - 각 x의 y 데이터; coordinate, value, index, offset, tickCoord, isShow
|
|
23
|
-
payload,
|
|
24
|
-
} = xAxisProps;
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<g className={className} {...groupProps}>
|
|
28
|
-
<text
|
|
29
|
-
{...getXAxisTextAttr(xAxisProps)}
|
|
30
|
-
className="recharts-text recharts-cartesian-axis-tick-value"
|
|
31
|
-
>
|
|
32
|
-
<tspan {...tSpanPos} x={x}>
|
|
33
|
-
{customValue || payload.value}
|
|
34
|
-
</tspan>
|
|
35
|
-
</text>
|
|
36
|
-
{children}
|
|
37
|
-
</g>
|
|
38
|
-
);
|
|
39
|
-
}
|