dsh-xueqiu 1.22.6 → 1.22.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/README.en.md +1 -0
- package/README.md +2 -0
- package/dynamic/client.js +10 -0
- package/package.json +1 -1
- package/src/client/index.js +10 -0
package/README.en.md
CHANGED
|
@@ -135,6 +135,7 @@ The data layer is defended in depth — safe to leave open for hours:
|
|
|
135
135
|
|
|
136
136
|
## Changelog
|
|
137
137
|
|
|
138
|
+
- **1.22.7** (2026-08-26) — **Fix: minute chart flattened into a straight line after switching stocks** (e.g. viewing CATL after Maotai). `registerIndicator('xq-minute')` registers globally exactly once, and its calc closure captured the *first* mount instance's `baseRef` — so the second stock's minute chart reused the stale calc, keeping the previous stock's prev-close as baseline (CATL got Maotai's 1304.66; the y-axis stretched to 404~1229 while prices sat in 378~388, flattening the line). Fix: rebind a fresh calc bound to the current instance's baseRef via `overrideIndicator` on every mount. Verified with three back-to-back switches (Maotai 1304.66 → CATL 387.89 → BOE 5.75): prev-close always correct, price spans healthy at 130~180px.
|
|
138
139
|
- **1.22.6** (2026-08-26) — **Fix: duplicate hover info on the minute tab** (found while auditing 1.22.5). For the minute area chart open=high=low=close are identical, so the canvas OHLC legend was pure redundancy, and the xq-minute indicator legend (prev-close/avg) duplicated the custom .xq-tip. Minute mode now disables canvas legends entirely (candle + indicator); hover keeps only .xq-tip. Also: **K-line hover now shows MA values** (catching up on a gap since 1.22.0 where MA numbers were visible nowhere) — indicator legend set to `follow_cross`: on hover a second colored line below the candle row shows MA5/10/30/60 values (measured on Maotai: single line, 70% width, no wrap), matching Xueqiu.
|
|
139
140
|
- **1.22.5** (2026-08-26) — **Fix: hover OHLC legend wrapped to two lines over the candles** (leftover from 1.22.3). After `follow_cross`, the default English time/open/high/low/close/volume titles were too long for the narrow panel and the legend folded onto two lines covering candles on hover. Now a compact single-line Chinese legend (`开 高 低 收 量`, size 10) with the ticker title hidden — measured on hover: one 10px line at 45% width, no wrapping.
|
|
140
141
|
- **1.22.4** (2026-08-26) — **Fix: switching to the minute tab crashed the whole panel** (1.22.3 regression). The double-click-to-latest cleanup used `boxRef.current.removeEventListener`, but React clears refs before running effect cleanup on unmount, so `boxRef.current` was null → TypeError → the `conversation.input.dock` slot crashed entirely, leaving only the mini badge with no way back in. Now the node is captured in a closure inside the effect. Regression-tested: K-line↔minute 4 toggle rounds + collapse/badge-reopen/re-enter detail, 0 errors.
|
package/README.md
CHANGED
|
@@ -190,6 +190,8 @@ dsh-xueqiu/
|
|
|
190
190
|
|
|
191
191
|
## 📋 更新日志
|
|
192
192
|
|
|
193
|
+
- **1.22.7**(2026-08-26)
|
|
194
|
+
- 修复:**切换股票后分时图压成直线**(如看完茅台再看宁德时代)。`registerIndicator('xq-minute')` 全局只注册一次,其 calc 闭包捕获的是**首次挂载实例**的 `baseRef`——第二只股票的分时图复用了旧 calc,昨收基准仍是前一只股票的(宁德挂上茅台昨收 1304.66,y 轴被撑到 404~1229,而分时价格只在 378~388,曲线压成直线)。修复:每次挂载分时图用 `overrideIndicator` 重绑当前实例 baseRef 的新 calc。实测三股连环切换(茅台 1304.66 → 宁德 387.89 → 京东方 5.75),昨收均正确、价格波动 span 130~180px 饱满。
|
|
193
195
|
- **1.22.6**(2026-08-26)
|
|
194
196
|
- 修复:**分时悬停信息双份叠加**(1.22.5 排查发现)。分时面积图"开=高=低=收"同值,canvas OHLC 图例纯冗余,且 xq-minute 指标图例(昨收/均价)与自定义 .xq-tip 重复显示两遍。分时模式现在彻底关闭 canvas 图例(蜡烛+指标),悬停只保留 .xq-tip。
|
|
195
197
|
- 新增:**K线悬停显示 MA 数值**(1.22.0 以来 MA 值无处可看的补课)。指标图例改 `follow_cross`:悬停时蜡烛行(开高低收量)下方第二行彩色显示 MA5/10/30/60 数值(实测茅台 MA 行单行占宽 70%,不折行),与雪球一致。
|
package/dynamic/client.js
CHANGED
|
@@ -532,6 +532,9 @@ return {
|
|
|
532
532
|
const K = klcLib()
|
|
533
533
|
if (!K || !boxRef.current) { setNoLib(true); return undefined }
|
|
534
534
|
// 自定义指标:昨收虚线 + 均价线(series normal → 单独附图,避免干扰价格轴刻度)
|
|
535
|
+
// 注意:registerIndicator 全局只注册一次,calc 闭包捕获的是首次挂载实例的 baseRef——
|
|
536
|
+
// 切换股票后旧 calc 仍读旧实例的昨收(宁德分时曾因此挂上茅台昨收 1304,y 轴被撑爆成直线)。
|
|
537
|
+
// 因此每次挂载都 overrideIndicator 换成绑定当前 baseRef 的新 calc。
|
|
535
538
|
if (K.getSupportedIndicators().indexOf('xq-minute') < 0) {
|
|
536
539
|
K.registerIndicator({
|
|
537
540
|
name: 'xq-minute', shortName: '分时', series: 'normal',
|
|
@@ -577,6 +580,13 @@ return {
|
|
|
577
580
|
// 涨跌色改面积线色(palette up 色对A股即"涨")
|
|
578
581
|
chart.setStyles({ candle: { type: 'area', area: { lineColor: up ? klcPalette().up : klcPalette().down, backgroundColor: up ? 'rgba(239,68,68,0.10)' : 'rgba(34,197,94,0.10)' } } })
|
|
579
582
|
chart.createIndicator({ name: 'xq-minute', paneId: 'candle_pane' }) // 均价/昨收叠加到主图分时曲线(与雪球一致)
|
|
583
|
+
// 绑定当前实例 baseRef 的 calc(防跨股票串昨收,见上方注释)
|
|
584
|
+
chart.overrideIndicator({ name: 'xq-minute', calc: function (dataList) {
|
|
585
|
+
const base = baseRef.current.lastClose
|
|
586
|
+
return dataList.map(function (d) {
|
|
587
|
+
return { avg: Number(d.avg_price != null ? d.avg_price : d.close), base: base }
|
|
588
|
+
})
|
|
589
|
+
} })
|
|
580
590
|
// 分时固定视角:禁缩放拖拽,全部笔数铺满宽度
|
|
581
591
|
chart.setZoomEnabled(false)
|
|
582
592
|
chart.setScrollEnabled(false)
|
package/package.json
CHANGED
package/src/client/index.js
CHANGED
|
@@ -563,6 +563,9 @@ exports.default = {
|
|
|
563
563
|
const K = klcLib()
|
|
564
564
|
if (!K || !boxRef.current) { setNoLib(true); return undefined }
|
|
565
565
|
// 自定义指标:昨收虚线 + 均价线(series normal → 单独附图,避免干扰价格轴刻度)
|
|
566
|
+
// 注意:registerIndicator 全局只注册一次,calc 闭包捕获的是首次挂载实例的 baseRef——
|
|
567
|
+
// 切换股票后旧 calc 仍读旧实例的昨收(宁德分时曾因此挂上茅台昨收 1304,y 轴被撑爆成直线)。
|
|
568
|
+
// 因此每次挂载都 overrideIndicator 换成绑定当前 baseRef 的新 calc。
|
|
566
569
|
if (K.getSupportedIndicators().indexOf('xq-minute') < 0) {
|
|
567
570
|
K.registerIndicator({
|
|
568
571
|
name: 'xq-minute', shortName: '分时', series: 'normal',
|
|
@@ -608,6 +611,13 @@ exports.default = {
|
|
|
608
611
|
// 涨跌色改面积线色(palette up 色对A股即"涨")
|
|
609
612
|
chart.setStyles({ candle: { type: 'area', area: { lineColor: up ? klcPalette().up : klcPalette().down, backgroundColor: up ? 'rgba(239,68,68,0.10)' : 'rgba(34,197,94,0.10)' } } })
|
|
610
613
|
chart.createIndicator({ name: 'xq-minute', paneId: 'candle_pane' }) // 均价/昨收叠加到主图分时曲线(与雪球一致)
|
|
614
|
+
// 绑定当前实例 baseRef 的 calc(防跨股票串昨收,见上方注释)
|
|
615
|
+
chart.overrideIndicator({ name: 'xq-minute', calc: function (dataList) {
|
|
616
|
+
const base = baseRef.current.lastClose
|
|
617
|
+
return dataList.map(function (d) {
|
|
618
|
+
return { avg: Number(d.avg_price != null ? d.avg_price : d.close), base: base }
|
|
619
|
+
})
|
|
620
|
+
} })
|
|
611
621
|
// 分时固定视角:禁缩放拖拽,全部笔数铺满宽度
|
|
612
622
|
chart.setZoomEnabled(false)
|
|
613
623
|
chart.setScrollEnabled(false)
|