stz-chart-maker 1.0.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.
@@ -0,0 +1,1022 @@
1
+ import { ChartType, PluginOptionsByType, ChartOptions, GridLineOptions, FontSpec, Tick, Chart, ChartDataset, Plugin as Plugin$1, TooltipItem } from 'chart.js';
2
+ import { ZoomPluginOptions } from 'chartjs-plugin-zoom/types/options';
3
+ import { DeepPartial as DeepPartial$1 } from 'chart.js/dist/types/utils';
4
+
5
+ /**
6
+ * ═════════════════════════════════════════════════════════════
7
+ * 📄 FILE : zoomType.ts
8
+ * 📁 PACKAGE : chartjs-toolbox-
9
+ * 👤 AUTHOR : stz
10
+ * 🕒 CREATED : 25. 8. 8.
11
+ * ═════════════════════════════════════════════════════════════
12
+ * ═════════════════════════════════════════════════════════════
13
+ * 📝 DESCRIPTION
14
+ * -
15
+ * ═════════════════════════════════════════════════════════════
16
+ * ═════════════════════════════════════════════════════════════
17
+ * 🔄 CHANGE LOG
18
+ * - DATE : 2025/08/08 | Author : stz | 최초 생성
19
+ * ═════════════════════════════════════════════════════════════
20
+ */
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$1<TType extends ChartType> {
68
+ setPlugin(plugins: any): this;
69
+ removePlugin(pluginId: string): this;
70
+ build(id?: string): any;
71
+ }
72
+ type Position = 'start' | 'center' | 'end' | 'left' | 'right' | 'top' | 'bottom';
73
+ type CartesianChartType = 'line' | 'bar' | 'scatter' | 'bubble';
74
+ type Color = string | CanvasGradient | CanvasPattern;
75
+ type Mode = 'default' | 'resize' | 'reset' | 'none' | 'hide' | 'show' | 'active';
76
+ type DeepPartial<T> = {
77
+ [P in keyof T]?: T[P] extends object ? (T[P] extends Function ? T[P] : DeepPartial<T[P]>) : T[P];
78
+ };
79
+ type Override<T, U> = Omit<T, keyof U> & U;
80
+ interface SettingOptions {
81
+ img: string;
82
+ iconSize: {
83
+ w: number;
84
+ h: number;
85
+ };
86
+ radiusExtra: number;
87
+ offset: {
88
+ right: number;
89
+ top: number;
90
+ };
91
+ colors: {
92
+ fill: string;
93
+ fillHover: string;
94
+ stroke: string;
95
+ strokeHover: string;
96
+ };
97
+ borderWidth: {
98
+ normal: number;
99
+ hover: number;
100
+ };
101
+ cursor: string;
102
+ onClick: (args: {
103
+ chart: Chart;
104
+ event: MouseEvent;
105
+ }) => void;
106
+ }
107
+ interface CommonCartesianTitleConfig {
108
+ display?: boolean;
109
+ align?: Position;
110
+ text?: string | string[];
111
+ color?: string;
112
+ font?: FontSpec;
113
+ padding?: {
114
+ top?: number;
115
+ bottom?: number;
116
+ left?: number;
117
+ right?: number;
118
+ };
119
+ }
120
+ interface CommonCartesian {
121
+ bounds: string;
122
+ clip: boolean;
123
+ position: Position;
124
+ stack: string;
125
+ stackWeight: number;
126
+ axis: string;
127
+ offset: boolean;
128
+ title: CommonCartesianTitleConfig;
129
+ }
130
+ interface CommonTicks {
131
+ backdropColor?: Color;
132
+ backdropPadding?: number;
133
+ callback?: (value: string | number, index: number, ticks: Tick[]) => string | number | null;
134
+ display?: boolean;
135
+ color?: Color;
136
+ font?: FontSpec;
137
+ major?: object;
138
+ padding?: number;
139
+ showLabelBackdrop?: boolean;
140
+ textStrokeColor?: Color;
141
+ textStrokeWidth?: number;
142
+ z?: number;
143
+ }
144
+ interface CommonCartesianTicks extends CommonTicks {
145
+ align?: Position;
146
+ crossAlign?: 'near' | 'center' | 'far';
147
+ sampleSize?: number;
148
+ autoSkip?: true;
149
+ autoSkipPadding?: number;
150
+ includeBounds?: boolean;
151
+ labelOffset?: number;
152
+ maxRotation?: number;
153
+ mirror?: boolean;
154
+ padding?: number;
155
+ maxTicksLimit?: number;
156
+ }
157
+ interface CommonAxes {
158
+ type: string;
159
+ alignToPixels: boolean;
160
+ backgroundColor: string | CanvasGradient | CanvasPattern;
161
+ border: object;
162
+ display: boolean;
163
+ grid: GridLineOptions;
164
+ min: number;
165
+ max: number;
166
+ reverse: boolean;
167
+ stacked: boolean | string;
168
+ suggestedMax: number;
169
+ suggestedMin: number;
170
+ ticks: object;
171
+ weight: number;
172
+ }
173
+ interface CommonCartesianAxes extends Omit<CommonAxes, 'ticks'>, Partial<CommonCartesian> {
174
+ type: 'category' | 'linear' | 'logarithmic' | 'time' | 'timeseries';
175
+ ticks?: CommonCartesianTicks;
176
+ }
177
+ type DeepPartialCartesianAxes = DeepPartial<CommonCartesianAxes>;
178
+ type DeepPartialPluginOptions<T extends ChartType> = DeepPartial<PluginOptionsByType<T>>;
179
+ interface CommonAxesSacels {
180
+ [key: string]: DeepPartialCartesianAxes;
181
+ }
182
+ type CustomOptionPlugins<TType extends ChartType = ChartType> = Partial<PluginOptionsByType<TType>> & {
183
+ zoom?: DeepPartialZoomType;
184
+ datalabels?: PartialDataLabels;
185
+ settingsIcon?: {
186
+ iconSize?: Record<'w' | 'h', number>;
187
+ img?: string;
188
+ radiusExtra?: number;
189
+ offset?: Record<'right' | 'top', number>;
190
+ colors?: {
191
+ fill?: string;
192
+ fillHover?: string;
193
+ stroke?: string;
194
+ strokeHover?: string;
195
+ };
196
+ borderWidth?: Record<'normal' | 'hover', number>;
197
+ cursor?: string;
198
+ onClick?: (chart: Chart<TType>, event: MouseEvent) => void;
199
+ };
200
+ htmlLegend: HtmlLegendOptions;
201
+ };
202
+ type CustomChartOptions<TType extends ChartType = ChartType> = Override<ChartOptions<TType>, {
203
+ scales?: CommonAxesSacels;
204
+ plugins?: CustomOptionPlugins<TType>;
205
+ layout?: {
206
+ padding?: {
207
+ top?: number;
208
+ bottom?: number;
209
+ left?: number;
210
+ right?: number;
211
+ };
212
+ };
213
+ }> & {
214
+ _mounted?: (chart: Chart<TType>) => void;
215
+ _chartId?: string;
216
+ };
217
+ type CustomBarChartOptions = CustomChartOptions<'bar'>;
218
+ type CustomLineChartOptions = CustomChartOptions<'line'>;
219
+ type CustomPieChartOptions = CustomChartOptions<'pie'>;
220
+ type CartesianDataset<TType extends CartesianChartType = CartesianChartType> = ChartDataset<TType, (number | null)[]> & {
221
+ yAxisID?: string;
222
+ xAxisID?: string;
223
+ stack?: string;
224
+ order?: number;
225
+ DATASET_ID?: string;
226
+ };
227
+ type Constructor<TType extends ChartType, TInstance> = new (type: TType, labels: (string | number)[], datasets: TType extends CartesianChartType ? CartesianDataset<TType>[] : ChartDataset<TType, (number | null)[]>[], options?: CustomChartOptions<TType>, plugins?: []) => TInstance;
228
+ type CustomCartesianDataset<TType extends CartesianChartType = CartesianChartType> = ChartDataset<TType, (number | null)[]> & {
229
+ yAxisID?: string;
230
+ xAxisID?: string;
231
+ stack?: string;
232
+ order?: number;
233
+ _dskey?: string;
234
+ image?: string;
235
+ images?: string[];
236
+ };
237
+ type HtmlLegendOptions = {
238
+ containerID: string;
239
+ className?: {
240
+ list?: string;
241
+ item?: string;
242
+ box?: string;
243
+ text?: string;
244
+ };
245
+ styles?: {
246
+ text?: Record<string, string>;
247
+ textHidden?: Record<string, string>;
248
+ box?: (item: any, type: string, chart: Chart) => Record<string, string | number>;
249
+ };
250
+ getItemText?: (item: any) => string;
251
+ getDatasetType?: (chart: Chart, item: Record<string, any>) => string | undefined;
252
+ };
253
+ interface CartesianChartBuilder<TType extends CartesianChartType> extends ChartBuilder$1<TType> {
254
+ makeConfig(id?: string): any;
255
+ hasPlugin(pluginId: string): boolean;
256
+ setScales(scales: CommonAxesSacels): this;
257
+ setAxisTitle(axis: 'x' | 'y', titleConfig: CommonCartesianTitleConfig): this;
258
+ setGridOptions(axis: 'x' | 'y', gridOptions: {
259
+ display?: boolean;
260
+ color?: string;
261
+ lineWidth?: number;
262
+ }): this;
263
+ addZoom(defaultZoom?: boolean, zoomOption?: object): this;
264
+ addDataLabels(defultDataLabels?: boolean, dataLabelsOptions?: PartialDataLabels): this;
265
+ setYAxisForDataset(datasetIndex: number, axisId?: string): this;
266
+ setAxisRange(axis: 'x' | 'y', min?: number, max?: number): this;
267
+ setYAxisID(datasetIndex: number, axisID: string): this;
268
+ setAxisPosition(axis: string, position: 'left' | 'right'): this;
269
+ setPadding(padding: any): this;
270
+ setBackgroundAlpha(alpha: number): this;
271
+ setParsingKey(xAxisKey: string | false, yAxisKey: string | false): this;
272
+ setDatasetParsing(datasetIndex: number, xAxisKey: string | false, yAxisKey: string | false): this;
273
+ setAllDatasetsParsing(xAxisKey: string | false, yAxisKey: string | false): this;
274
+ customLegend(obj: HtmlLegendOptions): this;
275
+ }
276
+ interface BarChartBuilder extends CartesianChartBuilder<'bar'> {
277
+ setBarThickness(datasetIndex: number, thickness: number): this;
278
+ setAllBarThickness(thickness: number): this;
279
+ setMaxBarThickness(datasetIndex: number, maxThickness: number): this;
280
+ setAllMaxBarThickness(maxThickness: number): this;
281
+ setBarPercentage(datasetIndex: number, percentage: number): this;
282
+ setAllBarPercentage(percentage: number): this;
283
+ setCategoryPercentage(datasetIndex: number, percentage: number): this;
284
+ setAllCategoryPercentage(percentage: number): this;
285
+ setBorderWidth(datasetIndex: number, borderWidth: number): this;
286
+ setAllBorderWidth(borderWidth: number): this;
287
+ setBorderRadius(datasetIndex: number, borderRadius: number): this;
288
+ setAllBorderRadius(borderRadius: number): this;
289
+ setStacked(isStacked: boolean): this;
290
+ setBarImg(axis: string): this;
291
+ }
292
+ interface LineChartBuilder extends CartesianChartBuilder<'line'> {
293
+ setFill(datasetIndex: number, enable: boolean, backgroundColor?: string): this;
294
+ setAllFill(enable: boolean, backgroundColor?: string): this;
295
+ setTension(datasetIndex: number, tension: number): this;
296
+ setAllTension(tension: number): this;
297
+ setBorderWidth(datasetIndex: number, borderWidth: number): this;
298
+ setAllBorderWidth(borderWidth: number): this;
299
+ setPointRadius(datasetIndex: number, radius: number): this;
300
+ setAllPointRadius(radius: number): this;
301
+ setPointHoverRadius(datasetIndex: number, hoverRadius: number): this;
302
+ setAllPointHoverRadius(hoverRadius: number): this;
303
+ }
304
+
305
+ type Types_BarChartBuilder = BarChartBuilder;
306
+ type Types_CartesianChartBuilder<TType extends CartesianChartType> = CartesianChartBuilder<TType>;
307
+ type Types_CartesianChartType = CartesianChartType;
308
+ type Types_CartesianDataset<TType extends CartesianChartType = CartesianChartType> = CartesianDataset<TType>;
309
+ type Types_Color = Color;
310
+ type Types_CommonAxes = CommonAxes;
311
+ type Types_CommonAxesSacels = CommonAxesSacels;
312
+ type Types_CommonCartesian = CommonCartesian;
313
+ type Types_CommonCartesianAxes = CommonCartesianAxes;
314
+ type Types_CommonCartesianTicks = CommonCartesianTicks;
315
+ type Types_CommonCartesianTitleConfig = CommonCartesianTitleConfig;
316
+ type Types_CommonTicks = CommonTicks;
317
+ type Types_Constructor<TType extends ChartType, TInstance> = Constructor<TType, TInstance>;
318
+ type Types_CustomBarChartOptions = CustomBarChartOptions;
319
+ type Types_CustomCartesianDataset<TType extends CartesianChartType = CartesianChartType> = CustomCartesianDataset<TType>;
320
+ type Types_CustomChartOptions<TType extends ChartType = ChartType> = CustomChartOptions<TType>;
321
+ type Types_CustomLineChartOptions = CustomLineChartOptions;
322
+ type Types_CustomOptionPlugins<TType extends ChartType = ChartType> = CustomOptionPlugins<TType>;
323
+ type Types_CustomPieChartOptions = CustomPieChartOptions;
324
+ type Types_DeepPartial<T> = DeepPartial<T>;
325
+ type Types_DeepPartialCartesianAxes = DeepPartialCartesianAxes;
326
+ type Types_DeepPartialPluginOptions<T extends ChartType> = DeepPartialPluginOptions<T>;
327
+ type Types_HtmlLegendOptions = HtmlLegendOptions;
328
+ type Types_LineChartBuilder = LineChartBuilder;
329
+ type Types_Mode = Mode;
330
+ type Types_Position = Position;
331
+ type Types_SettingOptions = SettingOptions;
332
+ declare namespace Types {
333
+ export type { Types_BarChartBuilder as BarChartBuilder, Types_CartesianChartBuilder as CartesianChartBuilder, Types_CartesianChartType as CartesianChartType, Types_CartesianDataset as CartesianDataset, ChartBuilder$1 as ChartBuilder, Types_Color as Color, Types_CommonAxes as CommonAxes, Types_CommonAxesSacels as CommonAxesSacels, Types_CommonCartesian as CommonCartesian, Types_CommonCartesianAxes as CommonCartesianAxes, Types_CommonCartesianTicks as CommonCartesianTicks, Types_CommonCartesianTitleConfig as CommonCartesianTitleConfig, Types_CommonTicks as CommonTicks, Types_Constructor as Constructor, Types_CustomBarChartOptions as CustomBarChartOptions, Types_CustomCartesianDataset as CustomCartesianDataset, Types_CustomChartOptions as CustomChartOptions, 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_HtmlLegendOptions as HtmlLegendOptions, Types_LineChartBuilder as LineChartBuilder, Types_Mode as Mode, Types_Position as Position, Types_SettingOptions as SettingOptions };
334
+ }
335
+
336
+ interface ChartConfig {
337
+ _chartId: string;
338
+ type: ChartType;
339
+ data: any;
340
+ options: any;
341
+ plugins?: any;
342
+ }
343
+ interface ChartBuilder<TType extends ChartType> {
344
+ setPlugin(plugins: any): this;
345
+ removePlugin(pluginId: string): this;
346
+ build(id?: string): ChartConfig;
347
+ }
348
+ declare abstract class ChartWrapper<TType extends ChartType> implements ChartBuilder<TType> {
349
+ protected type: TType;
350
+ protected labels: (string | number)[];
351
+ protected datasets: ChartDataset<TType, (number | null)[]>[];
352
+ protected options: CustomChartOptions<TType>;
353
+ protected plugins?: any | undefined;
354
+ static registry: Map<string, Constructor<any, any>>;
355
+ constructor(type: TType, labels: (string | number)[], datasets: ChartDataset<TType, (number | null)[]>[], options: CustomChartOptions<TType>, plugins?: any | undefined);
356
+ static create<TType extends ChartType>(type: TType, labels: (string | number)[], datasets: ChartDataset<TType, (number | null)[]>[], options?: CustomChartOptions<TType>, plugins?: any): ChartBuilder<TType>;
357
+ protected abstract normalize(): void;
358
+ protected abstract configAop(config: any): any;
359
+ static register<TType extends ChartType, TInstance>(type: TType, wrapperClass: Constructor<TType, TInstance>): void;
360
+ /**
361
+ * 플러그인을 추가합니다.
362
+ * @param plugin
363
+ * @param replaceIfExists
364
+ *
365
+ */
366
+ setPlugin(plugin: any, replaceIfExists?: boolean): this;
367
+ /**
368
+ * 차트 설정 객체를 생성합니다.
369
+ * @param {string} id
370
+ * @returns {ChartConfig}
371
+ * @Description 레거시 지원용
372
+ */
373
+ makeConfig(id?: string): ChartConfig;
374
+ /**
375
+ * 플러그인을 제거합니다.
376
+ * @param pluginId
377
+ */
378
+ removePlugin(pluginId: string): this;
379
+ /**
380
+ * 플러그인이 존재하는지 확인합니다.
381
+ * @param pluginId
382
+ */
383
+ hasPlugin(pluginId: string): boolean;
384
+ build(id?: string): ChartConfig;
385
+ }
386
+
387
+ interface ZoomRangeSliderColors {
388
+ sliderTrackColor?: string;
389
+ sliderActiveColor?: string;
390
+ sliderHandleColor?: string;
391
+ sliderHandleBorderColor?: string;
392
+ sliderHandleHoverColor?: string;
393
+ }
394
+ interface ZoomRangeSliderVar {
395
+ min: number;
396
+ isDragging: boolean;
397
+ circlePosition: number | null;
398
+ }
399
+ interface ZoomRangeSliderPlugin {
400
+ id: 'zoomRangeSlider';
401
+ var: ZoomRangeSliderVar;
402
+ afterDatasetDraw(chart: Chart, args: any, options: any): void;
403
+ afterUpdate(chart: Chart, args: any, options: any): void;
404
+ afterEvent(chart: Chart, args: any, options: any): void;
405
+ }
406
+
407
+ declare abstract class CartesianChartWrapper<TType extends CartesianChartType> extends ChartWrapper<TType> implements CartesianChartBuilder<TType> {
408
+ readonly type: TType;
409
+ private _chartId?;
410
+ protected constructor(type: TType, labels: (string | number)[], datasets: CustomCartesianDataset<TType>[], options?: CustomChartOptions<TType>, plugins?: Plugin);
411
+ get chartId(): string;
412
+ set chartId(value: string);
413
+ protected requireLabels(): boolean;
414
+ protected decorateDataset(ds: any, idx: number): void;
415
+ protected mustHavePlugins(): {
416
+ id: string;
417
+ afterDraw(chart: any, args: any, options: any): void;
418
+ }[];
419
+ protected isLine(): boolean;
420
+ protected isScatter(): boolean;
421
+ protected isBar(): boolean;
422
+ protected normalize(): void;
423
+ protected configAop(config: any): any;
424
+ makeConfig(id?: string): {
425
+ _chartId: any;
426
+ type: any;
427
+ data: any;
428
+ options: any;
429
+ plugins: any;
430
+ };
431
+ /**
432
+ * Cartesian chart type을 체크 합니다.
433
+ * @private
434
+ * *
435
+ * @remarks cartesina 차트의 타입인지 확인합니다
436
+ * @example
437
+ * @since 1.0.0
438
+ * @category Chart
439
+ * @defaultValue
440
+ *
441
+ */
442
+ private isCartesianChartType;
443
+ /**
444
+ * 카테시안 차트의 스케일을 설정합니다.
445
+ * @param scales
446
+ * *
447
+ * @remarks 카테시안 차트의 스케일을 설정합니다. 이 메소드는 차트의 축을 정의하는데 사용됩니다.
448
+ * @example
449
+ * @since 1.0.0
450
+ * @category Scales
451
+ * @defaultValue
452
+ *
453
+ */
454
+ setScales(scales: CommonAxesSacels): this;
455
+ /**
456
+ * 카테시안 차트의 축 제목을 설정합니다.
457
+ * @param axis
458
+ * @param titleConfig
459
+ * *
460
+ * @remarks 원하는 축의 제목을 설정합니다.
461
+ * @example
462
+ * @since 1.0.0
463
+ * @category Scales
464
+ * @defaultValue
465
+ *
466
+ */
467
+ setAxisTitle(axis: 'x' | 'y', titleConfig: CommonCartesianTitleConfig): this;
468
+ /**
469
+ * 카테시안 차트의 그리드 옵션을 설정합니다.
470
+ * @param axis
471
+ * @param gridOptions
472
+ * *
473
+ * @remarks 차트 뒷 배경의 그리드(선) 옵션을 설정합니다.
474
+ * @example
475
+ * @since 1.0.0
476
+ * @category Scales
477
+ * @defaultValue
478
+ *
479
+ */
480
+ setGridOptions(axis: 'x' | 'y', gridOptions: {
481
+ display?: boolean;
482
+ color?: string;
483
+ lineWidth?: number;
484
+ }): this;
485
+ /**
486
+ * 줌 기능을 추가합니다.
487
+ * @param defaultZoom
488
+ * @param zoomOption
489
+ * *
490
+ * @remarks 차트의 줌 기능을 추가합니다. 해당 기능은 플러그인 설치가 필요합니다.
491
+ * @example
492
+ * @since 1.0.0
493
+ * @category Plugins
494
+ * @defaultValue defaultZoom = false
495
+ *
496
+ */
497
+ addZoom(defaultZoom?: boolean, zoomOption?: object): this;
498
+ /**
499
+ * 데이터 라벨 플러그인을 추가합니다.
500
+ * @param defultDataLabels
501
+ * @param dataLabelsOptions
502
+ * @Description 차트에 데이터 라벨을 추가합니다. 기본 옵션을 사용하거나 사용자 정의 옵션을 적용할 수 있습니다.
503
+ * @Category Plugins
504
+ * @since 1.0.0
505
+ * @defaultValue defultDataLabels = false
506
+ */
507
+ addDataLabels(defultDataLabels: boolean | undefined, dataLabelsOptions: PartialDataLabels): this;
508
+ /**
509
+ * 데이터셋에 y축을 설정합니다.
510
+ * @param datasetIndex
511
+ * @param axisId
512
+ * *
513
+ * @remarks 각 데이터셋의 축을 설정합니다.
514
+ * @example
515
+ * @since 1.0.0
516
+ * @category Scales
517
+ * @defaultValue axisId = 'y'
518
+ *
519
+ */
520
+ setYAxisForDataset(datasetIndex: number, axisId?: string): this;
521
+ /**
522
+ * y1 축을 보장합니다.
523
+ * @private
524
+ * *
525
+ * @remarks y1 축이 없을 경우 기본 구조를 추가합니다. 이 메소드는 y1 축을 사용하는 차트에서 필요합니다.
526
+ * @example
527
+ * @since 1.0.0
528
+ * @category Scales
529
+ * @defaultValue
530
+ *
531
+ */
532
+ private ensureY1AxisExists;
533
+ /**
534
+ * 카테시안 차트의 축 범위를 설정합니다.
535
+ * @param axis
536
+ * @param min
537
+ * @param max
538
+ *
539
+ * *
540
+ * @remarks 해당 차트의 스케일을 min, max 를 입력 받은 값으로 고정합니다.
541
+ * @example
542
+ * @since 1.0.0
543
+ * @category Scales
544
+ * @defaultValue
545
+ *
546
+ */
547
+ setAxisRange(axis: 'x' | 'y', min?: number, max?: number): this;
548
+ /**
549
+ * 데이터셋의 yAxisID를 설정합니다.
550
+ * @param datasetIndex
551
+ * @param axisID
552
+ * *
553
+ * @remarks 각 데이터셋의 축 아이디를 변경합니다.
554
+ * @example
555
+ * @since 1.0.0
556
+ * @category Scales
557
+ * @defaultValue
558
+ *
559
+ */
560
+ setYAxisID(datasetIndex: number, axisID: string): this;
561
+ /**
562
+ * 축의 위치를 설정합니다.
563
+ * @param axis
564
+ * @param position
565
+ * *
566
+ * @remarks 해당하는 축의 위치를 변경합니다.
567
+ * @example
568
+ * @since 1.0.0
569
+ * @category Scales
570
+ * @defaultValue
571
+ *
572
+ */
573
+ setAxisPosition(axis: string, position: 'left' | 'right'): this;
574
+ /**
575
+ * 축에 이미지를 추가합니다.
576
+ * @param {string} axis
577
+ * @Deprecated
578
+ */
579
+ setAddImg(axis: string): this;
580
+ /**
581
+ * 범위 슬라이더를 추가합니다.
582
+ * @param options - 슬라이더 커스터마이징 옵션
583
+ * @Deprecated
584
+ */
585
+ addRangeSlider(colors?: ZoomRangeSliderColors): this;
586
+ setPadding(padding: any): this;
587
+ setBackgroundAlpha(alpha: number): this;
588
+ /**
589
+ * 색상에 알파 값을 추가합니다.
590
+ * @param color
591
+ * @param alpha
592
+ * @private
593
+ */
594
+ private addAlphaToColor;
595
+ /**
596
+ *
597
+ * @param {string | false} xAxisKey
598
+ * @param {string | false} yAxisKey
599
+ * @description
600
+ * @Category options
601
+ * @Since 1.0.0
602
+ */
603
+ setParsingKey(xAxisKey: string | false, yAxisKey: string | false): this;
604
+ setDatasetParsing(datasetIndex: number, xAxisKey: string | false, yAxisKey: string | false): this;
605
+ setAllDatasetsParsing(xAxisKey: string | false, yAxisKey: string | false): this;
606
+ customLegend(obj: HtmlLegendOptions): this;
607
+ }
608
+
609
+ declare enum ChartTypes {
610
+ BAR = "bar",
611
+ LINE = "line",
612
+ DOUGHNUT = "doughnut",
613
+ PIE = "pie",
614
+ RADAR = "radar",
615
+ BUBBLE = "bubble",
616
+ SCATTER = "scatter",
617
+ TREE = "tree"
618
+ }
619
+
620
+ declare class BarChartWrapper extends CartesianChartWrapper<'bar'> implements BarChartBuilder {
621
+ constructor(type: ChartTypes.BAR, labels: (string | number)[], datasets: CartesianDataset<ChartTypes.BAR>[], options?: CustomBarChartOptions, plugins?: any);
622
+ protected requireLabels(): boolean;
623
+ makeConfig(id?: string): {
624
+ _chartId: any;
625
+ type: any;
626
+ data: any;
627
+ options: any;
628
+ plugins: any;
629
+ };
630
+ /**
631
+ *
632
+ * @param {number} datasetIndex
633
+ * @param {number} thickness
634
+ * @description 데이터셋의 Bar Thickness를 설정합니다.
635
+ * @Since 1.0.0
636
+ * @category dataset
637
+ */
638
+ setBarThickness(datasetIndex: number, thickness: number): this;
639
+ /**
640
+ *
641
+ * @param {number} thickness
642
+ * @description 모든 데이터셋의 Bar Thickness를 설정합니다.
643
+ * @Since 1.0.0
644
+ * @category dataset
645
+ */
646
+ setAllBarThickness(thickness: number): this;
647
+ /**
648
+ *
649
+ * @param {number} datasetIndex
650
+ * @param {number} maxThickness
651
+ * @description 데이터셋의 Max Bar Thickness를 설정합니다.
652
+ * @Since 1.0.0
653
+ * @category dataset
654
+ */
655
+ setMaxBarThickness(datasetIndex: number, maxThickness: number): this;
656
+ /**
657
+ *
658
+ * @param {number} maxThickness
659
+ * @description 모든 데이터셋의 Max Bar Thickness를 설정합니다.
660
+ * @Since 1.0.0
661
+ * @category dataset
662
+ */
663
+ setAllMaxBarThickness(maxThickness: number): this;
664
+ /**
665
+ *
666
+ * @param {number} datasetIndex
667
+ * @param {number} percentage
668
+ * @description 데이터셋의 Bar Percentage를 설정합니다.
669
+ * @Since 1.0.0
670
+ * @category dataset
671
+ */
672
+ setBarPercentage(datasetIndex: number, percentage: number): this;
673
+ /**
674
+ *
675
+ * @param {number} percentage
676
+ * @description 모든 데이터셋의 Bar Percentage를 설정합니다.
677
+ * @Since 1.0.0
678
+ * @category dataset
679
+ */
680
+ setAllBarPercentage(percentage: number): this;
681
+ /**
682
+ *
683
+ * @param {number} datasetIndex
684
+ * @param {number} percentage
685
+ * @description 데이터셋의 Category Percentage를 설정합니다.
686
+ * @Since 1.0.0
687
+ * @category dataset
688
+ */
689
+ setCategoryPercentage(datasetIndex: number, percentage: number): this;
690
+ /**
691
+ *
692
+ * @param {number} percentage
693
+ * @description 모든 데이터셋의 Category Percentage를 설정합니다.
694
+ * @Since 1.0.0
695
+ * @category dataset
696
+ */
697
+ setAllCategoryPercentage(percentage: number): this;
698
+ /**
699
+ *
700
+ * @param {number} datasetIndex
701
+ * @param {number} borderWidth
702
+ * @description 데이터셋의 Border Width 설정합니다.
703
+ * @Since 1.0.0
704
+ * @category dataset
705
+ */
706
+ setBorderWidth(datasetIndex: number, borderWidth: number): this;
707
+ /**
708
+ *
709
+ * @param {number} borderWidth
710
+ * @description 모든 데이터셋의 Border Width 설정합니다.
711
+ * @Since 1.0.0
712
+ * @category dataset
713
+ */
714
+ setAllBorderWidth(borderWidth: number): this;
715
+ /**
716
+ *
717
+ * @param {number} datasetIndex
718
+ * @param {number} borderRadius
719
+ * @description 데이터셋의 Border Radius 를 설정합니다.
720
+ * @Since 1.0.0
721
+ * @category dataset
722
+ */
723
+ setBorderRadius(datasetIndex: number, borderRadius: number): this;
724
+ /**
725
+ *
726
+ * @param {number} borderRadius
727
+ * @description 모든 데이터셋의 Border Radius 를 설정합니다.
728
+ * @Since 1.0.0
729
+ * @category dataset
730
+ */
731
+ setAllBorderRadius(borderRadius: number): this;
732
+ /**
733
+ *
734
+ * @param {boolean} isStacked
735
+ * @description 모든 축에 대해 Stacked 옵션을 설정합니다.
736
+ * @Since 1.0.0
737
+ * @category scales
738
+ */
739
+ setStacked(isStacked: boolean): this;
740
+ /**
741
+ *
742
+ * @param {string} axis
743
+ * @description 축에 이미지를 설정합니다. 축이 이미 존재하는 경우 경고 메시지를 출력합니다.
744
+ * @Since 1.0.0
745
+ * @category plugins
746
+ * @Returns {this}
747
+ */
748
+ setBarImg(axis: string): this;
749
+ }
750
+
751
+ declare class LineChartWrapper extends CartesianChartWrapper<'line'> implements LineChartBuilder {
752
+ constructor(type: ChartTypes.LINE, labels: (string | number)[], datasets: CartesianDataset<'line'>[], options?: CustomChartOptions<'line'>);
753
+ protected requireLabels(): boolean;
754
+ makeConfig(id?: string): {
755
+ _chartId: any;
756
+ type: any;
757
+ data: any;
758
+ options: any;
759
+ plugins: any;
760
+ };
761
+ /**
762
+ *
763
+ * @param {number} datasetIndex
764
+ * @param {boolean} enable
765
+ * @param {string} backgroundColor
766
+ * @description 데이터셋의 Fill 설정을 합니다.
767
+ * @Since 1.0.0
768
+ * @category dataset
769
+ */
770
+ setFill(datasetIndex: number, enable: boolean, backgroundColor?: string): this;
771
+ /**
772
+ *
773
+ * @param {boolean} enable
774
+ * @param {string} backgroundColor
775
+ * @description 모든 데이터셋의 Fill 설정을 합니다.
776
+ * @Since 1.0.0
777
+ * @category dataset
778
+ *
779
+ */
780
+ setAllFill(enable: boolean, backgroundColor?: string): this;
781
+ /**
782
+ *
783
+ * @param {number} datasetIndex
784
+ * @param {number} tension
785
+ * @description 라인 차트의 곡률을 설정합니다.
786
+ * @Since 1.0.0
787
+ * @category dataset
788
+ */
789
+ setTension(datasetIndex: number, tension: number): this;
790
+ /**
791
+ *
792
+ * @param {number} tension
793
+ * @description 모든 데이터셋의 곡률을 설정합니다.
794
+ * @Since 1.0.0
795
+ * @category dataset
796
+ *
797
+ */
798
+ setAllTension(tension: number): this;
799
+ /**
800
+ *
801
+ * @param {number} datasetIndex
802
+ * @param {number} borderWidth
803
+ * @description 데이터셋의 Border Width를 설정합니다.
804
+ * @Since 1.0.0
805
+ * @category dataset
806
+ */
807
+ setBorderWidth(datasetIndex: number, borderWidth: number): this;
808
+ setAllBorderWidth(borderWidth: number): this;
809
+ /**
810
+ *
811
+ * @param {number} datasetIndex
812
+ * @param {number} radius
813
+ * @description 라인 차트의 Point Radius를 설정합니다.
814
+ */
815
+ setPointRadius(datasetIndex: number, radius: number): this;
816
+ /**
817
+ *
818
+ * @param {number} radius
819
+ * @description 모든 라인 차트의 Point Radius를 설정합니다.
820
+ * @Since 1.0.0
821
+ * @category dataset
822
+ */
823
+ setAllPointRadius(radius: number): this;
824
+ /**
825
+ *
826
+ * @param {number} datasetIndex
827
+ * @param {number} hoverRadius
828
+ * @description 데이터셋의 Point Hover Radius를 설정합니다.
829
+ * @Since 1.0.0
830
+ * @category dataset
831
+ */
832
+ setPointHoverRadius(datasetIndex: number, hoverRadius: number): this;
833
+ /**
834
+ *
835
+ * @param {number} hoverRadius
836
+ * @description 모든 데이터셋의 Point Hover Radius를 설정합니다.
837
+ * @Since 1.0.0
838
+ * @category dataset
839
+ *
840
+ */
841
+ setAllPointHoverRadius(hoverRadius: number): this;
842
+ }
843
+
844
+ declare const noDataPlugin: {
845
+ id: string;
846
+ beforeUpdate: (chart: any) => void;
847
+ afterDraw: (chart: any) => void;
848
+ beforeDestroy(chart: any): void;
849
+ };
850
+ declare const zoomResetPlugin: {
851
+ id: string;
852
+ afterDraw(chart: any, args: any, options: any): void;
853
+ afterEvent(chart: any, args: any): void;
854
+ };
855
+ declare const doughnutCenterTextPlugin: {
856
+ id: string;
857
+ afterDraw(chart: any): void;
858
+ };
859
+ declare const loadingPlugin: {
860
+ id: string;
861
+ beforeInit(chart: any, args: any, options: any): void;
862
+ beforeDraw(chart: any): void;
863
+ startLoadingAnimation(chart: any): void;
864
+ };
865
+ declare const customLegend: {
866
+ id: string;
867
+ _Default: {
868
+ containerID: string;
869
+ className: {
870
+ list: string;
871
+ item: string;
872
+ box: string;
873
+ text: string;
874
+ };
875
+ styles: {
876
+ text: {
877
+ textDecoration: string;
878
+ color: string;
879
+ };
880
+ textHidden: {
881
+ textDecoration: string;
882
+ color: string;
883
+ };
884
+ box: (item: any, type: any) => {
885
+ width: string;
886
+ height: string;
887
+ borderRadius: string;
888
+ borderWidth: string;
889
+ backgroundColor: any;
890
+ borderColor: any;
891
+ };
892
+ };
893
+ getItemText: (item: any) => any;
894
+ getDatasetType: (chart: Chart, item: Record<string, any>) => ChartType | undefined;
895
+ };
896
+ _fnc: (chart: Chart, id: string, options: {
897
+ className: {
898
+ list: string;
899
+ };
900
+ }) => HTMLDivElement | undefined;
901
+ afterUpdate(chart: any, args: any, options: any): void;
902
+ };
903
+ declare const chartMountPlugin: {
904
+ id: string;
905
+ afterDraw(chart: any, args: any, options: any): void;
906
+ };
907
+ declare const blinkPlugin: Plugin$1;
908
+ declare const makeCenterHtml: (percent: number, ok?: number, warn?: number, ng?: number) => string;
909
+ declare const barScaleImgPlugin: {
910
+ id: string;
911
+ beforeDatasetsDraw(chart: any, args: any, options: any): void;
912
+ };
913
+ declare const changeSetting: {
914
+ id: string;
915
+ _Default: SettingOptions;
916
+ afterInit(chart: any, args: any, options: any): void;
917
+ beforeDraw(chart: any): void;
918
+ afterDestroy(chart: any): void;
919
+ };
920
+ declare const zoomRangeSlider: {
921
+ id: string;
922
+ var: {
923
+ min: number;
924
+ isDragging: boolean;
925
+ circlePosition: number | null;
926
+ };
927
+ afterDatasetDraw(chart: any, args: any, options: any): void;
928
+ afterUpdate(chart: any, args: any, options: any): void;
929
+ afterEvent(chart: any, args: any, options: any): void;
930
+ };
931
+ declare const CreateZoomRangeSlider: (colors?: ZoomRangeSliderColors) => ZoomRangeSliderPlugin;
932
+
933
+ declare const defaultBarTooltipCallback: (context: TooltipItem<"bar">) => string;
934
+ declare const defaultBarScales: CommonAxesSacels;
935
+ declare const createDefaultBarOptions: (userOptions?: CustomBarChartOptions, defaultScales?: CommonAxesSacels) => CustomBarChartOptions;
936
+
937
+ declare const defaultLineTooltipCallback: (context: TooltipItem<"line">) => string;
938
+ declare const defaultLineScales: CommonAxesSacels;
939
+ declare const createDefaultLineOptions: (userOptions?: CustomLineChartOptions, defaultScales?: CommonAxesSacels) => CustomLineChartOptions;
940
+
941
+ declare const LocalDefaults_CreateZoomRangeSlider: typeof CreateZoomRangeSlider;
942
+ declare const LocalDefaults_barScaleImgPlugin: typeof barScaleImgPlugin;
943
+ declare const LocalDefaults_blinkPlugin: typeof blinkPlugin;
944
+ declare const LocalDefaults_changeSetting: typeof changeSetting;
945
+ declare const LocalDefaults_chartMountPlugin: typeof chartMountPlugin;
946
+ declare const LocalDefaults_createDefaultBarOptions: typeof createDefaultBarOptions;
947
+ declare const LocalDefaults_createDefaultLineOptions: typeof createDefaultLineOptions;
948
+ declare const LocalDefaults_customLegend: typeof customLegend;
949
+ declare const LocalDefaults_defaultBarScales: typeof defaultBarScales;
950
+ declare const LocalDefaults_defaultBarTooltipCallback: typeof defaultBarTooltipCallback;
951
+ declare const LocalDefaults_defaultLineScales: typeof defaultLineScales;
952
+ declare const LocalDefaults_defaultLineTooltipCallback: typeof defaultLineTooltipCallback;
953
+ declare const LocalDefaults_doughnutCenterTextPlugin: typeof doughnutCenterTextPlugin;
954
+ declare const LocalDefaults_loadingPlugin: typeof loadingPlugin;
955
+ declare const LocalDefaults_makeCenterHtml: typeof makeCenterHtml;
956
+ declare const LocalDefaults_noDataPlugin: typeof noDataPlugin;
957
+ declare const LocalDefaults_zoomRangeSlider: typeof zoomRangeSlider;
958
+ declare const LocalDefaults_zoomResetPlugin: typeof zoomResetPlugin;
959
+ declare namespace LocalDefaults {
960
+ export {
961
+ LocalDefaults_CreateZoomRangeSlider as CreateZoomRangeSlider,
962
+ LocalDefaults_barScaleImgPlugin as barScaleImgPlugin,
963
+ LocalDefaults_blinkPlugin as blinkPlugin,
964
+ LocalDefaults_changeSetting as changeSetting,
965
+ LocalDefaults_chartMountPlugin as chartMountPlugin,
966
+ LocalDefaults_createDefaultBarOptions as createDefaultBarOptions,
967
+ LocalDefaults_createDefaultLineOptions as createDefaultLineOptions,
968
+ LocalDefaults_customLegend as customLegend,
969
+ LocalDefaults_defaultBarScales as defaultBarScales,
970
+ LocalDefaults_defaultBarTooltipCallback as defaultBarTooltipCallback,
971
+ LocalDefaults_defaultLineScales as defaultLineScales,
972
+ LocalDefaults_defaultLineTooltipCallback as defaultLineTooltipCallback,
973
+ LocalDefaults_doughnutCenterTextPlugin as doughnutCenterTextPlugin,
974
+ LocalDefaults_loadingPlugin as loadingPlugin,
975
+ LocalDefaults_makeCenterHtml as makeCenterHtml,
976
+ LocalDefaults_noDataPlugin as noDataPlugin,
977
+ LocalDefaults_zoomRangeSlider as zoomRangeSlider,
978
+ LocalDefaults_zoomResetPlugin as zoomResetPlugin,
979
+ };
980
+ }
981
+
982
+ declare class ChartFactory {
983
+ private static registry;
984
+ static register<TType extends ChartType, TInstance>(type: TType, wrapperClass: Constructor<TType, TInstance>): void;
985
+ static create<TType extends ChartType>(type: TType, ...args: ConstructorParameters<Constructor<TType, any>>): any;
986
+ static has(type: ChartType): boolean;
987
+ static clear(): void;
988
+ }
989
+
990
+ declare class ChartInstance {
991
+ private static map;
992
+ static register(id: string, instance: Chart): void;
993
+ static get(id: string): Chart | undefined;
994
+ static getChart(id: string): Chart;
995
+ static unregister(id: string): boolean;
996
+ static has(id: string): boolean;
997
+ static clear(): void;
998
+ static update(id: string, instance: Chart, mode?: Mode): void;
999
+ static resize(id: string): void;
1000
+ }
1001
+
1002
+ declare const ChartToolBox: {
1003
+ setErrorLog(enabled: boolean): void;
1004
+ setDebugLog(enabled: boolean): void;
1005
+ };
1006
+ declare const T$: {
1007
+ readonly create: typeof ChartWrapper.create;
1008
+ readonly register: typeof ChartWrapper.register;
1009
+ readonly ChartWrapper: typeof ChartWrapper;
1010
+ readonly CartesianChartWrapper: typeof CartesianChartWrapper;
1011
+ readonly BarChartWrapper: typeof BarChartWrapper;
1012
+ readonly LineChartWrapper: typeof LineChartWrapper;
1013
+ readonly defaultTypes: typeof Types;
1014
+ readonly defaultsOptions: typeof LocalDefaults;
1015
+ readonly toolBox: {
1016
+ setErrorLog(enabled: boolean): void;
1017
+ setDebugLog(enabled: boolean): void;
1018
+ };
1019
+ };
1020
+
1021
+ export { BarChartWrapper, CartesianChartWrapper, ChartFactory, ChartInstance, ChartToolBox, ChartWrapper, CreateZoomRangeSlider, LineChartWrapper, T$, barScaleImgPlugin, blinkPlugin, changeSetting, chartMountPlugin, createDefaultBarOptions, createDefaultLineOptions, customLegend, T$ as default, defaultBarScales, defaultBarTooltipCallback, defaultLineScales, defaultLineTooltipCallback, doughnutCenterTextPlugin, loadingPlugin, makeCenterHtml, noDataPlugin, zoomRangeSlider, zoomResetPlugin };
1022
+ export type { BarChartBuilder, CartesianChartBuilder, CartesianChartType, CartesianDataset, ChartBuilder$1 as ChartBuilder, Color, CommonAxes, CommonAxesSacels, CommonCartesian, CommonCartesianAxes, CommonCartesianTicks, CommonCartesianTitleConfig, CommonTicks, Constructor, CustomBarChartOptions, CustomCartesianDataset, CustomChartOptions, CustomLineChartOptions, CustomOptionPlugins, CustomPieChartOptions, DeepPartial, DeepPartialCartesianAxes, DeepPartialPluginOptions, HtmlLegendOptions, LineChartBuilder, Mode, Position, SettingOptions };