stz-chart-maker 1.0.17 → 1.0.18

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 (3) hide show
  1. package/dist/index.d.ts +140 -76
  2. package/dist/index.js +1422 -1382
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -343,6 +343,7 @@ declare namespace Types {
343
343
  interface ChartConfig {
344
344
  _chartId: string;
345
345
  type: ChartType;
346
+ datasetIdKey?: string;
346
347
  data: any;
347
348
  options: any;
348
349
  plugins?: any;
@@ -362,37 +363,44 @@ declare abstract class ChartWrapper<TType extends ChartType> implements ChartBui
362
363
  protected abstract configAop(config: any): any;
363
364
  abstract build(id?: string): ChartConfig;
364
365
  /**
365
- * 플러그인을 추가합니다.
366
+ * @description 플러그인을 추가합니다.
366
367
  * @param plugin
367
368
  * @param replaceIfExists
368
- *
369
+ * @Since 1.0.0
370
+ * @category plugin
369
371
  */
370
372
  setPlugin(plugin: any, replaceIfExists?: boolean): this;
371
373
  /**
372
- * 차트 설정 객체를 생성합니다.
374
+ * @Description 레거시 지원용 차트 설정 객체를 생성합니다.
373
375
  * @param {string} id
374
376
  * @returns {ChartConfig}
375
- * @Description 레거시 지원용
377
+ * @Since 1.0.0
378
+ * @category config
376
379
  */
377
380
  makeConfig(id?: string): ChartConfig;
378
381
  /**
379
- * 플러그인을 제거합니다.
382
+ * @description 플러그인을 제거합니다.
380
383
  * @param pluginId
384
+ * @Since 1.0.0
385
+ * @category plugin
386
+ *
381
387
  */
382
388
  removePlugin(pluginId: string): this;
383
389
  /**
384
- * 플러그인이 존재하는지 확인합니다.
390
+ * @description 플러그인이 존재하는지 확인합니다.
385
391
  * @param pluginId
392
+ * @returns {boolean}
393
+ * @Since 1.0.0
394
+ * @category plugin
386
395
  */
387
396
  hasPlugin(pluginId: string): boolean;
388
397
  /**
389
- *
390
- * @param callback
398
+ * @beta
391
399
  * @description 차트 리사이즈 이벤트 콜백 함수를 설정합니다.
400
+ * @param callback
401
+ * @returns {this}
392
402
  * @Since 1.0.0
393
403
  * @category options
394
- * @beta (기능 개발 중)
395
- *
396
404
  */
397
405
  onResize(callback: (chart: Chart<TType>, size: {
398
406
  width: number;
@@ -469,6 +477,15 @@ declare abstract class CartesianChartWrapper<TType extends CartesianChartType> e
469
477
  get chartId(): string;
470
478
  set chartId(value: string);
471
479
  protected requireLabels(): boolean;
480
+ /**
481
+ * @protected
482
+ * @description 데이터셋의 기본적은 옵션을 추가하거나 부여합니다.
483
+ * @param ds
484
+ * @param {number} idx
485
+ * @Returns {void}
486
+ * @Since 1.0.1
487
+ * @category Dataset
488
+ */
472
489
  protected decorateDataset(ds: any, idx: number): void;
473
490
  protected mustHavePlugins(): {
474
491
  id: string;
@@ -480,15 +497,19 @@ declare abstract class CartesianChartWrapper<TType extends CartesianChartType> e
480
497
  protected normalize(): void;
481
498
  protected configAop(config: any): any;
482
499
  /**
483
- * 차트 설정 객체를 생성합니다.
500
+ * @Description 차트 설정 객체를 생성합니다. 이 메소드는 차트의 구성 요소를 종합하여 Chart.js에서 사용할 수 있는 형식으로 반환합니다.
484
501
  * @param id
485
502
  * @returns {ChartConfig}
486
- * @Description 차트 설정 객체를 생성합니다. 이 메소드는 차트의 구성 요소를 종합하여 Chart.js에서 사용할 수 있는 형식으로 반환합니다.
487
503
  * @Since 1.0.0
488
504
  * @category Chart
489
- *
490
505
  */
491
506
  build(id?: string): ChartConfig;
507
+ /**
508
+ * @deprecated
509
+ * @description 차트 설정 객체를 생성합니다. 이 메소드는 레거시 지원용으로, Chart.js에서 사용할 수 있는 형식으로 반환합니다.
510
+ * @param {string} id
511
+ * @returns {{data: any, plugins: any, _chartId: any, options: any, type: any}}
512
+ */
492
513
  makeConfig(id?: string): {
493
514
  _chartId: any;
494
515
  type: any;
@@ -497,36 +518,25 @@ declare abstract class CartesianChartWrapper<TType extends CartesianChartType> e
497
518
  plugins: any;
498
519
  };
499
520
  /**
500
- * Cartesian chart type을 체크 합니다.
501
521
  * @private
502
- * *
503
- * @remarks cartesina 차트의 타입인지 확인합니다
504
- * @example
522
+ * @description Cartesian chart type을 체크 합니다.
505
523
  * @since 1.0.0
506
524
  * @category Chart
507
- * @defaultValue
508
- *
509
525
  */
510
526
  private isCartesianChartType;
511
527
  /**
512
- * 카테시안 차트의 스케일을 설정합니다.
528
+ * @description 카테시안 차트의 스케일을 설정합니다.
513
529
  * @param scales
514
- * *
515
- * @remarks 카테시안 차트의 스케일을 설정합니다. 이 메소드는 차트의 축을 정의하는데 사용됩니다.
516
- * @example
530
+ * @returns {this}
517
531
  * @since 1.0.0
518
532
  * @category Scales
519
- * @defaultValue
520
- *
521
533
  */
522
534
  setScales(scales: CommonAxesSacels): this;
523
535
  /**
524
- * 카테시안 차트의 축 제목을 설정합니다.
536
+ * @description 카테시안 차트의 축 제목을 설정합니다.
525
537
  * @param axis
526
538
  * @param titleConfig
527
- * *
528
- * @remarks 원하는 축의 제목을 설정합니다.
529
- * @example
539
+ * @returns {this}
530
540
  * @since 1.0.0
531
541
  * @category Scales
532
542
  * @defaultValue
@@ -534,16 +544,12 @@ declare abstract class CartesianChartWrapper<TType extends CartesianChartType> e
534
544
  */
535
545
  setAxisTitle(axis: 'x' | 'y', titleConfig: CommonCartesianTitleConfig): this;
536
546
  /**
537
- * 카테시안 차트의 그리드 옵션을 설정합니다.
547
+ * @description 카테시안 차트의 그리드 옵션을 설정합니다.
538
548
  * @param axis
539
549
  * @param gridOptions
540
- * *
541
- * @remarks 차트 뒷 배경의 그리드(선) 옵션을 설정합니다.
542
- * @example
550
+ * @returns {this}
543
551
  * @since 1.0.0
544
552
  * @category Scales
545
- * @defaultValue
546
- *
547
553
  */
548
554
  setGridOptions(axis: 'x' | 'y', gridOptions: {
549
555
  display?: boolean;
@@ -551,12 +557,10 @@ declare abstract class CartesianChartWrapper<TType extends CartesianChartType> e
551
557
  lineWidth?: number;
552
558
  }): this;
553
559
  /**
554
- * 줌 기능을 추가합니다.
560
+ * @description 줌 기능을 추가합니다. 해당 기능은 플러그인 설치가 필요합니다.
555
561
  * @param defaultZoom
556
562
  * @param zoomOption
557
- * *
558
- * @remarks 차트의 줌 기능을 추가합니다. 해당 기능은 플러그인 설치가 필요합니다.
559
- * @example
563
+ * @returns {this}
560
564
  * @since 1.0.0
561
565
  * @category Plugins
562
566
  * @defaultValue defaultZoom = false
@@ -564,85 +568,70 @@ declare abstract class CartesianChartWrapper<TType extends CartesianChartType> e
564
568
  */
565
569
  addZoom(defaultZoom?: boolean, zoomOption?: object): this;
566
570
  /**
567
- * 데이터 라벨 플러그인을 추가합니다.
571
+ * @Description 차트에 데이터 라벨을 추가합니다. 기본 옵션을 사용하거나 사용자 정의 옵션을 적용할 수 있습니다.
568
572
  * @param defultDataLabels
569
573
  * @param dataLabelsOptions
570
- * @Description 차트에 데이터 라벨을 추가합니다. 기본 옵션을 사용하거나 사용자 정의 옵션을 적용할 수 있습니다.
574
+ * @returns {this}
571
575
  * @Category Plugins
572
576
  * @since 1.0.0
573
577
  * @defaultValue defultDataLabels = false
574
578
  */
575
579
  addDataLabels(defultDataLabels: boolean | undefined, dataLabelsOptions: PartialDataLabels): this;
576
580
  /**
577
- * 데이터셋에 y축을 설정합니다.
581
+ * @description 데이터셋에 y축을 설정합니다.
578
582
  * @param datasetIndex
579
583
  * @param axisId
580
- * *
581
- * @remarks 각 데이터셋의 축을 설정합니다.
582
- * @example
584
+ * @returns {this}
583
585
  * @since 1.0.0
584
586
  * @category Scales
585
587
  * @defaultValue axisId = 'y'
586
- *
587
588
  */
588
589
  setYAxisForDataset(datasetIndex: number, axisId?: string): this;
589
590
  /**
590
- * y1 축을 보장합니다.
591
591
  * @private
592
- * *
593
- * @remarks y1 축이 없을 경우 기본 구조를 추가합니다. 이 메소드는 y1 축을 사용하는 차트에서 필요합니다.
594
- * @example
592
+ * @description y1 축을 보장합니다.
595
593
  * @since 1.0.0
596
594
  * @category Scales
597
- * @defaultValue
598
- *
599
595
  */
600
596
  private ensureY1AxisExists;
601
597
  /**
602
- * 카테시안 차트의 축 범위를 설정합니다.
598
+ * @description 카테시안 차트의 축 범위를 설정합니다. 해당 차트의 스케일을 min, max 를 입력 받은 값으로 고정합니다.
603
599
  * @param axis
604
600
  * @param min
605
601
  * @param max
606
- *
607
- * *
608
- * @remarks 해당 차트의 스케일을 min, max 를 입력 받은 값으로 고정합니다.
609
- * @example
602
+ * @returns {this}
610
603
  * @since 1.0.0
611
604
  * @category Scales
612
- * @defaultValue
613
- *
614
605
  */
615
606
  setAxisRange(axis: 'x' | 'y', min?: number, max?: number): this;
616
607
  /**
617
- * 데이터셋의 yAxisID를 설정합니다.
608
+ * @description 데이터셋의 yAxisID를 설정합니다.
618
609
  * @param datasetIndex
619
610
  * @param axisID
620
- * *
621
- * @remarks 데이터셋의 아이디를 변경합니다.
622
- * @example
611
+ * @returns {this}
612
+ * @throws {CustomError} 해당 차트 타입이 yAxisID 옵션을 지원하지 않을 경우 에러를 발생시킵니다.
623
613
  * @since 1.0.0
624
614
  * @category Scales
625
- * @defaultValue
626
- *
627
615
  */
628
616
  setYAxisID(datasetIndex: number, axisID: string): this;
629
617
  /**
630
- * 축의 위치를 설정합니다.
618
+ * @description 축의 위치를 설정합니다.
631
619
  * @param axis
632
620
  * @param position
633
- * *
634
- * @remarks 해당하는 축의 위치를 변경합니다.
635
- * @example
621
+ * @returns {this}
622
+ * @throws {CustomError} 해당 축이 존재하지 않거나 position 옵션을 지원하지 않을 경우 에러를 발생시킵니다.
636
623
  * @since 1.0.0
637
624
  * @category Scales
638
- * @defaultValue
639
- *
640
625
  */
641
626
  setAxisPosition(axis: string, position: 'left' | 'right'): this;
642
627
  /**
643
- * 축에 이미지를 추가합니다.
628
+ * @description 축에 이미지를 추가합니다.
644
629
  * @param {string} axis
630
+ * @returns {this}
631
+ * @throws {CustomError} 이미지 속성이 없는 데이터셋이 있을 경우 에러를 발생시킵니다.
645
632
  * @Deprecated
633
+ * @Category Scales
634
+ * @Since 1.0.0
646
635
  */
647
636
  setAddImg(axis: string): this;
648
637
  /**
@@ -651,27 +640,102 @@ declare abstract class CartesianChartWrapper<TType extends CartesianChartType> e
651
640
  * @Deprecated
652
641
  */
653
642
  addRangeSlider(colors?: ZoomRangeSliderColors): this;
643
+ /**
644
+ * @description 차트의 패딩을 설정합니다.
645
+ * @param padding
646
+ * @returns {this}
647
+ * @Category options
648
+ * @Since 1.0.0
649
+ */
654
650
  setPadding(padding: any): this;
651
+ /**
652
+ * @description 데이터셋의 배경색에 알파 값을 설정합니다.
653
+ * @param {number} alpha
654
+ * @returns {this}
655
+ * @throws {CustomError} 알파 값이 0.0 미만 또는 1.0 초과일 경우 에러를 발생시킵니다.
656
+ * @Since 1.0.0
657
+ * @Category Dataset
658
+ */
655
659
  setBackgroundAlpha(alpha: number): this;
656
660
  /**
657
- * 색상에 알파 값을 추가합니다.
661
+ * @private
662
+ * @description 색상에 알파 값을 추가합니다.
658
663
  * @param color
659
664
  * @param alpha
660
- * @private
665
+ * @returns {string}
661
666
  */
662
667
  private addAlphaToColor;
663
668
  /**
664
- *
669
+ * @description 데이터셋의 파싱 키를 설정합니다. xAxisKey와 yAxisKey를 각각 설정할 수 있습니다. false로 설정하면 해당 축에 대한 파싱을 비활성화합니다.
665
670
  * @param {string | false} xAxisKey
666
671
  * @param {string | false} yAxisKey
667
- * @description
672
+ * @throws {CustomError} xAxisKey와 yAxisKey가 모두 false일 경우 에러를 발생시킵니다.
673
+ * @returns {this}
668
674
  * @Category options
669
675
  * @Since 1.0.0
670
676
  */
671
677
  setParsingKey(xAxisKey: string | false, yAxisKey: string | false): this;
678
+ /**
679
+ * @description 특정 데이터셋의 파싱 키를 설정합니다. xAxisKey와 yAxisKey를 각각 설정할 수 있습니다. false로 설정하면 해당 축에 대한 파싱을 비활성화합니다.
680
+ * @param {number} datasetIndex
681
+ * @param {string | false} xAxisKey
682
+ * @param {string | false} yAxisKey
683
+ * @returns {this}
684
+ * @throws {CustomError} 데이터셋이 존재하지 않을 경우 에러를 발생시킵니다.
685
+ * @Category options
686
+ * @Since 1.0.0
687
+ */
672
688
  setDatasetParsing(datasetIndex: number, xAxisKey: string | false, yAxisKey: string | false): this;
689
+ /**
690
+ * @description 모든 데이터셋의 파싱 키를 설정합니다. xAxisKey와 yAxisKey를 각각 설정할 수 있습니다. false로 설정하면 해당 축에 대한 파싱을 비활성화합니다.
691
+ * @param {string | false} xAxisKey
692
+ * @param {string | false} yAxisKey
693
+ * @returns {this}
694
+ * @throws {CustomError} 데이터셋이 존재하지 않을 경우 에러를 발생시킵니다.
695
+ * @Category options
696
+ * @Since 1.0.0
697
+ */
673
698
  setAllDatasetsParsing(xAxisKey: string | false, yAxisKey: string | false): this;
699
+ /**
700
+ * @description HTML 범례를 추가합니다. 해당 기능은 플러그인 설치가 필요합니다.
701
+ * @param {HtmlLegendOptions} obj
702
+ * @returns {this}
703
+ * @throws {CustomError} 옵션이 비어있거나 객체가 아닐 경우 에러를 발생시킵니다.
704
+ * @Since 1.0.0
705
+ * @category Plugins
706
+ */
674
707
  customLegend(obj: HtmlLegendOptions): this;
708
+ /**
709
+ * @Beta
710
+ * @description 데이터셋 배열에서 주어진 UID와 일치하는 데이터셋을 반환합니다. UID가 없거나 데이터셋이 비어있으면 undefined를 반환합니다.
711
+ * @param {string} uid
712
+ * @returns {CustomCartesianDataset<TType> | undefined}
713
+ * @throws {CustomError} UID가 없거나 데이터셋이 비어있을 때 에러를 발생시킵니다.
714
+ * @Since 1.0.0
715
+ * @category Dataset
716
+ */
717
+ getDataset(uid: string): CustomCartesianDataset<TType> | undefined;
718
+ /**
719
+ * @Beta
720
+ * @description 주어진 UID를 가진 데이터셋을 새로운 데이터셋으로 교체합니다. UID가 없거나 데이터셋이 비어있으면 에러를 발생시킵니다.
721
+ * @param {string} uid
722
+ * @param {CustomCartesianDataset<TType>} dataset
723
+ * @returns {this}
724
+ * @throws {CustomError} UID가 없거나 데이터셋이 비어있을 때 에러를 발생시킵니다.
725
+ * @Since 1.0.0
726
+ * @category Dataset
727
+ */
728
+ setDataset(uid: string, dataset: CustomCartesianDataset<TType>): this;
729
+ /**
730
+ * @Beta
731
+ * @description 새로운 데이터셋을 추가하고 고유 식별자(UID)를 반환합니다. 데이터셋 배열이 비어있으면 새로 생성합니다.
732
+ * @param {CustomCartesianDataset<TType>} dataset
733
+ * @returns {string}
734
+ * @throws {CustomError} 데이터셋이 null 또는 undefined일 때 에러를 발생시킵니다.
735
+ * @Since 1.0.0
736
+ * @category Dataset
737
+ */
738
+ addDataset(dataset: CustomCartesianDataset<TType>): string;
675
739
  }
676
740
 
677
741
  declare class BarChartWrapper extends CartesianChartWrapper<'bar'> implements BarChartBuilder {