@363045841yyt/klinechart 0.6.1 → 0.6.2

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.
@@ -128,6 +128,70 @@ export declare class Chart {
128
128
  private indicatorScheduler;
129
129
  /** 上次可见范围(用于检测视口变化) */
130
130
  private lastVisibleRange;
131
+ /** 当前激活的主图指标列表(如 ['boll', 'ma']) */
132
+ private activeMainIndicators;
133
+ /** 主图指标参数配置 */
134
+ private mainIndicatorParams;
135
+ /**
136
+ * 启用主图指标
137
+ * @param indicatorId 指标ID: 'MA' | 'BOLL' | 'EXPMA' | 'ENE'
138
+ * @param params 可选的指标参数
139
+ * @returns 是否成功启用
140
+ */
141
+ enableMainIndicator(indicatorId: string, params?: Record<string, number | boolean>): boolean;
142
+ /**
143
+ * 禁用主图指标
144
+ * @param indicatorId 指标ID
145
+ * @returns 是否成功禁用
146
+ */
147
+ disableMainIndicator(indicatorId: string): boolean;
148
+ /**
149
+ * 切换主图指标启用状态
150
+ * @param indicatorId 指标ID
151
+ * @param enabled 是否启用
152
+ */
153
+ toggleMainIndicator(indicatorId: string, enabled: boolean): void;
154
+ /**
155
+ * 获取当前激活的主图指标列表
156
+ * @returns 激活的指标ID数组
157
+ */
158
+ getActiveMainIndicators(): string[];
159
+ /**
160
+ * 检查主图指标是否激活
161
+ * @param indicatorId 指标ID
162
+ */
163
+ isMainIndicatorActive(indicatorId: string): boolean;
164
+ /**
165
+ * 更新主图指标参数
166
+ * @param indicatorId 指标ID
167
+ * @param params 参数对象
168
+ */
169
+ updateMainIndicatorParams(indicatorId: string, params: Record<string, number | boolean>): void;
170
+ /**
171
+ * 获取主图指标参数
172
+ * @param indicatorId 指标ID
173
+ */
174
+ getMainIndicatorParams(indicatorId: string): Record<string, number | boolean> | null;
175
+ /**
176
+ * 清除所有主图指标
177
+ */
178
+ clearMainIndicators(): void;
179
+ /**
180
+ * 启用主图指标渲染器(内部方法)
181
+ */
182
+ private enableMainIndicatorRenderer;
183
+ /**
184
+ * 禁用主图指标渲染器(内部方法)
185
+ */
186
+ private disableMainIndicatorRenderer;
187
+ /**
188
+ * 更新调度器配置(内部方法)
189
+ */
190
+ private updateIndicatorSchedulerConfig;
191
+ /**
192
+ * @deprecated 使用 enableMainIndicator/disableMainIndicator 替代
193
+ */
194
+ setActiveMainIndicators(indicators: string[]): void;
131
195
  /**
132
196
  * 创建图表实例
133
197
  * @param dom 由 Vue 组件传入的 DOM 句柄
@@ -259,6 +323,11 @@ export declare class Chart {
259
323
  * @param deltaY Y轴像素偏移(正数向下拖动)
260
324
  */
261
325
  translatePrice(paneId: string, deltaY: number): void;
326
+ /**
327
+ * 重置价格轴垂直偏移
328
+ * @param paneId 目标 pane ID
329
+ */
330
+ resetPriceOffset(paneId: string): void;
262
331
  /**
263
332
  * 缩放价格轴(用于右侧刻度栏上下拖动)
264
333
  * @param paneId 目标 pane ID
@@ -157,10 +157,17 @@ export declare class IndicatorScheduler {
157
157
  private dirtyWmsrState;
158
158
  private dirtyKstState;
159
159
  private dirtyFastkState;
160
+ /** 当前激活的主图指标列表 */
161
+ private activeMainIndicators;
160
162
  /**
161
163
  * 设置 PluginHost,用于读写 StateStore
162
164
  */
163
165
  setPluginHost(host: PluginHost): void;
166
+ /**
167
+ * 设置当前激活的主图指标(用于极值计算过滤)
168
+ * @param indicators 激活的指标ID列表,如 ['ma', 'boll', 'expma', 'ene']
169
+ */
170
+ setActiveMainIndicators(indicators: string[]): void;
164
171
  /**
165
172
  * 数据变更时调用
166
173
  * @param data 新的 K 线数据
@@ -247,5 +254,13 @@ export declare class IndicatorScheduler {
247
254
  * 3. 写入所有指标的 StateStore
248
255
  */
249
256
  private computeIfDirty;
257
+ /**
258
+ * 获取主图指标极值(用于与K线极值合并计算价格轴范围)
259
+ * @returns 主图指标的价格范围,无指标时返回 null
260
+ */
261
+ getMainIndicatorPriceRange(): {
262
+ min: number;
263
+ max: number;
264
+ } | null;
250
265
  }
251
266
  export {};
@@ -94,6 +94,10 @@ export declare class Pane {
94
94
  * 根据当前可见索引区间更新 priceRange 并同步到 yAxis
95
95
  * @param data 全量 K 线数据
96
96
  * @param range 当前视口可见的索引范围(由 getVisibleRange 计算)
97
+ * @param indicatorRange 可选的指标极值范围,与K线极值合并
97
98
  */
98
- updateRange(data: KLineData[], range: VisibleRange): void;
99
+ updateRange(data: KLineData[], range: VisibleRange, indicatorRange?: {
100
+ min: number;
101
+ max: number;
102
+ } | null): void;
99
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@363045841yyt/klinechart",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "A lightweight financial K-line charting library with first-class AI Agent support, crisp ResizeObserver-driven rendering, and plugin-based architecture. Focused on quantitative trading scenarios with TradingView-level interaction experience.",
5
5
  "author": "363045841 <slslswbsy@qq.com>",
6
6
  "license": "MIT",