stz-chart-maker 1.7.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +79 -2
- package/dist/index.js +2672 -3066
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChartTypeRegistry, ChartType, ChartDataset, GridLineOptions, FontSpec, Tick, PluginOptionsByType,
|
|
1
|
+
import { ChartTypeRegistry, ChartType, ChartDataset, GridLineOptions, FontSpec, Tick, PluginOptionsByType, Chart, ChartOptions, ChartEvent, ActiveElement, LegendOptions, Plugin as Plugin$1, TooltipItem } from 'chart.js';
|
|
2
2
|
import { TreemapControllerDatasetOptions } from 'chartjs-chart-treemap';
|
|
3
3
|
import { ZoomPluginOptions } from 'chartjs-plugin-zoom/types/options';
|
|
4
4
|
|
|
@@ -189,7 +189,7 @@ interface CommonAxes {
|
|
|
189
189
|
weight: number;
|
|
190
190
|
}
|
|
191
191
|
interface CommonCartesianAxes extends Omit<CommonAxes, 'ticks'>, Partial<CommonCartesian> {
|
|
192
|
-
type: 'category' | 'linear' | 'logarithmic' | 'time' | 'timeseries';
|
|
192
|
+
type: 'category' | 'linear' | 'logarithmic' | 'time' | 'timeseries' | 'realtime';
|
|
193
193
|
ticks?: CommonCartesianTicks;
|
|
194
194
|
}
|
|
195
195
|
type DeepPartialCartesianAxes = DeepPartial<CommonCartesianAxes>;
|
|
@@ -257,6 +257,54 @@ interface DataLabels {
|
|
|
257
257
|
}
|
|
258
258
|
type PartialDataLabels = Partial<DataLabels>;
|
|
259
259
|
|
|
260
|
+
/**
|
|
261
|
+
* `chartjs-plugin-streaming`의 옵션을 정의합니다.
|
|
262
|
+
* `addStreaming` 메서드에 이 타입의 객체를 전달하여 스트리밍 동작을 설정합니다.
|
|
263
|
+
* @see https://github.com/nagix/chartjs-plugin-streaming
|
|
264
|
+
*/
|
|
265
|
+
interface StreamingOptions {
|
|
266
|
+
/**
|
|
267
|
+
* 차트에 데이터가 표시되는 시간 (밀리초 단위).
|
|
268
|
+
*/
|
|
269
|
+
duration?: number;
|
|
270
|
+
/**
|
|
271
|
+
* 차트가 업데이트되는 간격 (밀리초 단위).
|
|
272
|
+
*/
|
|
273
|
+
refresh?: number;
|
|
274
|
+
/**
|
|
275
|
+
* 데이터 추가 시 발생하는 지연 시간 (밀리초 단위).
|
|
276
|
+
*/
|
|
277
|
+
delay?: number;
|
|
278
|
+
/**
|
|
279
|
+
* 애니메이션 프레임당 업데이트 여부.
|
|
280
|
+
*/
|
|
281
|
+
frame?: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* 차트 업데이트를 일시 중지할지 여부.
|
|
284
|
+
*/
|
|
285
|
+
pause?: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* 데이터가 차트에 머무는 시간 (Time to Live). `duration`과 유사합니다.
|
|
288
|
+
*/
|
|
289
|
+
ttl?: number;
|
|
290
|
+
/**
|
|
291
|
+
* 차트가 새로고침될 때 호출되는 콜백 함수.
|
|
292
|
+
* 이 함수 안에서 데이터 소스(WebSocket, API 등)로부터 받은 데이터를
|
|
293
|
+
* 차트의 데이터셋에 추가해야 합니다.
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* onRefresh: (chart) => {
|
|
297
|
+
* chart.data.datasets.forEach(dataset => {
|
|
298
|
+
* dataset.data.push({
|
|
299
|
+
* x: Date.now(),
|
|
300
|
+
* y: Math.random()
|
|
301
|
+
* });
|
|
302
|
+
* });
|
|
303
|
+
* }
|
|
304
|
+
*/
|
|
305
|
+
onRefresh?: (chart: Chart) => void;
|
|
306
|
+
}
|
|
307
|
+
|
|
260
308
|
/**
|
|
261
309
|
* ═════════════════════════════════════════════════════════════
|
|
262
310
|
* 📄 FILE : options.ts
|
|
@@ -328,6 +376,7 @@ type HtmlLegendOptions = {
|
|
|
328
376
|
type CustomOptionPlugins<TType extends ChartType = ChartType> = DeepPartial<PluginOptionsByType<TType>> & {
|
|
329
377
|
zoom?: DeepPartialZoomType;
|
|
330
378
|
datalabels?: PartialDataLabels;
|
|
379
|
+
streaming?: StreamingOptions;
|
|
331
380
|
settingsIcon?: {
|
|
332
381
|
iconSize?: Record<'w' | 'h', number>;
|
|
333
382
|
img?: string;
|
|
@@ -743,6 +792,34 @@ declare abstract class ChartWrapper<TType extends ChartType, TOptions extends Cu
|
|
|
743
792
|
* @beta
|
|
744
793
|
*/
|
|
745
794
|
setChartData(uid: string, newDataset: CustomChartDatasets<TType>): void;
|
|
795
|
+
/**
|
|
796
|
+
* @description 실시간 스트리밍 옵션을 설정합니다.
|
|
797
|
+
* 이 메서드를 사용하기 전에, 사용자는 'chartjs-plugin-streaming'을 설치하고 Chart.js에 직접 등록해야 합니다.
|
|
798
|
+
* @param {StreamingOptions} streamingOptions - `chartjs-plugin-streaming` 플러그인에 전달할 옵션 객체.
|
|
799
|
+
* @returns {this}
|
|
800
|
+
* @since 1.8.0
|
|
801
|
+
* @category plugin
|
|
802
|
+
* @example
|
|
803
|
+
* // 1. 사용자 측에서 웹소켓 등 데이터 소스 설정
|
|
804
|
+
* const myWebSocket = new WebSocket('wss://my-data-source');
|
|
805
|
+
*
|
|
806
|
+
* // 2. ChartWrapper에 스트리밍 옵션 적용
|
|
807
|
+
* chart.addStreaming({
|
|
808
|
+
* duration: 20000, // 20초 분량의 데이터를 차트에 표시
|
|
809
|
+
* refresh: 1000, // 1초마다 차트 업데이트
|
|
810
|
+
* onRefresh: (chart) => {
|
|
811
|
+
* // 3. 데이터 소스로부터 받은 데이터를 차트에 추가
|
|
812
|
+
* myWebSocket.onmessage = (event) => {
|
|
813
|
+
* const data = JSON.parse(event.data);
|
|
814
|
+
* chart.data.datasets[0].data.push({
|
|
815
|
+
* x: data.timestamp,
|
|
816
|
+
* y: data.value
|
|
817
|
+
* });
|
|
818
|
+
* };
|
|
819
|
+
* }
|
|
820
|
+
* });
|
|
821
|
+
*/
|
|
822
|
+
addStreaming(streamingOptions: StreamingOptions): this;
|
|
746
823
|
}
|
|
747
824
|
|
|
748
825
|
interface AxisColors {
|