@uniai-fe/chart-legacy 0.1.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.
- package/LICENSE +27 -0
- package/README.md +3 -0
- package/package.json +74 -0
- package/src/chart.scss +13 -0
- package/src/components/Contents.tsx +17 -0
- package/src/components/control/Button.tsx +39 -0
- package/src/components/control/Container.tsx +27 -0
- package/src/components/control/Provider.tsx +117 -0
- package/src/components/control/index.tsx +12 -0
- package/src/components/custom/ActivePieSector.tsx +29 -0
- package/src/components/graphs/ArcGauge.tsx +58 -0
- package/src/components/graphs/ArcMeter.tsx +112 -0
- package/src/components/graphs/Area.tsx +132 -0
- package/src/components/graphs/Bar.tsx +179 -0
- package/src/components/graphs/Doughnut.tsx +90 -0
- package/src/components/graphs/Line.tsx +123 -0
- package/src/components/graphs/index.tsx +17 -0
- package/src/components/ticks/XAxis.tsx +39 -0
- package/src/components/ticks/index.tsx +7 -0
- package/src/components.tsx +17 -0
- package/src/icon/Control.tsx +40 -0
- package/src/icon/index.tsx +7 -0
- package/src/index.tsx +3 -0
- package/src/styled.tsx +7 -0
- package/src/styles/scss/arc-gauge.scss +11 -0
- package/src/styles/scss/arc-meter.scss +6 -0
- package/src/styles/scss/control.scss +34 -0
- package/src/styles/scss/filter.scss +0 -0
- package/src/styles/scss/graph.scss +3 -0
- package/src/styles/scss/icon.scss +3 -0
- package/src/styles/scss/legend.scss +35 -0
- package/src/styles/scss/level.color.scss +7 -0
- package/src/styles/scss/tick.scss +48 -0
- package/src/styles/scss/tooltip.scss +70 -0
- package/src/styles/styled/arc-gauge.ts +65 -0
- package/src/styles/styled/arc-meter.ts +42 -0
- package/src/styles/styled/common.ts +14 -0
- package/src/styles/styled/control.ts +31 -0
- package/src/styles/styled/icon.ts +17 -0
- package/src/styles/styled/legend.ts +11 -0
- package/src/svg/control/pan-left.svg +4 -0
- package/src/svg/control/pan-right.svg +4 -0
- package/src/svg/control/zoom-in.svg +4 -0
- package/src/svg/control/zoom-out.svg +4 -0
- package/src/svg/gauge-track.min.svg +1 -0
- package/src/types/axis.d.ts +15 -0
- package/src/types/control.d.ts +109 -0
- package/src/types/data.d.ts +41 -0
- package/src/types/dot.d.ts +3 -0
- package/src/types/index.d.ts +7 -0
- package/src/types/legend.d.ts +124 -0
- package/src/types/props.d.ts +271 -0
- package/src/types/tick.d.ts +30 -0
- package/src/utils/getLevel.ts +23 -0
|
@@ -0,0 +1,179 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import ChartContents from "./components/Contents";
|
|
2
|
+
import ChartControl from "./components/control";
|
|
3
|
+
import ChartActivePieSector from "./components/custom/ActivePieSector";
|
|
4
|
+
import ChartGraph from "./components/graphs";
|
|
5
|
+
import ChartTick from "./components/ticks";
|
|
6
|
+
|
|
7
|
+
const Chart = {
|
|
8
|
+
ContentsContainer: ChartContents,
|
|
9
|
+
Graph: ChartGraph,
|
|
10
|
+
Tick: ChartTick,
|
|
11
|
+
Control: ChartControl,
|
|
12
|
+
Custom: {
|
|
13
|
+
ActivePieSector: ChartActivePieSector,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default Chart;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import StyledIconChart from "../styles/styled/icon";
|
|
5
|
+
|
|
6
|
+
import ZoomInIcon from "../../svg/control/zoom-in.svg";
|
|
7
|
+
import ZoomOutIcon from "../../svg/control/zoom-out.svg";
|
|
8
|
+
import PanLeftIcon from "../../svg/control/pan-left.svg";
|
|
9
|
+
import PanRightIcon from "../../svg/control/pan-right.svg";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 차트 인터렉션 컨트롤 버튼 아이콘
|
|
13
|
+
* @component
|
|
14
|
+
* @param
|
|
15
|
+
*/
|
|
16
|
+
export default function IconChartControl({
|
|
17
|
+
className,
|
|
18
|
+
role,
|
|
19
|
+
width = 20,
|
|
20
|
+
height = 20,
|
|
21
|
+
}: {
|
|
22
|
+
role: "zoom-in" | "zoom-out" | "pan-left" | "pan-right";
|
|
23
|
+
} & Partial<{
|
|
24
|
+
className: string;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
}>) {
|
|
28
|
+
return (
|
|
29
|
+
<StyledIconChart.container
|
|
30
|
+
className={clsx("icon-chart-control", className)}
|
|
31
|
+
$width={width}
|
|
32
|
+
$height={height}
|
|
33
|
+
>
|
|
34
|
+
{role === "zoom-in" && <ZoomInIcon viewBox="0 0 20 20" />}
|
|
35
|
+
{role === "zoom-out" && <ZoomOutIcon viewBox="0 0 20 20" />}
|
|
36
|
+
{role === "pan-left" && <PanLeftIcon viewBox="0 0 20 20" />}
|
|
37
|
+
{role === "pan-right" && <PanRightIcon viewBox="0 0 20 20" />}
|
|
38
|
+
</StyledIconChart.container>
|
|
39
|
+
);
|
|
40
|
+
}
|
package/src/index.tsx
ADDED
package/src/styled.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--chart-arc-gauge-text-color: var(--color_90);
|
|
3
|
+
--chart-arc-gauge-text-weight: 600;
|
|
4
|
+
|
|
5
|
+
--chart-arc-gauge-value-size: 46px;
|
|
6
|
+
--chart-arc-gauge-unit-size: 30px;
|
|
7
|
+
|
|
8
|
+
--chart-arc-gauge-point-size: 22px;
|
|
9
|
+
--chart-arc-gauge-point-color: var(--color_90);
|
|
10
|
+
--chart-arc-gauge-point-border-width: 5px;
|
|
11
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--chart-control-button-margin: 0.4rem;
|
|
3
|
+
}
|
|
4
|
+
// .charts-zoom-pan-control-container {
|
|
5
|
+
// display: flex;
|
|
6
|
+
// align-items: center;
|
|
7
|
+
// .chart-zoom-pan-button {
|
|
8
|
+
// margin-left: 6px;
|
|
9
|
+
// svg {
|
|
10
|
+
// rect {
|
|
11
|
+
// stroke: var(--color_40);
|
|
12
|
+
// transition: stroke 0.12s;
|
|
13
|
+
// }
|
|
14
|
+
// path {
|
|
15
|
+
// fill: var(--color_40);
|
|
16
|
+
// transition: fill 0.12s;
|
|
17
|
+
// }
|
|
18
|
+
// }
|
|
19
|
+
// &:not([disabled]):hover {
|
|
20
|
+
// svg {
|
|
21
|
+
// rect {
|
|
22
|
+
// stroke: var(--color_60);
|
|
23
|
+
// }
|
|
24
|
+
// path {
|
|
25
|
+
// fill: var(--color_60);
|
|
26
|
+
// }
|
|
27
|
+
// }
|
|
28
|
+
// }
|
|
29
|
+
// &[disabled] {
|
|
30
|
+
// opacity: 0.5;
|
|
31
|
+
// cursor: default;
|
|
32
|
+
// }
|
|
33
|
+
// }
|
|
34
|
+
// }
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--chart-legend-gap: 10px;
|
|
3
|
+
|
|
4
|
+
--chart-legend-text-size: 12px;
|
|
5
|
+
--chart-legend-text-color: var(--color_90);
|
|
6
|
+
--chart-legend-text-weight: 400;
|
|
7
|
+
|
|
8
|
+
--chart-legend-point-margin: 3px;
|
|
9
|
+
--chart-legend-point-size: 10px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.recharts-legend-wrapper {
|
|
13
|
+
width: 100% !important;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: flex-end;
|
|
17
|
+
.recharts-default-legend {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
.recharts-legend-item {
|
|
21
|
+
margin-right: 0 !important;
|
|
22
|
+
margin-left: var(--chart-legend-gap);
|
|
23
|
+
display: flex !important;
|
|
24
|
+
align-items: center;
|
|
25
|
+
user-select: none;
|
|
26
|
+
}
|
|
27
|
+
.recharts-legend-item-text {
|
|
28
|
+
font-size: var(--chart-legend-text-size);
|
|
29
|
+
font-weight: 400;
|
|
30
|
+
color: var(--color_90) !important;
|
|
31
|
+
user-select: none;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|