@rfkit/charts 1.2.5 → 1.2.7
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/index.js +14 -38
- package/modules/Spectrum/render.d.ts +15 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -7564,16 +7564,9 @@ function initSeriesSubscription(renderer) {
|
|
|
7564
7564
|
console.warn("[Series] globalID is required for series subscription");
|
|
7565
7565
|
return null;
|
|
7566
7566
|
}
|
|
7567
|
-
console.log("[initSeriesSubscription] 开始为 globalID 建立订阅:", globalID);
|
|
7568
7567
|
const subscriptions = [];
|
|
7569
7568
|
subscriptions.push(subscribeToSeries(globalID, events_SeriesEventName.UPDATED, (data)=>{
|
|
7570
|
-
console.log("[Series\u8BA2\u9605] UPDATED\u4E8B\u4EF6\u6536\u5230:", {
|
|
7571
|
-
seriesName: data.seriesName,
|
|
7572
|
-
display: data.config.display,
|
|
7573
|
-
globalID: data.globalID
|
|
7574
|
-
});
|
|
7575
7569
|
renderer.setSeries(data.config, true);
|
|
7576
|
-
console.log("[Series\u8BA2\u9605] \u8C03\u7528 draw()");
|
|
7577
7570
|
renderer.state.chart?.draw();
|
|
7578
7571
|
}));
|
|
7579
7572
|
subscriptions.push(subscribeToSeries(globalID, events_SeriesEventName.MODE_CHANGED, ()=>{
|
|
@@ -7592,9 +7585,7 @@ function initSeriesSubscription(renderer) {
|
|
|
7592
7585
|
if (renderer.state.series) renderer.state.series = {};
|
|
7593
7586
|
renderer.initSeries();
|
|
7594
7587
|
}));
|
|
7595
|
-
console.log("[initSeriesSubscription] 订阅建立完成, globalID:", globalID, "\u8BA2\u9605\u6570\u91CF:", subscriptions.length);
|
|
7596
7588
|
return ()=>{
|
|
7597
|
-
console.log("[initSeriesSubscription] 取消订阅, globalID:", globalID);
|
|
7598
7589
|
for (const unsubscribe of subscriptions)unsubscribe();
|
|
7599
7590
|
};
|
|
7600
7591
|
}
|
|
@@ -7684,23 +7675,11 @@ function mergeSeriesConfig(config, existing) {
|
|
|
7684
7675
|
}
|
|
7685
7676
|
function updateSeries(globalID, config) {
|
|
7686
7677
|
if (!config?.name) return;
|
|
7687
|
-
console.log("[updateSeries] \u5F00\u59CB\u66F4\u65B0:", {
|
|
7688
|
-
globalID,
|
|
7689
|
-
name: config.name,
|
|
7690
|
-
display: config.display
|
|
7691
|
-
});
|
|
7692
7678
|
const manager = getSeriesManager(globalID);
|
|
7693
7679
|
const existing = manager.getSeries(config.name);
|
|
7694
|
-
console.log('[updateSeries] existing:', existing);
|
|
7695
7680
|
const finalConfig = mergeSeriesConfig(config, existing);
|
|
7696
|
-
console.log('[updateSeries] finalConfig:', finalConfig);
|
|
7697
7681
|
if (existing) manager.removeSeries(config.name);
|
|
7698
7682
|
manager.addSeries(finalConfig);
|
|
7699
|
-
console.log("[updateSeries] \u53D1\u5E03 UPDATED \u4E8B\u4EF6:", {
|
|
7700
|
-
globalID,
|
|
7701
|
-
seriesName: config.name,
|
|
7702
|
-
display: finalConfig.display
|
|
7703
|
-
});
|
|
7704
7683
|
events_emitSeriesEvent(events_SeriesEventName.UPDATED, {
|
|
7705
7684
|
globalID,
|
|
7706
7685
|
seriesName: config.name,
|
|
@@ -10160,11 +10139,8 @@ class Spectrum {
|
|
|
10160
10139
|
globalID: '',
|
|
10161
10140
|
...props
|
|
10162
10141
|
};
|
|
10163
|
-
console.log('[Spectrum.constructor] globalID:', this.state.globalID);
|
|
10164
10142
|
this.firstRenderAutoFocus = false;
|
|
10165
|
-
console.log("[Spectrum.constructor] \u51C6\u5907\u521D\u59CB\u5316\u8BA2\u9605, globalID:", this.state.globalID);
|
|
10166
10143
|
this.initSeriesSubscription();
|
|
10167
|
-
console.log("[Spectrum.constructor] \u8BA2\u9605\u521D\u59CB\u5316\u5B8C\u6210");
|
|
10168
10144
|
this.init();
|
|
10169
10145
|
}
|
|
10170
10146
|
initSeriesSubscription() {
|
|
@@ -10189,14 +10165,11 @@ class Spectrum {
|
|
|
10189
10165
|
initSeries() {
|
|
10190
10166
|
const { globalID } = this.state;
|
|
10191
10167
|
if (!globalID) throw new Error('globalID is required for series initialization');
|
|
10192
|
-
console.log("[Spectrum.initSeries] \u5F00\u59CB\u521D\u59CB\u5316 series, globalID:", globalID);
|
|
10193
10168
|
const seriesWithTypes = getSeriesWithGraphicType(globalID);
|
|
10194
|
-
console.log("[Spectrum.initSeries] \u83B7\u53D6\u5230 series \u914D\u7F6E\u6570\u91CF:", seriesWithTypes.size);
|
|
10195
10169
|
seriesWithTypes.forEach((config)=>{
|
|
10196
10170
|
this.setSeries(config, true);
|
|
10197
10171
|
});
|
|
10198
10172
|
this.state.chart?.draw();
|
|
10199
|
-
console.log("[Spectrum.initSeries] \u521D\u59CB\u5316\u5B8C\u6210");
|
|
10200
10173
|
}
|
|
10201
10174
|
updateSeries(d, extraData) {
|
|
10202
10175
|
const { series, chart } = this.state;
|
|
@@ -10251,12 +10224,6 @@ class Spectrum {
|
|
|
10251
10224
|
const { chart, series, globalID } = this.state;
|
|
10252
10225
|
const { name } = config;
|
|
10253
10226
|
if (!chart || !name || !config) return;
|
|
10254
|
-
console.log("[Spectrum.setSeries] \u6536\u5230\u914D\u7F6E:", {
|
|
10255
|
-
name,
|
|
10256
|
-
display: config.display,
|
|
10257
|
-
skipEventEmit,
|
|
10258
|
-
currentDisplay: series[name]?.display
|
|
10259
|
-
});
|
|
10260
10227
|
const merged = {
|
|
10261
10228
|
...series[name],
|
|
10262
10229
|
...config
|
|
@@ -10269,7 +10236,6 @@ class Spectrum {
|
|
|
10269
10236
|
thickness,
|
|
10270
10237
|
display
|
|
10271
10238
|
};
|
|
10272
|
-
console.log("[Spectrum.setSeries] \u5408\u5E76\u540E\u7684\u914D\u7F6E:", c, "\u539Fmerged:", merged);
|
|
10273
10239
|
series[name] = c;
|
|
10274
10240
|
chart.setSeries(c);
|
|
10275
10241
|
if (!skipEventEmit && globalID) try {
|
|
@@ -10305,7 +10271,7 @@ class Spectrum {
|
|
|
10305
10271
|
chart.setIntervel(interval);
|
|
10306
10272
|
}
|
|
10307
10273
|
reset() {
|
|
10308
|
-
this.
|
|
10274
|
+
this.clearChart();
|
|
10309
10275
|
this.resize();
|
|
10310
10276
|
}
|
|
10311
10277
|
resize() {
|
|
@@ -10313,13 +10279,23 @@ class Spectrum {
|
|
|
10313
10279
|
this.zoom();
|
|
10314
10280
|
this.state.chart.resize();
|
|
10315
10281
|
}
|
|
10316
|
-
|
|
10282
|
+
clearChart() {
|
|
10283
|
+
const { chart } = this.state;
|
|
10284
|
+
chart.clear();
|
|
10285
|
+
}
|
|
10286
|
+
destroy() {
|
|
10317
10287
|
if (this.seriesUnsubscribe) {
|
|
10318
10288
|
this.seriesUnsubscribe();
|
|
10319
10289
|
this.seriesUnsubscribe = void 0;
|
|
10320
10290
|
}
|
|
10321
|
-
|
|
10322
|
-
|
|
10291
|
+
this.clearChart();
|
|
10292
|
+
}
|
|
10293
|
+
dispose() {
|
|
10294
|
+
this.destroy();
|
|
10295
|
+
return ()=>{};
|
|
10296
|
+
}
|
|
10297
|
+
clear() {
|
|
10298
|
+
this.clearChart();
|
|
10323
10299
|
}
|
|
10324
10300
|
}
|
|
10325
10301
|
const IQLine = ()=>{
|
|
@@ -48,6 +48,21 @@ export default class Spectrum {
|
|
|
48
48
|
zoom(): void;
|
|
49
49
|
reset(): void;
|
|
50
50
|
resize(): void;
|
|
51
|
+
/**
|
|
52
|
+
* 清除图表内容(不取消订阅)
|
|
53
|
+
*/
|
|
54
|
+
clearChart(): void;
|
|
55
|
+
/**
|
|
56
|
+
* 销毁实例(取消订阅)
|
|
57
|
+
*/
|
|
58
|
+
destroy(): void;
|
|
59
|
+
/**
|
|
60
|
+
* 组件卸载时的清理(useChart 会调用此方法)
|
|
61
|
+
*/
|
|
62
|
+
dispose(): () => void;
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated 使用 clearChart() 或 destroy()
|
|
65
|
+
*/
|
|
51
66
|
clear(): void;
|
|
52
67
|
}
|
|
53
68
|
export {};
|