stz-chart-maker 1.3.2 β†’ 1.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 (4) hide show
  1. package/README.md +85 -2
  2. package/dist/index.d.ts +244 -175
  3. package/dist/index.js +2093 -2012
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -6,8 +6,8 @@
6
6
 
7
7
  ## using npm :
8
8
  ```bash
9
- npm install stz-chart-maker
10
- npm install -D stz-chart-maker
9
+ npm install stz-chart-maker
10
+ npm install -D stz-chart-maker
11
11
  ```
12
12
  ## api Docs
13
13
  [πŸ“š API λ¬Έμ„œ](https://stz-chart-maker.vercel.app)
@@ -41,4 +41,87 @@ const chart = ChartWrapper
41
41
 
42
42
  <Chart {...chart} />;
43
43
  ```
44
+
45
+ ## Configuration
46
+
47
+ ν”„λ‘œμ νŠΈ λ£¨νŠΈμ— μ„€μ • νŒŒμΌμ„ μƒμ„±ν•˜μ—¬ 차트 λ™μž‘μ„ μ»€μŠ€ν„°λ§ˆμ΄μ§•ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
48
+
49
+ ### μ„€μ • 파일 μœ„μΉ˜
50
+ λ‹€μŒ 쀑 ν•˜λ‚˜μ˜ μœ„μΉ˜μ— μ„€μ • νŒŒμΌμ„ μƒμ„±ν•˜μ„Έμš”:
51
+ - `stz.config.js` (ꢌμž₯)
52
+ - `.stzrc.js`
53
+ - `src/stz.config.js`
54
+ - `src/config/stz.config.js`
55
+ - `config/stz.config.js`
56
+
57
+ ### μ„€μ • μ˜ˆμ‹œ
58
+
59
+ ```javascript
60
+ // stz.config.js
61
+ module.exports = {
62
+ // μ—λŸ¬ λ‘œκΉ… ν™œμ„±ν™”/λΉ„ν™œμ„±ν™”
63
+ errorLogging: true,
64
+
65
+ // μ—λŸ¬ λ°œμƒ μ‹œ λ¬΄μ‹œ (silent mode)
66
+ silentMode: false,
67
+
68
+ // 차트 κΈ°λ³Έ 색상 μ»€μŠ€ν„°λ§ˆμ΄μ§•
69
+ defaultColor: [
70
+ '#FF6B6B',
71
+ '#4ECDC4',
72
+ '#45B7D1',
73
+ '#FFA07A',
74
+ '#98D8C8',
75
+ '#F7DC6F'
76
+ ],
77
+
78
+ // λͺ¨λ“  차트 νƒ€μž… μžλ™ 등둝
79
+ autoRegister: true,
80
+
81
+ // λ˜λŠ” νŠΉμ • νƒ€μž…λ§Œ μ„ νƒμ μœΌλ‘œ 등둝
82
+ // registerTypes: ['bar', 'line', 'doughnut']
83
+ }
84
+ ```
85
+
86
+ ### μ„€μ • μ˜΅μ…˜
87
+
88
+ | μ˜΅μ…˜ | νƒ€μž… | κΈ°λ³Έκ°’ | μ„€λͺ… |
89
+ |------|------|--------|------|
90
+ | `errorLogging` | `boolean` | `false` | μ—λŸ¬ 둜그 좜λ ₯ μ—¬λΆ€ |
91
+ | `silentMode` | `boolean` | `false` | μ—λŸ¬ λ°œμƒ μ‹œ μ˜ˆμ™Έλ₯Ό λ¬΄μ‹œν•˜κ³  계속 μ‹€ν–‰ |
92
+ | `defaultColor` | `string[]` | κΈ°λ³Έ 색상 νŒ”λ ˆνŠΈ | μ°¨νŠΈμ— μ‚¬μš©ν•  κΈ°λ³Έ 색상 λ°°μ—΄ |
93
+ | `autoRegister` | `boolean` | `false` | λͺ¨λ“  차트 νƒ€μž… μžλ™ 등둝 (bar, line, bubble, doughnut) |
94
+ | `registerTypes` | `ChartType[]` | `[]` | νŠΉμ • 차트 νƒ€μž…λ§Œ μ„ νƒμ μœΌλ‘œ 등둝 |
95
+
96
+ ### μ„€μ • 없이 μ‚¬μš©ν•˜κΈ°
97
+
98
+ μ„€μ • 파일이 없어도 λΌμ΄λΈŒλŸ¬λ¦¬λŠ” 정상 μž‘λ™ν•©λ‹ˆλ‹€. 단, 차트λ₯Ό μ‚¬μš©ν•˜κΈ° 전에 μˆ˜λ™μœΌλ‘œ 등둝해야 ν•©λ‹ˆλ‹€:
99
+
100
+ ```javascript
101
+ import { ChartWrapper, BarChartWrapper, LineChartWrapper } from 'stz-chart-maker';
102
+
103
+ // 차트 νƒ€μž… 등둝
104
+ ChartWrapper.register('bar', BarChartWrapper);
105
+ ChartWrapper.register('line', LineChartWrapper);
106
+
107
+ // 이제 μ‚¬μš© κ°€λŠ₯
108
+ const chart = ChartWrapper.create('bar', labels, datasets);
109
+ ```
110
+
111
+ ### autoRegister vs registerTypes
112
+
113
+ **λͺ¨λ“  νƒ€μž… μžλ™ 등둝:**
114
+ ```javascript
115
+ module.exports = {
116
+ autoRegister: true // bar, line, bubble, doughnut λͺ¨λ‘ 등둝
117
+ }
118
+ ```
119
+
120
+ **νŠΉμ • νƒ€μž…λ§Œ 등둝:**
121
+ ```javascript
122
+ module.exports = {
123
+ registerTypes: ['bar', 'line'] // bar와 line만 등둝
124
+ }
125
+ ```
126
+
44
127
  </div>
package/dist/index.d.ts CHANGED
@@ -1,96 +1,48 @@
1
- import { ChartType, PluginOptionsByType, ChartOptions, GridLineOptions, FontSpec, Tick, Chart, ChartEvent, ActiveElement, LegendOptions, ChartDataset, Plugin as Plugin$1, TooltipItem, ChartTypeRegistry } from 'chart.js';
1
+ import { ChartType, ChartDataset, GridLineOptions, FontSpec, Tick, PluginOptionsByType, ChartOptions, Chart, ChartEvent, ActiveElement, LegendOptions, Plugin as Plugin$1, TooltipItem, ChartTypeRegistry } from 'chart.js';
2
2
  import { ZoomPluginOptions } from 'chartjs-plugin-zoom/types/options';
3
3
  import { DeepPartial as DeepPartial$1 } from 'chart.js/dist/types/utils';
4
4
 
5
5
  /**
6
6
  * ═════════════════════════════════════════════════════════════
7
- * πŸ“„ FILE : zoomType.ts
8
- * πŸ“ PACKAGE : chartjs-toolbox-
7
+ * πŸ“„ FILE : base.ts
8
+ * πŸ“ PACKAGE : types
9
9
  * πŸ‘€ AUTHOR : stz
10
- * πŸ•’ CREATED : 25. 8. 8.
11
- * ═════════════════════════════════════════════════════════════
10
+ * πŸ•’ CREATED : 2025.01.09
12
11
  * ═════════════════════════════════════════════════════════════
13
12
  * πŸ“ DESCRIPTION
14
- * -
15
- * ═════════════════════════════════════════════════════════════
16
- * ═════════════════════════════════════════════════════════════
17
- * πŸ”„ CHANGE LOG
18
- * - DATE : 2025/08/08 | Author : stz | 졜초 생성
13
+ * - 차트 라이브러리의 κΈ°λ³Έ νƒ€μž… μ •μ˜
14
+ * - Align, Position, Color λ“± 곡톡 νƒ€μž… 별칭
15
+ * - 차트 νƒ€μž… λΆ„λ₯˜ (Cartesian, Arc, Radial)
16
+ * - μœ ν‹Έλ¦¬ν‹° νƒ€μž… (DeepPartial, Override)
19
17
  * ═════════════════════════════════════════════════════════════
20
18
  */
21
-
22
- interface PanOptions {
23
- enabled: boolean;
24
- mode?: 'x' | 'y' | 'xy';
25
- modifierKey?: 'ctrl' | 'alt' | 'shift' | 'meta' | null;
26
- scaleMode?: 'x' | 'y' | 'xy' | undefined;
27
- overScaleMode?: 'x' | 'y' | 'xy' | undefined;
28
- threshold?: number;
29
- }
30
- interface ZoomLimit {
31
- min?: number;
32
- max?: number;
33
- }
34
- type ZoomLimits = Record<string, ZoomLimit>;
35
- interface CustomZoomType<TType extends ChartType = ChartType> extends PluginOptionsByType<TType> {
36
- zoom: ZoomPluginOptions;
37
- pan?: PanOptions;
38
- zoomLimits?: ZoomLimits;
39
- }
40
- type DeepPartialZoomType = DeepPartial$1<CustomZoomType>;
41
-
42
- interface DataLabelsContext {
43
- chart: any;
44
- dataset: any;
45
- dataIndex: number;
46
- datasetIndex: number;
47
- }
48
- interface DataLabels {
49
- align: Position;
50
- anchor: Position;
51
- backgroundColor: string;
52
- borderColor: string;
53
- borderRadius: number;
54
- borderWidth: number | ((ctx: DataLabelsContext) => number);
55
- color: string | ((ctx: DataLabelsContext) => string);
56
- display: boolean | ((ctx: DataLabelsContext) => boolean);
57
- formatter: (value: any, ctx: DataLabelsContext) => string | number;
58
- textStrokeColor: string | ((ctx: DataLabelsContext) => string);
59
- textStrokeWidth: number | ((ctx: DataLabelsContext) => number);
60
- textShadowBlur: number;
61
- textShadowColor: string;
62
- }
63
- type PartialDataLabels = Partial<DataLabels>;
64
-
65
- /** β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– κ³΅ν†΅μœΌλ‘œ μ‚¬μš©ν•˜λŠ” νƒ€μž…μ„ μ„ μ–Έν•΄λ†“μŠ΅λ‹ˆλ‹€.β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– */
66
-
67
- interface ChartBuilder<TType extends ChartType> {
68
- setPlugin(plugins: any): this;
69
- removePlugin(pluginId: string): this;
70
- build(id?: string): ChartConfig;
71
- makeConfig(id?: string): ChartConfig;
72
- hasPlugin(pluginId: string): boolean;
73
- onResize(callback: (chart: Chart<TType>, size: {
74
- width: number;
75
- height: number;
76
- }) => void): this;
77
- setTitle(titleOptions: CommonCartesianTitleConfig): this;
78
- setLegend(legendOptions: DeepPartial<LegendOptions<TType>>): this;
79
- getChartData(uid: string): object;
80
- setChartData(uid: string, data: CustomChartDatasets<TType>): void;
81
- }
82
19
  type Align = 'start' | 'center' | 'end';
83
20
  type Position = Align | 'left' | 'right' | 'top' | 'bottom';
21
+ type Color = string | CanvasGradient | CanvasPattern;
22
+ type Mode = 'default' | 'resize' | 'reset' | 'none' | 'hide' | 'show' | 'active';
84
23
  type CartesianChartType = 'line' | 'bar' | 'scatter' | 'bubble';
85
24
  type ArcChartType = 'doughnut' | 'pie';
86
25
  type RadialChartType = 'radar' | 'polarArea';
87
- type Color = string | CanvasGradient | CanvasPattern;
88
- type Mode = 'default' | 'resize' | 'reset' | 'none' | 'hide' | 'show' | 'active';
89
26
  type DeepPartial<T> = {
90
27
  [P in keyof T]?: T[P] extends object ? (T[P] extends Function ? T[P] : DeepPartial<T[P]>) : T[P];
91
28
  };
92
29
  type Override<T, U> = Omit<T, keyof U> & U;
93
- type CustomChartDatasets<TType extends ChartType = ChartType> = ChartDataset<TType, (number | null)[]> & {
30
+
31
+ /**
32
+ * ═════════════════════════════════════════════════════════════
33
+ * πŸ“„ FILE : dataset.ts
34
+ * πŸ“ PACKAGE : types
35
+ * πŸ‘€ AUTHOR : stz
36
+ * πŸ•’ CREATED : 2025.01.09
37
+ * ═════════════════════════════════════════════════════════════
38
+ * πŸ“ DESCRIPTION
39
+ * - Dataset κ΄€λ ¨ νƒ€μž… μ •μ˜
40
+ * - CustomChartDatasets, ArcDataset, CartesianDataset
41
+ * - ν™•μž₯ 속성 (_aux, _uid, _group λ“±)
42
+ * ═════════════════════════════════════════════════════════════
43
+ */
44
+
45
+ interface DatasetExtensions {
94
46
  _aux?: any;
95
47
  _uid?: string;
96
48
  _group?: string | number;
@@ -99,34 +51,40 @@ type CustomChartDatasets<TType extends ChartType = ChartType> = ChartDataset<TTy
99
51
  _tooltip?: string | ((context: any) => string);
100
52
  _groupLabel?: string;
101
53
  _toggleBehavior?: 'normal' | 'radio' | 'disabled';
102
- };
103
- interface SettingOptions {
104
- img: string;
105
- iconSize: {
106
- w: number;
107
- h: number;
108
- };
109
- radiusExtra: number;
110
- offset: {
111
- right: number;
112
- top: number;
113
- };
114
- colors: {
115
- fill: string;
116
- fillHover: string;
117
- stroke: string;
118
- strokeHover: string;
119
- };
120
- borderWidth: {
121
- normal: number;
122
- hover: number;
123
- };
124
- cursor: string;
125
- onClick: (args: {
126
- chart: Chart;
127
- event: MouseEvent;
128
- }) => void;
129
54
  }
55
+ type CustomChartDatasets<TType extends ChartType = ChartType> = ChartDataset<TType, (number | null)[]> & DatasetExtensions;
56
+ type ArcDataset<TType extends ArcChartType = ArcChartType> = ChartDataset<TType, (number | null)[]> & DatasetExtensions;
57
+ type CartesianDataset<TType extends CartesianChartType = CartesianChartType> = ChartDataset<TType, (number | null)[]> & DatasetExtensions & {
58
+ yAxisID?: string;
59
+ xAxisID?: string;
60
+ stack?: string;
61
+ order?: number;
62
+ DATASET_ID?: string;
63
+ };
64
+ type CustomCartesianDataset<TType extends CartesianChartType = CartesianChartType> = ChartDataset<TType, (number | null)[]> & DatasetExtensions & {
65
+ yAxisID?: string;
66
+ xAxisID?: string;
67
+ stack?: string;
68
+ order?: number;
69
+ _dskey?: string;
70
+ image?: string;
71
+ images?: string[];
72
+ };
73
+
74
+ /**
75
+ * ═════════════════════════════════════════════════════════════
76
+ * πŸ“„ FILE : axes.ts
77
+ * πŸ“ PACKAGE : types
78
+ * πŸ‘€ AUTHOR : stz
79
+ * πŸ•’ CREATED : 2025.01.09
80
+ * ═════════════════════════════════════════════════════════════
81
+ * πŸ“ DESCRIPTION
82
+ * - Axes/Scales κ΄€λ ¨ νƒ€μž… μ •μ˜
83
+ * - CommonCartesianAxes, CommonAxesSacels
84
+ * - Title, Legend, Ticks μ„€μ •
85
+ * ═════════════════════════════════════════════════════════════
86
+ */
87
+
130
88
  interface CommonCartesianTitleConfig {
131
89
  display?: boolean;
132
90
  align?: Align;
@@ -217,10 +175,127 @@ interface CommonCartesianAxes extends Omit<CommonAxes, 'ticks'>, Partial<CommonC
217
175
  ticks?: CommonCartesianTicks;
218
176
  }
219
177
  type DeepPartialCartesianAxes = DeepPartial<CommonCartesianAxes>;
220
- type DeepPartialPluginOptions<T extends ChartType> = DeepPartial<PluginOptionsByType<T>>;
221
178
  interface CommonAxesSacels {
222
179
  [key: string]: DeepPartialCartesianAxes;
223
180
  }
181
+
182
+ /**
183
+ * ═════════════════════════════════════════════════════════════
184
+ * πŸ“„ FILE : zoomType.ts
185
+ * πŸ“ PACKAGE : chartjs-toolbox-
186
+ * πŸ‘€ AUTHOR : stz
187
+ * πŸ•’ CREATED : 25. 8. 8.
188
+ * ═════════════════════════════════════════════════════════════
189
+ * ═════════════════════════════════════════════════════════════
190
+ * πŸ“ DESCRIPTION
191
+ * -
192
+ * ═════════════════════════════════════════════════════════════
193
+ * ═════════════════════════════════════════════════════════════
194
+ * πŸ”„ CHANGE LOG
195
+ * - DATE : 2025/08/08 | Author : stz | 졜초 생성
196
+ * ═════════════════════════════════════════════════════════════
197
+ */
198
+
199
+ interface PanOptions {
200
+ enabled: boolean;
201
+ mode?: 'x' | 'y' | 'xy';
202
+ modifierKey?: 'ctrl' | 'alt' | 'shift' | 'meta' | null;
203
+ scaleMode?: 'x' | 'y' | 'xy' | undefined;
204
+ overScaleMode?: 'x' | 'y' | 'xy' | undefined;
205
+ threshold?: number;
206
+ }
207
+ interface ZoomLimit {
208
+ min?: number;
209
+ max?: number;
210
+ }
211
+ type ZoomLimits = Record<string, ZoomLimit>;
212
+ interface CustomZoomType<TType extends ChartType = ChartType> extends PluginOptionsByType<TType> {
213
+ zoom: ZoomPluginOptions;
214
+ pan?: PanOptions;
215
+ zoomLimits?: ZoomLimits;
216
+ }
217
+ type DeepPartialZoomType = DeepPartial$1<CustomZoomType>;
218
+
219
+ interface DataLabelsContext {
220
+ chart: any;
221
+ dataset: any;
222
+ dataIndex: number;
223
+ datasetIndex: number;
224
+ }
225
+ interface DataLabels {
226
+ align: Position;
227
+ anchor: Position;
228
+ backgroundColor: string;
229
+ borderColor: string;
230
+ borderRadius: number;
231
+ borderWidth: number | ((ctx: DataLabelsContext) => number);
232
+ color: string | ((ctx: DataLabelsContext) => string);
233
+ display: boolean | ((ctx: DataLabelsContext) => boolean);
234
+ formatter: (value: any, ctx: DataLabelsContext) => string | number;
235
+ textStrokeColor: string | ((ctx: DataLabelsContext) => string);
236
+ textStrokeWidth: number | ((ctx: DataLabelsContext) => number);
237
+ textShadowBlur: number;
238
+ textShadowColor: string;
239
+ }
240
+ type PartialDataLabels = Partial<DataLabels>;
241
+
242
+ /**
243
+ * ═════════════════════════════════════════════════════════════
244
+ * πŸ“„ FILE : options.ts
245
+ * πŸ“ PACKAGE : types
246
+ * πŸ‘€ AUTHOR : stz
247
+ * πŸ•’ CREATED : 2025.01.09
248
+ * ═════════════════════════════════════════════════════════════
249
+ * πŸ“ DESCRIPTION
250
+ * - ChartOptions κ΄€λ ¨ νƒ€μž… μ •μ˜
251
+ * - CustomChartOptions, CustomArcChartOptions
252
+ * - CustomOptionPlugins, SettingOptions, HtmlLegendOptions
253
+ * ═════════════════════════════════════════════════════════════
254
+ */
255
+
256
+ interface SettingOptions {
257
+ img: string;
258
+ iconSize: {
259
+ w: number;
260
+ h: number;
261
+ };
262
+ radiusExtra: number;
263
+ offset: {
264
+ right: number;
265
+ top: number;
266
+ };
267
+ colors: {
268
+ fill: string;
269
+ fillHover: string;
270
+ stroke: string;
271
+ strokeHover: string;
272
+ };
273
+ borderWidth: {
274
+ normal: number;
275
+ hover: number;
276
+ };
277
+ cursor: string;
278
+ onClick: (args: {
279
+ chart: Chart;
280
+ event: MouseEvent;
281
+ }) => void;
282
+ }
283
+ type HtmlLegendOptions = {
284
+ containerID: string;
285
+ className?: {
286
+ list?: string;
287
+ item?: string;
288
+ box?: string;
289
+ text?: string;
290
+ };
291
+ styles?: {
292
+ text?: Record<string, string>;
293
+ textHidden?: Record<string, string>;
294
+ box?: (item: any, type: string, chart: Chart) => Record<string, string | number>;
295
+ };
296
+ getItemText?: (item: any) => string;
297
+ getDatasetType?: (chart: Chart, item: Record<string, any>) => string | undefined;
298
+ };
224
299
  type CustomOptionPlugins<TType extends ChartType = ChartType> = DeepPartial<PluginOptionsByType<TType>> & {
225
300
  zoom?: DeepPartialZoomType;
226
301
  datalabels?: PartialDataLabels;
@@ -241,6 +316,7 @@ type CustomOptionPlugins<TType extends ChartType = ChartType> = DeepPartial<Plug
241
316
  };
242
317
  htmlLegend?: HtmlLegendOptions;
243
318
  };
319
+ type DeepPartialPluginOptions<T extends ChartType> = DeepPartial<PluginOptionsByType<T>>;
244
320
  type CustomChartOptions<TType extends ChartType = ChartType> = Override<ChartOptions<TType>, {
245
321
  scales?: CommonAxesSacels;
246
322
  plugins?: CustomOptionPlugins<TType>;
@@ -261,6 +337,7 @@ type CustomChartOptions<TType extends ChartType = ChartType> = Override<ChartOpt
261
337
  }> & {
262
338
  _mounted?: (chart: Chart<TType>) => void;
263
339
  _chartId?: string;
340
+ _loading?: boolean;
264
341
  };
265
342
  type CustomArcChartOptions<TType extends ArcChartType = ArcChartType> = CustomChartOptions<TType> & {
266
343
  scales?: never;
@@ -274,62 +351,37 @@ type CustomLineChartOptions = CustomChartOptions<'line'>;
274
351
  type CustomBubbleChartOptions = CustomChartOptions<'bubble'>;
275
352
  type CustomPieChartOptions = CustomArcChartOptions<'pie'>;
276
353
  type CustomDoughnutChartOptions = CustomArcChartOptions<'doughnut'>;
277
- type ArcDataset<TType extends ArcChartType = ArcChartType> = ChartDataset<TType, (number | null)[]> & {
278
- _aux?: boolean;
279
- _group?: string | number;
280
- _legendOrder?: number;
281
- _visible?: boolean;
282
- _tooltip?: string | ((context: any) => string);
283
- _groupLabel?: string;
284
- _toggleBehavior?: 'normal' | 'radio' | 'disabled';
285
- };
286
- type CartesianDataset<TType extends CartesianChartType = CartesianChartType> = ChartDataset<TType, (number | null)[]> & {
287
- yAxisID?: string;
288
- xAxisID?: string;
289
- stack?: string;
290
- order?: number;
291
- DATASET_ID?: string;
292
- _aux?: boolean;
293
- _group?: string | number;
294
- _legendOrder?: number;
295
- _visible?: boolean;
296
- _tooltip?: string | ((context: any) => string);
297
- _groupLabel?: string;
298
- _toggleBehavior?: 'normal' | 'radio' | 'disabled';
299
- };
300
- type Constructor<TType extends ChartType, TInstance> = new (type: TType, labels: (string | number)[], datasets: ChartDataset<TType, (number | null)[]>[], options?: CustomChartOptions<TType>, plugins?: []) => TInstance;
301
- type CustomCartesianDataset<TType extends CartesianChartType = CartesianChartType> = ChartDataset<TType, (number | null)[]> & {
302
- yAxisID?: string;
303
- xAxisID?: string;
304
- stack?: string;
305
- order?: number;
306
- _dskey?: string;
307
- image?: string;
308
- images?: string[];
309
- _aux?: boolean;
310
- _group?: string | number;
311
- _legendOrder?: number;
312
- _visible?: boolean;
313
- _tooltip?: string | ((context: any) => string);
314
- _groupLabel?: string;
315
- _toggleBehavior?: 'normal' | 'radio' | 'disabled';
316
- };
317
- type HtmlLegendOptions = {
318
- containerID: string;
319
- className?: {
320
- list?: string;
321
- item?: string;
322
- box?: string;
323
- text?: string;
324
- };
325
- styles?: {
326
- text?: Record<string, string>;
327
- textHidden?: Record<string, string>;
328
- box?: (item: any, type: string, chart: Chart) => Record<string, string | number>;
329
- };
330
- getItemText?: (item: any) => string;
331
- getDatasetType?: (chart: Chart, item: Record<string, any>) => string | undefined;
332
- };
354
+ type Constructor<TType extends ChartType, TInstance> = new (type: TType, labels: (string | number)[], datasets: any[], options?: CustomChartOptions<TType>, plugins?: []) => TInstance;
355
+
356
+ /**
357
+ * ═════════════════════════════════════════════════════════════
358
+ * πŸ“„ FILE : builders.ts
359
+ * πŸ“ PACKAGE : types
360
+ * πŸ‘€ AUTHOR : stz
361
+ * πŸ•’ CREATED : 2025.01.09
362
+ * ═════════════════════════════════════════════════════════════
363
+ * πŸ“ DESCRIPTION
364
+ * - ChartBuilder μΈν„°νŽ˜μ΄μŠ€ μ •μ˜
365
+ * - CartesianChartBuilder, ArcChartBuilder λ“±
366
+ * - 각 차트 νƒ€μž…λ³„ Builder μΈν„°νŽ˜μ΄μŠ€
367
+ * ═════════════════════════════════════════════════════════════
368
+ */
369
+
370
+ interface ChartBuilder<TType extends string> {
371
+ setPlugin(plugins: any): this;
372
+ removePlugin(pluginId: string): this;
373
+ build(id?: string): ChartConfig;
374
+ makeConfig(id?: string): ChartConfig;
375
+ hasPlugin(pluginId: string): boolean;
376
+ onResize(callback: (chart: Chart<any>, size: {
377
+ width: number;
378
+ height: number;
379
+ }) => void): this;
380
+ setTitle(titleOptions: CommonCartesianTitleConfig): this;
381
+ setLegend(legendOptions: DeepPartial<LegendOptions<any>>): this;
382
+ getChartData(uid: string): object;
383
+ setChartData(uid: string, data: CustomChartDatasets<any>): void;
384
+ }
333
385
  interface CartesianChartBuilder<TType extends CartesianChartType> extends ChartBuilder<TType> {
334
386
  setScales(scales: CommonAxesSacels): this;
335
387
  setAxisTitle(axis: 'x' | 'y', titleConfig: CommonCartesianTitleConfig): this;
@@ -383,18 +435,6 @@ interface LineChartBuilder extends CartesianChartBuilder<'line'> {
383
435
  setAllPointHoverRadius(hoverRadius: number): this;
384
436
  sparkLineChart(): this;
385
437
  }
386
- interface RadarChartBuilder extends ChartBuilder<'radar'> {
387
- }
388
- interface ArcChartBuilder<TType extends ArcChartType> extends ChartBuilder<TType> {
389
- setRotation(rotation: number): this;
390
- setCircumference(circumference: number): this;
391
- setCutout(cutout: string | number): this;
392
- setRadius(radius: string | number): this;
393
- setBorderWidth(datasetIndex: number, borderWidth: number): this;
394
- setAllBorderWidth(borderWidth: number): this;
395
- setBorderColor(datasetIndex: number, borderColor: string | string[]): this;
396
- setAllBorderColor(borderColor: string | string[]): this;
397
- }
398
438
  interface BubbleChartBuilder extends CartesianChartBuilder<'bubble'> {
399
439
  setBubbleRadius(datasetIndex: number, radius: number): this;
400
440
  setBubbleDataRadius(datasetIndex: number, dataIndex: number, radius: number): this;
@@ -411,6 +451,16 @@ interface BubbleChartBuilder extends CartesianChartBuilder<'bubble'> {
411
451
  setAllRotation(rotation: number): this;
412
452
  sparkBubbleChart(): this;
413
453
  }
454
+ interface ArcChartBuilder<TType extends ArcChartType> extends ChartBuilder<TType> {
455
+ setRotation(rotation: number): this;
456
+ setCircumference(circumference: number): this;
457
+ setCutout(cutout: string | number): this;
458
+ setRadius(radius: string | number): this;
459
+ setBorderWidth(datasetIndex: number, borderWidth: number): this;
460
+ setAllBorderWidth(borderWidth: number): this;
461
+ setBorderColor(datasetIndex: number, borderColor: string | string[]): this;
462
+ setAllBorderColor(borderColor: string | string[]): this;
463
+ }
414
464
  interface PieChartBuilder extends ArcChartBuilder<'pie'> {
415
465
  }
416
466
  interface DoughnutChartBuilder extends ArcChartBuilder<'doughnut'> {
@@ -426,6 +476,24 @@ interface DoughnutChartBuilder extends ArcChartBuilder<'doughnut'> {
426
476
  maxFontSize?: number;
427
477
  }): this;
428
478
  }
479
+ interface RadarChartBuilder extends ChartBuilder<'radar'> {
480
+ }
481
+
482
+ /**
483
+ * ═════════════════════════════════════════════════════════════
484
+ * πŸ“„ FILE : commonTypes.ts
485
+ * πŸ“ PACKAGE : types
486
+ * πŸ‘€ AUTHOR : stz
487
+ * πŸ•’ CREATED : 2025.01.09
488
+ * ═════════════════════════════════════════════════════════════
489
+ * πŸ“ DESCRIPTION
490
+ * - λͺ¨λ“  νƒ€μž…μ„ ν•œ κ³³μ—μ„œ export (κΈ°μ‘΄ ν˜Έν™˜μ„± μœ μ§€)
491
+ * - κ°œλ³„ νƒ€μž… 파일둜 λΆ„λ¦¬λœ νƒ€μž…λ“€μ„ re-export
492
+ * ═════════════════════════════════════════════════════════════
493
+ * πŸ”„ CHANGE LOG
494
+ * - 2025.01.09 | stz | νƒ€μž… 파일 뢄리 및 ꡬ쑰화
495
+ * ═════════════════════════════════════════════════════════════
496
+ */
429
497
 
430
498
  type Types_Align = Align;
431
499
  type Types_ArcChartBuilder<TType extends ArcChartType> = ArcChartBuilder<TType>;
@@ -436,7 +504,7 @@ type Types_BubbleChartBuilder = BubbleChartBuilder;
436
504
  type Types_CartesianChartBuilder<TType extends CartesianChartType> = CartesianChartBuilder<TType>;
437
505
  type Types_CartesianChartType = CartesianChartType;
438
506
  type Types_CartesianDataset<TType extends CartesianChartType = CartesianChartType> = CartesianDataset<TType>;
439
- type Types_ChartBuilder<TType extends ChartType> = ChartBuilder<TType>;
507
+ type Types_ChartBuilder<TType extends string> = ChartBuilder<TType>;
440
508
  type Types_Color = Color;
441
509
  type Types_CommonAxes = CommonAxes;
442
510
  type Types_CommonAxesSacels = CommonAxesSacels;
@@ -464,13 +532,14 @@ type Types_DoughnutChartBuilder = DoughnutChartBuilder;
464
532
  type Types_HtmlLegendOptions = HtmlLegendOptions;
465
533
  type Types_LineChartBuilder = LineChartBuilder;
466
534
  type Types_Mode = Mode;
535
+ type Types_Override<T, U> = Override<T, U>;
467
536
  type Types_PieChartBuilder = PieChartBuilder;
468
537
  type Types_Position = Position;
469
538
  type Types_RadarChartBuilder = RadarChartBuilder;
470
539
  type Types_RadialChartType = RadialChartType;
471
540
  type Types_SettingOptions = SettingOptions;
472
541
  declare namespace Types {
473
- export type { Types_Align as Align, Types_ArcChartBuilder as ArcChartBuilder, Types_ArcChartType as ArcChartType, Types_ArcDataset as ArcDataset, Types_BarChartBuilder as BarChartBuilder, Types_BubbleChartBuilder as BubbleChartBuilder, Types_CartesianChartBuilder as CartesianChartBuilder, Types_CartesianChartType as CartesianChartType, Types_CartesianDataset as CartesianDataset, Types_ChartBuilder as ChartBuilder, Types_Color as Color, Types_CommonAxes as CommonAxes, Types_CommonAxesSacels as CommonAxesSacels, Types_CommonCartesian as CommonCartesian, Types_CommonCartesianAxes as CommonCartesianAxes, Types_CommonCartesianLegendConfig as CommonCartesianLegendConfig, Types_CommonCartesianTicks as CommonCartesianTicks, Types_CommonCartesianTitleConfig as CommonCartesianTitleConfig, Types_CommonTicks as CommonTicks, Types_Constructor as Constructor, Types_CustomArcChartOptions as CustomArcChartOptions, Types_CustomBarChartOptions as CustomBarChartOptions, Types_CustomBubbleChartOptions as CustomBubbleChartOptions, Types_CustomCartesianDataset as CustomCartesianDataset, Types_CustomChartDatasets as CustomChartDatasets, Types_CustomChartOptions as CustomChartOptions, Types_CustomDoughnutChartOptions as CustomDoughnutChartOptions, Types_CustomLineChartOptions as CustomLineChartOptions, Types_CustomOptionPlugins as CustomOptionPlugins, Types_CustomPieChartOptions as CustomPieChartOptions, Types_DeepPartial as DeepPartial, Types_DeepPartialCartesianAxes as DeepPartialCartesianAxes, Types_DeepPartialPluginOptions as DeepPartialPluginOptions, Types_DoughnutChartBuilder as DoughnutChartBuilder, Types_HtmlLegendOptions as HtmlLegendOptions, Types_LineChartBuilder as LineChartBuilder, Types_Mode as Mode, Types_PieChartBuilder as PieChartBuilder, Types_Position as Position, Types_RadarChartBuilder as RadarChartBuilder, Types_RadialChartType as RadialChartType, Types_SettingOptions as SettingOptions };
542
+ export type { Types_Align as Align, Types_ArcChartBuilder as ArcChartBuilder, Types_ArcChartType as ArcChartType, Types_ArcDataset as ArcDataset, Types_BarChartBuilder as BarChartBuilder, Types_BubbleChartBuilder as BubbleChartBuilder, Types_CartesianChartBuilder as CartesianChartBuilder, Types_CartesianChartType as CartesianChartType, Types_CartesianDataset as CartesianDataset, Types_ChartBuilder as ChartBuilder, Types_Color as Color, Types_CommonAxes as CommonAxes, Types_CommonAxesSacels as CommonAxesSacels, Types_CommonCartesian as CommonCartesian, Types_CommonCartesianAxes as CommonCartesianAxes, Types_CommonCartesianLegendConfig as CommonCartesianLegendConfig, Types_CommonCartesianTicks as CommonCartesianTicks, Types_CommonCartesianTitleConfig as CommonCartesianTitleConfig, Types_CommonTicks as CommonTicks, Types_Constructor as Constructor, Types_CustomArcChartOptions as CustomArcChartOptions, Types_CustomBarChartOptions as CustomBarChartOptions, Types_CustomBubbleChartOptions as CustomBubbleChartOptions, Types_CustomCartesianDataset as CustomCartesianDataset, Types_CustomChartDatasets as CustomChartDatasets, Types_CustomChartOptions as CustomChartOptions, Types_CustomDoughnutChartOptions as CustomDoughnutChartOptions, Types_CustomLineChartOptions as CustomLineChartOptions, Types_CustomOptionPlugins as CustomOptionPlugins, Types_CustomPieChartOptions as CustomPieChartOptions, Types_DeepPartial as DeepPartial, Types_DeepPartialCartesianAxes as DeepPartialCartesianAxes, Types_DeepPartialPluginOptions as DeepPartialPluginOptions, Types_DoughnutChartBuilder as DoughnutChartBuilder, Types_HtmlLegendOptions as HtmlLegendOptions, Types_LineChartBuilder as LineChartBuilder, Types_Mode as Mode, Types_Override as Override, Types_PieChartBuilder as PieChartBuilder, Types_Position as Position, Types_RadarChartBuilder as RadarChartBuilder, Types_RadialChartType as RadialChartType, Types_SettingOptions as SettingOptions };
474
543
  }
475
544
 
476
545
  interface ChartConfig {
@@ -1985,7 +2054,7 @@ declare enum ChartTypes {
1985
2054
 
1986
2055
  declare const ChartToolBox: {
1987
2056
  setErrorLog(enabled?: boolean): void;
1988
- setErrorshield(enabled?: boolean): void;
2057
+ setErrorShield(enabled?: boolean): void;
1989
2058
  };
1990
2059
  declare const T$: {
1991
2060
  readonly create: typeof ChartWrapper.create;
@@ -2001,9 +2070,9 @@ declare const T$: {
2001
2070
  readonly defaultsOptions: typeof LocalDefaults;
2002
2071
  readonly toolBox: {
2003
2072
  setErrorLog(enabled?: boolean): void;
2004
- setErrorshield(enabled?: boolean): void;
2073
+ setErrorShield(enabled?: boolean): void;
2005
2074
  };
2006
2075
  };
2007
2076
 
2008
2077
  export { ArcChartWrapper, BarChartWrapper, BubbleChartWrapper, CartesianChartWrapper, ChartFactory, ChartInstance, ChartToolBox, ChartTypes, ChartWrapper, CreateZoomRangeSlider, DoughnutChartWrapper, LineChartWrapper, T$, barScaleImgPlugin, blinkPlugin, changeSetting, chartMountPlugin, createDefaultBarOptions, createDefaultBubbleOptions, createDefaultLineOptions, customLegend, T$ as default, defaultBarScales, defaultBarTooltipCallback, defaultBubbleScales, defaultBubbleTooltipCallback, defaultLineScales, defaultLineTooltipCallback, doughnutCenterTextPlugin, loadingPlugin, makeCenterHtml, noDataPlugin, sparkBarOptions, sparkBubbleOptions, sparkLineOptions, zoomRangeSlider, zoomResetPlugin };
2009
- export type { Align, AllChartTypes, ArcChartBuilder, ArcChartType, ArcDataset, AxisColors, BarChartBuilder, BubbleChartBuilder, CartesianChartBuilder, CartesianChartType, CartesianDataset, ChartBuilder, ChartWithFocus, Color, CommonAxes, CommonAxesSacels, CommonCartesian, CommonCartesianAxes, CommonCartesianLegendConfig, CommonCartesianTicks, CommonCartesianTitleConfig, CommonTicks, Constructor, CustomArcChartOptions, CustomBarChartOptions, CustomBubbleChartOptions, CustomCartesianDataset, CustomChartDatasets, CustomChartOptions, CustomDoughnutChartOptions, CustomLineChartOptions, CustomOptionPlugins, CustomPieChartOptions, CustomZoomType, DataLabels, DataLabelsContext, DatasetWithPrevColors, DeepPartial, DeepPartialCartesianAxes, DeepPartialPluginOptions, DeepPartialZoomType, DoughnutChartBuilder, FocusCallback, HtmlLegendOptions, LineChartBuilder, Mode, OriginalColors, PartialDataLabels, PieChartBuilder, Position, RadarChartBuilder, RadialChartType, ScaleWithOriginalColors, SettingOptions, ZoomRangeSliderColors, ZoomRangeSliderPlugin, ZoomRangeSliderVar };
2078
+ export type { Align, AllChartTypes, ArcChartBuilder, ArcChartType, ArcDataset, AxisColors, BarChartBuilder, BubbleChartBuilder, CartesianChartBuilder, CartesianChartType, CartesianDataset, ChartBuilder, ChartWithFocus, Color, CommonAxes, CommonAxesSacels, CommonCartesian, CommonCartesianAxes, CommonCartesianLegendConfig, CommonCartesianTicks, CommonCartesianTitleConfig, CommonTicks, Constructor, CustomArcChartOptions, CustomBarChartOptions, CustomBubbleChartOptions, CustomCartesianDataset, CustomChartDatasets, CustomChartOptions, CustomDoughnutChartOptions, CustomLineChartOptions, CustomOptionPlugins, CustomPieChartOptions, CustomZoomType, DataLabels, DataLabelsContext, DatasetWithPrevColors, DeepPartial, DeepPartialCartesianAxes, DeepPartialPluginOptions, DeepPartialZoomType, DoughnutChartBuilder, FocusCallback, HtmlLegendOptions, LineChartBuilder, Mode, OriginalColors, Override, PartialDataLabels, PieChartBuilder, Position, RadarChartBuilder, RadialChartType, ScaleWithOriginalColors, SettingOptions, ZoomRangeSliderColors, ZoomRangeSliderPlugin, ZoomRangeSliderVar };