stz-chart-maker 1.0.15 → 1.0.17

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 +119 -20
  2. package/dist/index.js +1472 -1426
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ChartType, PluginOptionsByType, ChartOptions, GridLineOptions, FontSpec, Tick, Chart, ChartDataset, ChartTypeRegistry, Plugin as Plugin$1, TooltipItem } from 'chart.js';
1
+ import { ChartType, PluginOptionsByType, ChartOptions, GridLineOptions, FontSpec, Tick, Chart, ChartEvent, ActiveElement, ChartDataset, 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
 
@@ -210,6 +210,12 @@ type CustomChartOptions<TType extends ChartType = ChartType> = Override<ChartOpt
210
210
  right?: number;
211
211
  };
212
212
  };
213
+ onResize?: (this: Chart<TType>, chart: Chart<TType>, size: {
214
+ width: number;
215
+ height: number;
216
+ }) => void;
217
+ onClick?: (this: Chart<TType>, event: ChartEvent, elements: ActiveElement[]) => void;
218
+ onHover?: (this: Chart<TType>, event: ChartEvent, elements: ActiveElement[]) => void;
213
219
  }> & {
214
220
  _mounted?: (chart: Chart<TType>) => void;
215
221
  _chartId?: string;
@@ -350,9 +356,11 @@ declare abstract class ChartWrapper<TType extends ChartType> implements ChartBui
350
356
  static registry: Map<string, Constructor<any, any>>;
351
357
  constructor(type: TType, labels: (string | number)[], datasets: ChartDataset<TType, (number | null)[]>[], options: CustomChartOptions<TType>, plugins?: any | undefined);
352
358
  static create<TType extends ChartType>(type: TType, labels: (string | number)[], datasets: ChartDataset<TType, (number | null)[]>[], options?: CustomChartOptions<TType>, plugins?: any): TType extends CartesianChartType ? CartesianChartBuilder<TType> : ChartBuilder<TType>;
359
+ static register<TType extends ChartType, TInstance>(type: TType, wrapperClass: Constructor<TType, TInstance>): void;
360
+ static has(type: ChartType): boolean;
353
361
  protected abstract normalize(): void;
354
362
  protected abstract configAop(config: any): any;
355
- static register<TType extends ChartType, TInstance>(type: TType, wrapperClass: Constructor<TType, TInstance>): void;
363
+ abstract build(id?: string): ChartConfig;
356
364
  /**
357
365
  * 플러그인을 추가합니다.
358
366
  * @param plugin
@@ -377,7 +385,19 @@ declare abstract class ChartWrapper<TType extends ChartType> implements ChartBui
377
385
  * @param pluginId
378
386
  */
379
387
  hasPlugin(pluginId: string): boolean;
380
- build(id?: string): ChartConfig;
388
+ /**
389
+ *
390
+ * @param callback
391
+ * @description 차트 리사이즈 이벤트 콜백 함수를 설정합니다.
392
+ * @Since 1.0.0
393
+ * @category options
394
+ * @beta (기능 개발 중)
395
+ *
396
+ */
397
+ onResize(callback: (chart: Chart<TType>, size: {
398
+ width: number;
399
+ height: number;
400
+ }) => void): this;
381
401
  }
382
402
 
383
403
  interface AxisColors {
@@ -459,6 +479,16 @@ declare abstract class CartesianChartWrapper<TType extends CartesianChartType> e
459
479
  protected isBar(): boolean;
460
480
  protected normalize(): void;
461
481
  protected configAop(config: any): any;
482
+ /**
483
+ * 차트 설정 객체를 생성합니다.
484
+ * @param id
485
+ * @returns {ChartConfig}
486
+ * @Description 차트 설정 객체를 생성합니다. 이 메소드는 차트의 구성 요소를 종합하여 Chart.js에서 사용할 수 있는 형식으로 반환합니다.
487
+ * @Since 1.0.0
488
+ * @category Chart
489
+ *
490
+ */
491
+ build(id?: string): ChartConfig;
462
492
  makeConfig(id?: string): {
463
493
  _chartId: any;
464
494
  type: any;
@@ -644,20 +674,8 @@ declare abstract class CartesianChartWrapper<TType extends CartesianChartType> e
644
674
  customLegend(obj: HtmlLegendOptions): this;
645
675
  }
646
676
 
647
- type AllChartTypes = keyof ChartTypeRegistry;
648
- declare enum ChartTypes {
649
- BAR = "bar",
650
- LINE = "line",
651
- DOUGHNUT = "doughnut",
652
- PIE = "pie",
653
- RADAR = "radar",
654
- BUBBLE = "bubble",
655
- SCATTER = "scatter",
656
- TREE = "tree"
657
- }
658
-
659
677
  declare class BarChartWrapper extends CartesianChartWrapper<'bar'> implements BarChartBuilder {
660
- constructor(type: ChartTypes.BAR, labels: (string | number)[], datasets: CartesianDataset<ChartTypes.BAR>[], options?: CustomBarChartOptions, plugins?: any);
678
+ constructor(type: 'bar', labels: (string | number)[], datasets: CartesianDataset<'bar'>[], options?: CustomBarChartOptions, plugins?: any);
661
679
  protected requireLabels(): boolean;
662
680
  makeConfig(id?: string): {
663
681
  _chartId: any;
@@ -788,8 +806,27 @@ declare class BarChartWrapper extends CartesianChartWrapper<'bar'> implements Ba
788
806
  }
789
807
 
790
808
  declare class LineChartWrapper extends CartesianChartWrapper<'line'> implements LineChartBuilder {
791
- constructor(type: ChartTypes.LINE, labels: (string | number)[], datasets: CartesianDataset<'line'>[], options?: CustomChartOptions<'line'>);
809
+ constructor(type: 'line', labels: (string | number)[], datasets: CartesianDataset<'line'>[], options?: CustomChartOptions<'line'>);
810
+ /**
811
+ *
812
+ * @protected
813
+ * @returns {boolean}
814
+ * @description 라인 차트는 카테고리형 x축일 때 라벨이 필수입니다.
815
+ * @Since 1.0.0
816
+ * @category config
817
+ * @override
818
+ */
792
819
  protected requireLabels(): boolean;
820
+ /**
821
+ *
822
+ * @param id
823
+ * @returns {ChartConfiguration}
824
+ * @description 차트 설정 객체를 생성합니다.
825
+ * @Since 1.0.0
826
+ * @category config
827
+ * @override
828
+ * @Deprecated use build() Method
829
+ */
793
830
  makeConfig(id?: string): {
794
831
  _chartId: any;
795
832
  type: any;
@@ -878,6 +915,58 @@ declare class LineChartWrapper extends CartesianChartWrapper<'line'> implements
878
915
  *
879
916
  */
880
917
  setAllPointHoverRadius(hoverRadius: number): this;
918
+ /**
919
+ *
920
+ * @param {number} datasetIndex - 대상 데이터셋 인덱스
921
+ * @param {number} steps - 그라디언트 단계 (2단계면 0,1 / 3단계면 0,0.5,1)
922
+ * @param {string[]} colors - 색상 배열 (steps와 같은 길이여야 함)
923
+ * @param {'vertical' | 'horizontal'} direction - 그라디언트 방향 (기본값: vertical)
924
+ * @description 지정된 데이터셋에 단계별 그라디언트를 적용합니다.
925
+ * @remarks step 인자는 2 이상만 지원할것입니다.
926
+ * @Since 1.0.0
927
+ * @category dataset
928
+ * @beta (기능 테스트 중)
929
+ */
930
+ setGradient(datasetIndex: number, steps: number, colors: string[], direction?: 'vertical' | 'horizontal'): this;
931
+ /**
932
+ *
933
+ * @param {number} steps - 그라디언트 단계
934
+ * @param {string[]} colors - 색상 배열
935
+ * @param {'vertical' | 'horizontal'} direction - 그라디언트 방향 (기본값: vertical)
936
+ * @description 모든 데이터셋에 동일한 그라디언트를 적용합니다.
937
+ * @Since 1.0.0
938
+ * @category dataset
939
+ * @beta (기능 테스트 중)
940
+ */
941
+ setAllGradient(steps: number, colors: string[], direction?: 'vertical' | 'horizontal'): this;
942
+ /**
943
+ *
944
+ * @param {number} datasetIndex - 대상 데이터셋 인덱스
945
+ * @description 지정된 데이터셋의 그라디언트를 제거합니다.
946
+ * @Since 1.0.0
947
+ * @category dataset
948
+ * @beta (기능 테스트 중)
949
+ */
950
+ removeGradient(datasetIndex: number): this;
951
+ /**
952
+ *
953
+ * @description 모든 데이터셋의 그라디언트를 제거합니다.
954
+ * @Since 1.0.0
955
+ * @category dataset
956
+ * @beta (기능 테스트 중)
957
+ */
958
+ removeAllGradients(): this;
959
+ /**
960
+ *
961
+ * @param {number} steps - 단계 수
962
+ * @returns {number[]} 0부터 1까지의 위치 배열
963
+ * @description 주어진 단계 수에 따라 그라디언트 위치를 계산합니다.
964
+ * @Since 1.0.0
965
+ * @category utility
966
+ * @private
967
+ * @beta (기능 테스트 중)
968
+ */
969
+ private calculateGradientPositions;
881
970
  }
882
971
 
883
972
  declare const noDataPlugin: {
@@ -1021,7 +1110,7 @@ declare namespace LocalDefaults {
1021
1110
  declare class ChartFactory {
1022
1111
  private static registry;
1023
1112
  static register<TType extends ChartType, TInstance>(type: TType, wrapperClass: Constructor<TType, TInstance>): void;
1024
- static create<TType extends ChartType>(type: TType, ...args: ConstructorParameters<Constructor<TType, any>>): any;
1113
+ static create<TType extends ChartType>(type: TType, labels: (string | number)[], datasets: ChartDataset<TType, (number | null)[]>[], options?: CustomChartOptions<TType>, plugins?: any): any;
1025
1114
  static has(type: ChartType): boolean;
1026
1115
  static clear(): void;
1027
1116
  }
@@ -1038,9 +1127,20 @@ declare class ChartInstance {
1038
1127
  static resize(id: string): void;
1039
1128
  }
1040
1129
 
1130
+ type AllChartTypes = keyof ChartTypeRegistry;
1131
+ declare enum ChartTypes {
1132
+ BAR = "bar",
1133
+ LINE = "line",
1134
+ DOUGHNUT = "doughnut",
1135
+ PIE = "pie",
1136
+ RADAR = "radar",
1137
+ BUBBLE = "bubble",
1138
+ SCATTER = "scatter",
1139
+ TREE = "tree"
1140
+ }
1141
+
1041
1142
  declare const ChartToolBox: {
1042
1143
  setErrorLog(enabled: boolean): void;
1043
- setDebugLog(enabled: boolean): void;
1044
1144
  };
1045
1145
  declare const T$: {
1046
1146
  readonly create: typeof ChartWrapper.create;
@@ -1053,7 +1153,6 @@ declare const T$: {
1053
1153
  readonly defaultsOptions: typeof LocalDefaults;
1054
1154
  readonly toolBox: {
1055
1155
  setErrorLog(enabled: boolean): void;
1056
- setDebugLog(enabled: boolean): void;
1057
1156
  };
1058
1157
  };
1059
1158