stz-chart-maker 2.3.7 → 2.3.8
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 +1 -0
- package/dist/index.d.ts +297 -27
- package/dist/index.js +3404 -3104
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -96,6 +96,7 @@ module.exports = {
|
|
|
96
96
|
| `defaultColor` | `string[]` | 내부 기본 팔레트 | 차트 전역 기본 색상 배열 |
|
|
97
97
|
| `zoom` | `boolean \| object` | `false` | `line`, `bar`, `bubble` 차트에 전역 zoom 기본값 적용 |
|
|
98
98
|
| `loading` | `boolean` | `false` | Cartesian 차트에 전역 loading 기본값 적용 |
|
|
99
|
+
| `spinnerOverlay` | `boolean \| object` | `false` | `_chartId` 기반 `mountChart(...)` 사용 시 DOM spinner overlay 기본값 적용 |
|
|
99
100
|
| `legend` | `object` | 차트 기본값 사용 | 차트 전역 legend 기본 옵션 적용 |
|
|
100
101
|
| `tooltip` | `object` | 차트 기본값 사용 | 차트 전역 tooltip 기본 옵션 적용 |
|
|
101
102
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChartTypeRegistry, ChartType, ChartDataset, GridLineOptions, FontSpec, Tick,
|
|
1
|
+
import { ChartTypeRegistry, ChartType, ChartDataset, GridLineOptions, FontSpec, Tick, Chart as Chart$1, ChartOptions, PluginOptionsByType, ChartEvent, ActiveElement, LegendOptions, TooltipOptions, Plugin as Plugin$1, TooltipItem } from 'chart.js';
|
|
2
2
|
import { TreemapControllerDatasetOptions } from 'chartjs-chart-treemap';
|
|
3
|
-
import {
|
|
3
|
+
import { ZoomOptions, PanOptions, LimitOptions, ScaleLimits } from 'chartjs-plugin-zoom/types/options';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* ═════════════════════════════════════════════════════════════
|
|
@@ -246,23 +246,63 @@ interface CommonAxesSacels {
|
|
|
246
246
|
* ═════════════════════════════════════════════════════════════
|
|
247
247
|
*/
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
249
|
+
type AutoZoomLimitMode = 'original' | 'data';
|
|
250
|
+
/**
|
|
251
|
+
* 자동 zoom limit 계산 모드입니다.
|
|
252
|
+
*
|
|
253
|
+
* - `original`: 초기 렌더 시점의 차트 범위를 사용합니다.
|
|
254
|
+
* - `data`: 현재 데이터 값에서 min/max를 계산합니다.
|
|
255
|
+
*
|
|
256
|
+
* @group Zoom
|
|
257
|
+
*/
|
|
258
|
+
type AutoZoomLimits = AutoZoomLimitMode | Partial<Record<string, AutoZoomLimitMode | false>>;
|
|
259
|
+
type ZoomScaleLimits = ScaleLimits;
|
|
260
|
+
type ZoomLimitOptions = LimitOptions;
|
|
261
|
+
/**
|
|
262
|
+
* `setZoom()` / `addZoom()`에서 사용하는 `chartjs-plugin-zoom` 호환 옵션입니다.
|
|
263
|
+
*
|
|
264
|
+
* `limits`는 하위 plugin으로 그대로 전달됩니다.
|
|
265
|
+
* `autoLimits`는 `stz-chart-maker`가 제공하는 편의 옵션이며, 마운트 전에 `limits`로 변환됩니다.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```ts
|
|
269
|
+
* chart.setZoom(true, {
|
|
270
|
+
* limits: {
|
|
271
|
+
* x: { min: 'original', max: 'original' },
|
|
272
|
+
* y: { min: 0, max: 100 },
|
|
273
|
+
* },
|
|
274
|
+
* });
|
|
275
|
+
* ```
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```ts
|
|
279
|
+
* chart.setZoom(true, {
|
|
280
|
+
* autoLimits: 'original',
|
|
281
|
+
* });
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* chart.setZoom(true, {
|
|
287
|
+
* autoLimits: { x: 'original', y1: 'data' },
|
|
288
|
+
* });
|
|
289
|
+
* ```
|
|
290
|
+
*
|
|
291
|
+
* @group Zoom
|
|
292
|
+
*/
|
|
293
|
+
interface CustomZoomType {
|
|
294
|
+
zoom?: ZoomOptions;
|
|
264
295
|
pan?: PanOptions;
|
|
265
|
-
|
|
296
|
+
limits?: ZoomLimitOptions;
|
|
297
|
+
/**
|
|
298
|
+
* @deprecated `limits`를 사용하세요.
|
|
299
|
+
*/
|
|
300
|
+
zoomLimits?: ZoomLimitOptions;
|
|
301
|
+
/**
|
|
302
|
+
* `original`은 초기 렌더 범위를, `data`는 현재 데이터 범위를 기준으로 zoom 한계를 자동 설정합니다.
|
|
303
|
+
* 문자열을 주면 `x`, `y` 축 모두에 적용되고, 객체를 주면 축/scale id별로 개별 설정할 수 있습니다.
|
|
304
|
+
*/
|
|
305
|
+
autoLimits?: AutoZoomLimits;
|
|
266
306
|
}
|
|
267
307
|
type DeepPartialZoomType = DeepPartial<CustomZoomType>;
|
|
268
308
|
|
|
@@ -337,6 +377,109 @@ interface StreamingOptions {
|
|
|
337
377
|
onRefresh?: (chart: Chart$1) => void;
|
|
338
378
|
}
|
|
339
379
|
|
|
380
|
+
/**
|
|
381
|
+
* `spinnerOverlay`에서 사용하는 인라인 스타일 맵입니다.
|
|
382
|
+
* 키는 CSS 속성명이며 값은 `HTMLElement.style.setProperty(...)`로 적용됩니다.
|
|
383
|
+
*
|
|
384
|
+
* @group Spinner Overlay
|
|
385
|
+
*/
|
|
386
|
+
type SpinnerOverlayStyle = Record<string, string | number>;
|
|
387
|
+
/**
|
|
388
|
+
* 사용자 정의 spinner 렌더러에 전달되는 컨텍스트 객체입니다.
|
|
389
|
+
*
|
|
390
|
+
* @group Spinner Overlay
|
|
391
|
+
*/
|
|
392
|
+
interface SpinnerOverlayRenderContext {
|
|
393
|
+
/** `build(id)` 또는 `_chartId`로 지정된 안정적인 차트 id입니다. */
|
|
394
|
+
chartId: string;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* DOM 오버레이에 사용할 사용자 정의 spinner 콘텐츠입니다.
|
|
398
|
+
*
|
|
399
|
+
* - `string`: `innerHTML`로 삽입됩니다.
|
|
400
|
+
* - `HTMLElement`: 마운트 전에 복제되어 사용됩니다.
|
|
401
|
+
* - `function`: 현재 차트 id를 받아 마운트 시점에 호출됩니다.
|
|
402
|
+
*
|
|
403
|
+
* @group Spinner Overlay
|
|
404
|
+
*/
|
|
405
|
+
type SpinnerOverlaySpinnerContent = string | HTMLElement | ((context: SpinnerOverlayRenderContext) => string | HTMLElement);
|
|
406
|
+
/**
|
|
407
|
+
* {@link mountChart} 와 `setChartConfig({ spinnerOverlay: ... })` 에서 사용하는 DOM 오버레이 설정입니다.
|
|
408
|
+
*
|
|
409
|
+
* 이 기능은 Chart.js canvas plugin이 아닙니다.
|
|
410
|
+
* `new Chart(...)`가 실행되기 전에 차트 래퍼 DOM 위에 overlay를 만들고,
|
|
411
|
+
* 첫 번째 paint가 끝나면 overlay를 제거합니다.
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* ```ts
|
|
415
|
+
* const config = ChartWrapper
|
|
416
|
+
* .create('bar', labels, datasets)
|
|
417
|
+
* .setSpinnerOverlay({
|
|
418
|
+
* enabled: true,
|
|
419
|
+
* text: '차트 준비 중...',
|
|
420
|
+
* minVisibleMs: 200,
|
|
421
|
+
* overlayStyle: {
|
|
422
|
+
* background: 'rgba(255,255,255,0.94)'
|
|
423
|
+
* },
|
|
424
|
+
* })
|
|
425
|
+
* .build('sales-chart');
|
|
426
|
+
* ```
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```ts
|
|
430
|
+
* setChartConfig({
|
|
431
|
+
* spinnerOverlay: {
|
|
432
|
+
* enabled: true,
|
|
433
|
+
* text: '로딩 중...',
|
|
434
|
+
* },
|
|
435
|
+
* });
|
|
436
|
+
* ```
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```ts
|
|
440
|
+
* chart.setSpinnerOverlay({
|
|
441
|
+
* enabled: true,
|
|
442
|
+
* text: '라인 경로 계산 중',
|
|
443
|
+
* spinner: () => {
|
|
444
|
+
* const spinner = document.createElement('div');
|
|
445
|
+
* spinner.innerHTML = '<svg width="42" height="42" viewBox="0 0 42 42"><circle cx="21" cy="21" r="18" fill="none" stroke="#bfdbfe" stroke-width="4" /><path d="M21 3 A18 18 0 0 1 39 21" fill="none" stroke="#2563eb" stroke-width="4" stroke-linecap="round" /></svg>';
|
|
446
|
+
* return spinner;
|
|
447
|
+
* }
|
|
448
|
+
* });
|
|
449
|
+
* ```
|
|
450
|
+
*
|
|
451
|
+
* @group Spinner Overlay
|
|
452
|
+
*/
|
|
453
|
+
interface SpinnerOverlayConfig {
|
|
454
|
+
enabled?: boolean;
|
|
455
|
+
text?: string | false;
|
|
456
|
+
delayMs?: number;
|
|
457
|
+
minVisibleMs?: number;
|
|
458
|
+
backgroundColor?: string;
|
|
459
|
+
textColor?: string;
|
|
460
|
+
spinnerColor?: string;
|
|
461
|
+
spinnerTrackColor?: string;
|
|
462
|
+
zIndex?: number;
|
|
463
|
+
target?: 'parent' | 'canvas-parent';
|
|
464
|
+
className?: string;
|
|
465
|
+
textClassName?: string;
|
|
466
|
+
spinnerClassName?: string;
|
|
467
|
+
overlayStyle?: SpinnerOverlayStyle;
|
|
468
|
+
textStyle?: SpinnerOverlayStyle;
|
|
469
|
+
spinnerStyle?: SpinnerOverlayStyle;
|
|
470
|
+
spinner?: SpinnerOverlaySpinnerContent;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* spinner overlay를 간단히 켜고 끄기 위한 편의 유니온 타입입니다.
|
|
474
|
+
*
|
|
475
|
+
* - `true`: 기본값으로 활성화
|
|
476
|
+
* - `false`: 비활성화
|
|
477
|
+
* - `SpinnerOverlayConfig`: 명시적인 DOM 오버레이 설정
|
|
478
|
+
*
|
|
479
|
+
* @group Spinner Overlay
|
|
480
|
+
*/
|
|
481
|
+
type SpinnerOverlayOption = boolean | SpinnerOverlayConfig;
|
|
482
|
+
|
|
340
483
|
/**
|
|
341
484
|
* ═════════════════════════════════════════════════════════════
|
|
342
485
|
* 📄 FILE : options.ts
|
|
@@ -449,6 +592,11 @@ type CustomChartOptions<TType extends ChartType = ChartType> = Override<ChartOpt
|
|
|
449
592
|
_chartId?: string;
|
|
450
593
|
_loading?: boolean;
|
|
451
594
|
_noDataText?: string;
|
|
595
|
+
/**
|
|
596
|
+
* DOM 기반 spinner overlay 설정입니다.
|
|
597
|
+
* 이 옵션은 내장 canvas loading plugin이 아니라 {@link mountChart} 에서 소비됩니다.
|
|
598
|
+
*/
|
|
599
|
+
spinnerOverlay?: SpinnerOverlayOption;
|
|
452
600
|
};
|
|
453
601
|
type CustomArcChartOptions<TType extends ArcChartType = ArcChartType> = CustomChartOptions<TType> & {
|
|
454
602
|
scales?: never;
|
|
@@ -496,6 +644,7 @@ interface ChartBuilder<TType extends ChartType> {
|
|
|
496
644
|
setTitle(titleOptions: CommonCartesianTitleConfig): this;
|
|
497
645
|
setLegend(legendOptions: DeepPartial<LegendOptions<any>>): this;
|
|
498
646
|
setTooltip(tooltipOptions: DeepPartial<TooltipOptions<any>>): this;
|
|
647
|
+
setSpinnerOverlay(spinnerOverlay: SpinnerOverlayOption): this;
|
|
499
648
|
mergeOptions(options: DeepPartial<CustomChartOptions<TType>>): this;
|
|
500
649
|
getChartData(uid: string): CustomChartDatasets<TType>;
|
|
501
650
|
setChartData(uid: string, data: CustomChartDatasets<TType>): void;
|
|
@@ -518,7 +667,7 @@ interface CartesianChartBuilder<TType extends CartesianChartType> extends ChartB
|
|
|
518
667
|
lineWidth?: number;
|
|
519
668
|
}): this;
|
|
520
669
|
setZoom(enabled: boolean, zoomOption?: DeepPartialZoomType): this;
|
|
521
|
-
addZoom(defaultZoom?: boolean, zoomOption?:
|
|
670
|
+
addZoom(defaultZoom?: boolean, zoomOption?: DeepPartialZoomType): this;
|
|
522
671
|
addDataLabels(defultDataLabels?: boolean, dataLabelsOptions?: PartialDataLabels): this;
|
|
523
672
|
setYAxisForDataset(datasetIndex: number, axisId?: string): this;
|
|
524
673
|
setAxisRange(axis: 'x' | 'y', min?: number, max?: number): this;
|
|
@@ -692,13 +841,18 @@ type Types_RadarChartBuilder = RadarChartBuilder;
|
|
|
692
841
|
type Types_RadialChartType = RadialChartType;
|
|
693
842
|
type Types_SegmentImageConfig = SegmentImageConfig;
|
|
694
843
|
type Types_SettingOptions = SettingOptions;
|
|
844
|
+
type Types_SpinnerOverlayConfig = SpinnerOverlayConfig;
|
|
845
|
+
type Types_SpinnerOverlayOption = SpinnerOverlayOption;
|
|
846
|
+
type Types_SpinnerOverlayRenderContext = SpinnerOverlayRenderContext;
|
|
847
|
+
type Types_SpinnerOverlaySpinnerContent = SpinnerOverlaySpinnerContent;
|
|
848
|
+
type Types_SpinnerOverlayStyle = SpinnerOverlayStyle;
|
|
695
849
|
type Types_TimeScaleConfig = TimeScaleConfig;
|
|
696
850
|
type Types_TimeScaleType = TimeScaleType;
|
|
697
851
|
type Types_TimeUnit = TimeUnit;
|
|
698
852
|
type Types_TreemapChartBuilder = TreemapChartBuilder;
|
|
699
853
|
type Types_UidImageMapping = UidImageMapping;
|
|
700
854
|
declare namespace Types {
|
|
701
|
-
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_CustomTreemapChartOptions as CustomTreemapChartOptions, Types_CustomTreemapDataset as CustomTreemapDataset, Types_DeepPartial as DeepPartial, Types_DeepPartialCartesianAxes as DeepPartialCartesianAxes, Types_DeepPartialPluginOptions as DeepPartialPluginOptions, Types_DoughnutChartBuilder as DoughnutChartBuilder, Types_HierarchicalChartType as HierarchicalChartType, 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_SegmentImageConfig as SegmentImageConfig, Types_SettingOptions as SettingOptions, Types_TimeScaleConfig as TimeScaleConfig, Types_TimeScaleType as TimeScaleType, Types_TimeUnit as TimeUnit, Types_TreemapChartBuilder as TreemapChartBuilder, Types_UidImageMapping as UidImageMapping };
|
|
855
|
+
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_CustomTreemapChartOptions as CustomTreemapChartOptions, Types_CustomTreemapDataset as CustomTreemapDataset, Types_DeepPartial as DeepPartial, Types_DeepPartialCartesianAxes as DeepPartialCartesianAxes, Types_DeepPartialPluginOptions as DeepPartialPluginOptions, Types_DoughnutChartBuilder as DoughnutChartBuilder, Types_HierarchicalChartType as HierarchicalChartType, 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_SegmentImageConfig as SegmentImageConfig, Types_SettingOptions as SettingOptions, Types_SpinnerOverlayConfig as SpinnerOverlayConfig, Types_SpinnerOverlayOption as SpinnerOverlayOption, Types_SpinnerOverlayRenderContext as SpinnerOverlayRenderContext, Types_SpinnerOverlaySpinnerContent as SpinnerOverlaySpinnerContent, Types_SpinnerOverlayStyle as SpinnerOverlayStyle, Types_TimeScaleConfig as TimeScaleConfig, Types_TimeScaleType as TimeScaleType, Types_TimeUnit as TimeUnit, Types_TreemapChartBuilder as TreemapChartBuilder, Types_UidImageMapping as UidImageMapping };
|
|
702
856
|
}
|
|
703
857
|
|
|
704
858
|
interface ChartConfig {
|
|
@@ -836,6 +990,34 @@ declare abstract class Chart<TType extends ChartType, TOptions extends CustomCha
|
|
|
836
990
|
* });
|
|
837
991
|
*/
|
|
838
992
|
setTooltip(tooltipOptions: DeepPartial<TooltipOptions<TType>>): this;
|
|
993
|
+
/**
|
|
994
|
+
* @description 차트 마운트 직전 DOM 오버레이 spinner를 설정합니다.
|
|
995
|
+
* 실제 동작은 {@link mountChart} helper가 담당하며, `build(id)` 또는 `_chartId`로 안정적인 canvas id가 필요합니다.
|
|
996
|
+
* @param spinnerOverlay
|
|
997
|
+
* @returns {this}
|
|
998
|
+
* @since 2.4.0
|
|
999
|
+
* @example
|
|
1000
|
+
* chart.setSpinnerOverlay(true);
|
|
1001
|
+
*
|
|
1002
|
+
* @example
|
|
1003
|
+
* chart.setSpinnerOverlay({
|
|
1004
|
+
* enabled: true,
|
|
1005
|
+
* text: '차트 준비 중...',
|
|
1006
|
+
* minVisibleMs: 200,
|
|
1007
|
+
* });
|
|
1008
|
+
*
|
|
1009
|
+
* @example
|
|
1010
|
+
* chart.setSpinnerOverlay({
|
|
1011
|
+
* enabled: true,
|
|
1012
|
+
* text: false,
|
|
1013
|
+
* spinner: () => {
|
|
1014
|
+
* const spinner = document.createElement('div');
|
|
1015
|
+
* spinner.innerHTML = '<svg width="42" height="42" viewBox="0 0 42 42"><circle cx="21" cy="21" r="18" fill="none" stroke="#bfdbfe" stroke-width="4" /><path d="M21 3 A18 18 0 0 1 39 21" fill="none" stroke="#2563eb" stroke-width="4" stroke-linecap="round" /></svg>';
|
|
1016
|
+
* return spinner;
|
|
1017
|
+
* }
|
|
1018
|
+
* });
|
|
1019
|
+
*/
|
|
1020
|
+
setSpinnerOverlay(spinnerOverlay: SpinnerOverlayOption): this;
|
|
839
1021
|
/**
|
|
840
1022
|
* @description 기존 옵션에 부분 옵션을 병합합니다.
|
|
841
1023
|
* @param {DeepPartial<TOptions>} options
|
|
@@ -1035,6 +1217,7 @@ declare abstract class CartesianChart<TType extends CartesianChartType> extends
|
|
|
1035
1217
|
protected decorateDataset(ds: any, idx: number): void;
|
|
1036
1218
|
protected mustHavePlugins(): ({
|
|
1037
1219
|
id: string;
|
|
1220
|
+
beforeInit(chart: any): void;
|
|
1038
1221
|
afterDraw(chart: any, args: any, options: any): void;
|
|
1039
1222
|
afterDestroy(chart: any): void;
|
|
1040
1223
|
} | {
|
|
@@ -1058,6 +1241,16 @@ declare abstract class CartesianChart<TType extends CartesianChartType> extends
|
|
|
1058
1241
|
protected applyGlobalZoomConfig(): void;
|
|
1059
1242
|
protected ensureZoomResetPlugin(): void;
|
|
1060
1243
|
protected removeZoomResetPlugin(): void;
|
|
1244
|
+
protected normalizeZoomOptions(zoomOption?: DeepPartialZoomType): DeepPartialZoomType;
|
|
1245
|
+
protected resolveAutoZoomLimits(autoLimits: AutoZoomLimits): ZoomLimitOptions;
|
|
1246
|
+
protected resolveAxisZoomLimits(axisId: string): ZoomScaleLimits | undefined;
|
|
1247
|
+
protected resolveZoomAxis(axisId: string): 'x' | 'y' | undefined;
|
|
1248
|
+
protected resolveAxisLabelLimitValues(axisId: string, datasets: CustomCartesianDataset<TType>[]): number[];
|
|
1249
|
+
protected extractParsedPointValue(point: unknown, dataset: CustomCartesianDataset<TType>, axis: 'x' | 'y'): number | undefined;
|
|
1250
|
+
protected resolveParsingKey(dataset: CustomCartesianDataset<TType>, axis: 'x' | 'y'): string;
|
|
1251
|
+
protected readValueByPath(source: Record<string, unknown>, path: string): unknown;
|
|
1252
|
+
protected normalizeLimitValue(value: unknown): number | undefined;
|
|
1253
|
+
protected toZoomScaleLimits(values: number[]): ZoomScaleLimits | undefined;
|
|
1061
1254
|
protected normalize(): void;
|
|
1062
1255
|
protected configAop(config: any): any;
|
|
1063
1256
|
/**
|
|
@@ -1185,9 +1378,26 @@ declare abstract class CartesianChart<TType extends CartesianChartType> extends
|
|
|
1185
1378
|
* @description 줌 기능을 설정합니다. `false`를 전달하면 현재 차트의 줌 설정을 제거합니다.
|
|
1186
1379
|
* 전역 `setChartConfig({ zoom: true })` 설정이 있더라도 이 메서드로 차트별 비활성화가 가능합니다.
|
|
1187
1380
|
* @param {boolean} enabled
|
|
1188
|
-
* @param {
|
|
1381
|
+
* @param {DeepPartialZoomType} zoomOption
|
|
1189
1382
|
* @returns {this}
|
|
1190
1383
|
* @since 2.4.0
|
|
1384
|
+
* @example
|
|
1385
|
+
* chart.setZoom(true, {
|
|
1386
|
+
* limits: {
|
|
1387
|
+
* x: { min: 'original', max: 'original' },
|
|
1388
|
+
* y: { min: 0, max: 100 },
|
|
1389
|
+
* },
|
|
1390
|
+
* });
|
|
1391
|
+
*
|
|
1392
|
+
* @example
|
|
1393
|
+
* chart.setZoom(true, {
|
|
1394
|
+
* autoLimits: 'original',
|
|
1395
|
+
* });
|
|
1396
|
+
*
|
|
1397
|
+
* @example
|
|
1398
|
+
* chart.setZoom(true, {
|
|
1399
|
+
* autoLimits: { x: 'original', y1: 'data' },
|
|
1400
|
+
* });
|
|
1191
1401
|
*/
|
|
1192
1402
|
setZoom(enabled: boolean, zoomOption?: DeepPartialZoomType): this;
|
|
1193
1403
|
/**
|
|
@@ -1943,6 +2153,7 @@ declare abstract class ArcChart<TType extends ArcChartType> extends Chart<TType>
|
|
|
1943
2153
|
protected decorateDataset(ds: any, idx: number): void;
|
|
1944
2154
|
protected mustHavePlugins(): {
|
|
1945
2155
|
id: string;
|
|
2156
|
+
beforeInit(chart: any): void;
|
|
1946
2157
|
afterDraw(chart: any, args: any, options: any): void;
|
|
1947
2158
|
afterDestroy(chart: any): void;
|
|
1948
2159
|
}[];
|
|
@@ -2350,6 +2561,7 @@ declare class TreemapChart extends Chart<'treemap', CustomTreemapChartOptions> i
|
|
|
2350
2561
|
protected normalize(): void;
|
|
2351
2562
|
protected mustHavePlugins(): {
|
|
2352
2563
|
id: string;
|
|
2564
|
+
beforeInit(chart: any): void;
|
|
2353
2565
|
afterDraw(chart: any, args: any, options: any): void;
|
|
2354
2566
|
afterDestroy(chart: any): void;
|
|
2355
2567
|
}[];
|
|
@@ -2527,14 +2739,15 @@ declare const zoomResetPlugin: {
|
|
|
2527
2739
|
afterEvent(chart: any, args: any): void;
|
|
2528
2740
|
};
|
|
2529
2741
|
/**
|
|
2530
|
-
* @description 차트
|
|
2742
|
+
* @description 차트 첫 렌더 직전까지 placeholder 로딩 화면을 표시하는 플러그인입니다.
|
|
2531
2743
|
* @group Common Plugins
|
|
2532
2744
|
*/
|
|
2533
2745
|
declare const loadingPlugin: {
|
|
2534
2746
|
id: string;
|
|
2535
|
-
beforeInit(chart: any
|
|
2536
|
-
beforeDraw(chart: any):
|
|
2537
|
-
|
|
2747
|
+
beforeInit(chart: any): void;
|
|
2748
|
+
beforeDraw(chart: any): false | undefined;
|
|
2749
|
+
drawLoadingPlaceholder(chart: any): void;
|
|
2750
|
+
afterDestroy(chart: any): void;
|
|
2538
2751
|
};
|
|
2539
2752
|
/**
|
|
2540
2753
|
* @description 외부 HTML 컨테이너에 커스텀 범례를 렌더링하는 플러그인입니다.
|
|
@@ -2585,6 +2798,7 @@ declare const customLegend: {
|
|
|
2585
2798
|
*/
|
|
2586
2799
|
declare const chartMountPlugin: {
|
|
2587
2800
|
id: string;
|
|
2801
|
+
beforeInit(chart: any): void;
|
|
2588
2802
|
afterDraw(chart: any, args: any, options: any): void;
|
|
2589
2803
|
afterDestroy(chart: any): void;
|
|
2590
2804
|
};
|
|
@@ -3072,6 +3286,11 @@ interface StzConfig {
|
|
|
3072
3286
|
defaultColor?: string[];
|
|
3073
3287
|
zoom?: boolean | DeepPartialZoomType;
|
|
3074
3288
|
loading?: boolean;
|
|
3289
|
+
/**
|
|
3290
|
+
* {@link mountChart} 에서 사용하는 DOM 기반 spinner overlay의 전역 기본값입니다.
|
|
3291
|
+
* 차트별 `spinnerOverlay` 옵션이 있으면 그 값이 우선합니다.
|
|
3292
|
+
*/
|
|
3293
|
+
spinnerOverlay?: SpinnerOverlayOption;
|
|
3075
3294
|
legend?: DeepPartial<LegendOptions<any>>;
|
|
3076
3295
|
tooltip?: DeepPartial<TooltipOptions<any>>;
|
|
3077
3296
|
/** @deprecated no-op. Built-in chart types are bootstrapped at package load time. */
|
|
@@ -3116,6 +3335,57 @@ interface StzConfig {
|
|
|
3116
3335
|
*/
|
|
3117
3336
|
declare function setChartConfig(config: StzConfig): void;
|
|
3118
3337
|
|
|
3338
|
+
/**
|
|
3339
|
+
* {@link mountChart} 가 반환하는 마운트 결과입니다.
|
|
3340
|
+
*
|
|
3341
|
+
* @group Spinner Overlay
|
|
3342
|
+
*/
|
|
3343
|
+
interface MountChartHandle {
|
|
3344
|
+
/** `config._chartId` 또는 `config.options._chartId` 에서 해석된 안정적인 차트 id입니다. */
|
|
3345
|
+
chartId: string;
|
|
3346
|
+
/** 마운트된 차트를 제거하고 활성 overlay도 함께 정리합니다. */
|
|
3347
|
+
destroy: () => void;
|
|
3348
|
+
/** 차트 인스턴스 생성과 spinner overlay lifecycle이 모두 끝나면 resolve 됩니다. */
|
|
3349
|
+
ready: Promise<Chart$1>;
|
|
3350
|
+
}
|
|
3351
|
+
/**
|
|
3352
|
+
* `_chartId`를 기준으로 대상 canvas를 찾아 차트 설정을 마운트합니다.
|
|
3353
|
+
*
|
|
3354
|
+
* 차트 옵션이나 전역 설정에서 `spinnerOverlay`가 활성화되어 있으면,
|
|
3355
|
+
* 이 helper는 먼저 DOM overlay를 만들고 브라우저 paint를 한 번 양보한 뒤 Chart.js 인스턴스를 생성합니다.
|
|
3356
|
+
* 첫 렌더가 안정화되면 overlay를 제거합니다.
|
|
3357
|
+
*
|
|
3358
|
+
* 즉 `spinnerOverlay`의 실제 런타임은 이 helper이며, `build()`만으로는 설정 객체만 만들어집니다.
|
|
3359
|
+
*
|
|
3360
|
+
* @param config `build(id)`로 생성한 차트 설정 객체
|
|
3361
|
+
* @returns `ready`, `destroy`를 포함한 마운트 핸들
|
|
3362
|
+
*
|
|
3363
|
+
* @example
|
|
3364
|
+
* ```ts
|
|
3365
|
+
* const config = ChartWrapper
|
|
3366
|
+
* .create('bar', labels, datasets)
|
|
3367
|
+
* .setSpinnerOverlay({
|
|
3368
|
+
* enabled: true,
|
|
3369
|
+
* text: '차트 준비 중...',
|
|
3370
|
+
* })
|
|
3371
|
+
* .build('sales-chart');
|
|
3372
|
+
*
|
|
3373
|
+
* const mounted = mountChart(config);
|
|
3374
|
+
* await mounted.ready;
|
|
3375
|
+
* ```
|
|
3376
|
+
*
|
|
3377
|
+
* @example
|
|
3378
|
+
* ```tsx
|
|
3379
|
+
* useEffect(() => {
|
|
3380
|
+
* const mounted = mountChart(config);
|
|
3381
|
+
* return () => mounted.destroy();
|
|
3382
|
+
* }, [config]);
|
|
3383
|
+
* ```
|
|
3384
|
+
*
|
|
3385
|
+
* @group Spinner Overlay
|
|
3386
|
+
*/
|
|
3387
|
+
declare function mountChart(config: ChartConfig): MountChartHandle;
|
|
3388
|
+
|
|
3119
3389
|
interface ChartImageExportOptions {
|
|
3120
3390
|
format?: 'png' | 'jpeg' | 'webp';
|
|
3121
3391
|
quality?: number;
|
|
@@ -3360,5 +3630,5 @@ declare const T$: {
|
|
|
3360
3630
|
};
|
|
3361
3631
|
};
|
|
3362
3632
|
|
|
3363
|
-
export { ArcChart, ArcChart as ArcChartWrapper, BarChart, BarChart as BarChartWrapper, BubbleChart, BubbleChart as BubbleChartWrapper, CartesianChart, CartesianChart as CartesianChartWrapper, Chart, ChartFactory, ChartInstance, ChartToolBox, ChartTypes, Chart as ChartWrapper, CreateZoomRangeSlider, DefaultArcRadius, DefaultDataLabelsOptions, DefaultHiddenLegendTopOptions, DefaultHiddenSparkScales, DefaultResponsiveChartOptions, DefaultSparkPluginOptions, DefaultTimeScaleOptions, DefaultTopLegendOptions, DefaultZoomOptions, DoughnutChart, DoughnutChart as DoughnutChartWrapper, LineChart, LineChart as LineChartWrapper, PieChart, PieChart as PieChartWrapper, T$, TreemapChart, TreemapChart as TreemapChartWrapper, barScaleImgPlugin, blinkPlugin, changeSetting, chartMountPlugin, clearChartActiveElements, createAssignedTasksPlugin, createDefaultBarOptions, createDefaultBubbleOptions, createDefaultCartesianScales, createDefaultDoughnutOptions, createDefaultLineOptions, createDefaultPieOptions, createDefaultTreemapOptions, createStatusPlugin, createTodayLinePlugin, createWeekendPlugin, customDatasetPlugins, customLegend, T$ as default, defaultBarScales, defaultBarTooltipCallback, defaultBubbleScales, defaultBubbleTooltipCallback, defaultDoughnutTooltipCallback, defaultLineScales, defaultLineTooltipCallback, defaultPieTooltipCallback, defaultTreemapTooltipCallback, doughnutCenterTextPlugin, downloadChartAsImage, downloadChartAsImageByInstance, getChartAsBase64, getChartAsBase64ByInstance, getChartAsBlob, getChartAsBlobByInstance, getChartDatasetMeta, getChartInstance, hideChartTooltip, isChartDatasetVisible, loadingPlugin, makeCenterHtml, noDataPlugin, resetChartZoom, resizeChart, segmentImagePlugin, setChartActiveElements, setChartConfig, setChartDatasetVisibility, showChartTooltip, sparkBarOptions, sparkBubbleOptions, sparkLineOptions, toggleChartDatasetVisibility, updateChart, zoomRangeSlider, zoomResetPlugin };
|
|
3364
|
-
export type { Align, AllChartTypes, ArcChartBuilder, ArcChartType, ArcDataset, AxisColors, BarChartBuilder, BubbleChartBuilder, CartesianChartBuilder, CartesianChartType, CartesianDataset, ChartBuilder, ChartImageExportOptions, ChartTarget, ChartWithFocus, Color, CommonAxes, CommonAxesSacels, CommonCartesian, CommonCartesianAxes, CommonCartesianLegendConfig, CommonCartesianTicks, CommonCartesianTitleConfig, CommonTicks, Constructor, CustomArcChartOptions, CustomBarChartOptions, CustomBubbleChartOptions, CustomCartesianDataset, CustomChartDatasets, CustomChartOptions, CustomDoughnutChartOptions, CustomLineChartOptions, CustomOptionPlugins, CustomPieChartOptions, CustomTreemapChartOptions, CustomTreemapDataset, CustomZoomType, DataLabels, DataLabelsContext, DatasetWithPrevColors, DeepPartial, DeepPartialCartesianAxes, DeepPartialPluginOptions, DeepPartialZoomType, DoughnutChartBuilder, FocusCallback, HierarchicalChartType, HtmlLegendOptions, LineChartBuilder, Mode, OriginalColors, Override, PartialDataLabels, PieChartBuilder, Position, RadarChartBuilder, RadialChartType, ScaleWithOriginalColors, SegmentImageConfig, SettingOptions, StzConfig, TimeScaleConfig, TimeScaleType, TimeUnit, TreemapChartBuilder, UidImageMapping, ZoomRangeSliderColors, ZoomRangeSliderPlugin, ZoomRangeSliderVar };
|
|
3633
|
+
export { ArcChart, ArcChart as ArcChartWrapper, BarChart, BarChart as BarChartWrapper, BubbleChart, BubbleChart as BubbleChartWrapper, CartesianChart, CartesianChart as CartesianChartWrapper, Chart, ChartFactory, ChartInstance, ChartToolBox, ChartTypes, Chart as ChartWrapper, CreateZoomRangeSlider, DefaultArcRadius, DefaultDataLabelsOptions, DefaultHiddenLegendTopOptions, DefaultHiddenSparkScales, DefaultResponsiveChartOptions, DefaultSparkPluginOptions, DefaultTimeScaleOptions, DefaultTopLegendOptions, DefaultZoomOptions, DoughnutChart, DoughnutChart as DoughnutChartWrapper, LineChart, LineChart as LineChartWrapper, PieChart, PieChart as PieChartWrapper, T$, TreemapChart, TreemapChart as TreemapChartWrapper, barScaleImgPlugin, blinkPlugin, changeSetting, chartMountPlugin, clearChartActiveElements, createAssignedTasksPlugin, createDefaultBarOptions, createDefaultBubbleOptions, createDefaultCartesianScales, createDefaultDoughnutOptions, createDefaultLineOptions, createDefaultPieOptions, createDefaultTreemapOptions, createStatusPlugin, createTodayLinePlugin, createWeekendPlugin, customDatasetPlugins, customLegend, T$ as default, defaultBarScales, defaultBarTooltipCallback, defaultBubbleScales, defaultBubbleTooltipCallback, defaultDoughnutTooltipCallback, defaultLineScales, defaultLineTooltipCallback, defaultPieTooltipCallback, defaultTreemapTooltipCallback, doughnutCenterTextPlugin, downloadChartAsImage, downloadChartAsImageByInstance, getChartAsBase64, getChartAsBase64ByInstance, getChartAsBlob, getChartAsBlobByInstance, getChartDatasetMeta, getChartInstance, hideChartTooltip, isChartDatasetVisible, loadingPlugin, makeCenterHtml, mountChart, noDataPlugin, resetChartZoom, resizeChart, segmentImagePlugin, setChartActiveElements, setChartConfig, setChartDatasetVisibility, showChartTooltip, sparkBarOptions, sparkBubbleOptions, sparkLineOptions, toggleChartDatasetVisibility, updateChart, zoomRangeSlider, zoomResetPlugin };
|
|
3634
|
+
export type { Align, AllChartTypes, ArcChartBuilder, ArcChartType, ArcDataset, AutoZoomLimitMode, AutoZoomLimits, AxisColors, BarChartBuilder, BubbleChartBuilder, CartesianChartBuilder, CartesianChartType, CartesianDataset, ChartBuilder, ChartImageExportOptions, ChartTarget, ChartWithFocus, Color, CommonAxes, CommonAxesSacels, CommonCartesian, CommonCartesianAxes, CommonCartesianLegendConfig, CommonCartesianTicks, CommonCartesianTitleConfig, CommonTicks, Constructor, CustomArcChartOptions, CustomBarChartOptions, CustomBubbleChartOptions, CustomCartesianDataset, CustomChartDatasets, CustomChartOptions, CustomDoughnutChartOptions, CustomLineChartOptions, CustomOptionPlugins, CustomPieChartOptions, CustomTreemapChartOptions, CustomTreemapDataset, CustomZoomType, DataLabels, DataLabelsContext, DatasetWithPrevColors, DeepPartial, DeepPartialCartesianAxes, DeepPartialPluginOptions, DeepPartialZoomType, DoughnutChartBuilder, FocusCallback, HierarchicalChartType, HtmlLegendOptions, LineChartBuilder, Mode, MountChartHandle, OriginalColors, Override, PartialDataLabels, PieChartBuilder, Position, RadarChartBuilder, RadialChartType, ScaleWithOriginalColors, SegmentImageConfig, SettingOptions, SpinnerOverlayConfig, SpinnerOverlayOption, SpinnerOverlayRenderContext, SpinnerOverlaySpinnerContent, SpinnerOverlayStyle, StzConfig, TimeScaleConfig, TimeScaleType, TimeUnit, TreemapChartBuilder, UidImageMapping, ZoomLimitOptions, ZoomRangeSliderColors, ZoomRangeSliderPlugin, ZoomRangeSliderVar, ZoomScaleLimits };
|