Skip to content

feat: add timeline5 (5-day) support for timeline chart#1

Open
Southseast wants to merge 1 commit into
chengzuopeng:mainfrom
Southseast:feat/timeline5-support
Open

feat: add timeline5 (5-day) support for timeline chart#1
Southseast wants to merge 1 commit into
chengzuopeng:mainfrom
Southseast:feat/timeline5-support

Conversation

@Southseast
Copy link
Copy Markdown

@Southseast Southseast commented Apr 25, 2026

新增功能

  • 五日分时图(timeline5):VWAP 均价线计算(按交易日重置累计量),多日日期标签居中显示,日间虚线分隔
  • 无限滚动加载(loadMore):日K/周K/月K 向左滚动自动加载历史数据,通过 requestOptions.loadMoreLimit 可配置每次请求数量
  • 统一 dataZoom 控制:新增 showDataZoomSlider prop,支持 boolean | Partial<Record<PeriodType, boolean>>,可按周期单独控制缩放开关(如 { timeline: false, timeline5: false })

修复功能

  • 分时图成交量计算:修复跨交易日累计重置时差值为负,导致成交量显示异常

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for a 5-day timeline view (timeline5) by implementing VWAP calculations, day-boundary detection for multi-day charts, and specific xAxis formatting. Key feedback includes fixing a bug where non-cumulative volume and amount values were used in the data mapping, addressing regressions in the xAxis formatter and label interval logic that affected the standard 1-day view, and suggesting the abstraction of duplicated cache key construction logic.

Comment thread src/hooks/useKlineData.ts Outdated
Comment thread src/utils/timelineBuilder.ts Outdated
Comment thread src/utils/timelineBuilder.ts Outdated
Comment thread src/hooks/useKlineData.ts Outdated
@Southseast
Copy link
Copy Markdown
Author

看着有点 bug,我改了改,效果图如下。
image

@Southseast
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for 5-day timeline charts (timeline5) with VWAP calculations and multi-day axis formatting. It also adds configurable visibility for data zoom sliders in both K-line and timeline views. Feedback focuses on improving the user experience by setting the loading state when clearing data, ensuring consistent x-axis label formatting and placement, and aligning data zoom IDs to maintain compatibility with the chart's zoom methods.

Comment thread src/hooks/useKlineData.ts
Comment thread src/utils/timelineBuilder.ts Outdated
Comment thread src/utils/timelineBuilder.ts Outdated
Comment thread src/utils/timelineBuilder.ts Outdated
@Southseast Southseast force-pushed the feat/timeline5-support branch 2 times, most recently from 40358bb to 9f89775 Compare April 25, 2026 10:00
@Southseast
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for 5-day timeline charts and infinite scrolling for K-line charts. Key changes include the implementation of a loadMore mechanism in the useKlineData hook, logic to maintain the chart's visual range when prepending historical data, and the addition of showDataZoomSlider and showTimelineDataZoom props for UI customization. Feedback suggests improving the sensitivity of the scroll-to-load trigger by using a threshold instead of an exact zero check and extracting hardcoded pagination limits into constants.

Comment thread src/KLineChart.tsx Outdated
Comment thread src/hooks/useKlineData.ts Outdated
@Southseast Southseast marked this pull request as draft April 25, 2026 13:08
@Southseast
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for loading more historical data via infinite scrolling (scrolling left), adds a 5-day timeline view (timeline5) with VWAP calculation, and provides a new showDataZoomSlider prop to control the visibility of the zoom slider. Key changes include the implementation of a loadMore function in useKlineData, logic to maintain the visible range when prepending data, and enhanced timeline chart building to support multi-day displays. Review feedback highlights that hardcoding the initial zoom range to start: 2 overrides the visibleCount property, suggests merging redundant event listeners, and recommends handling errors during the "load more" process.

Comment thread src/KLineChart.tsx Outdated
Comment thread src/KLineChart.tsx Outdated
Comment thread src/KLineChart.tsx Outdated
Comment thread src/hooks/useKlineData.ts Outdated
@Southseast
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the K-line chart component by implementing infinite scrolling for historical data and adding support for a 5-day timeline view. Key updates include the loadMore functionality in the useKlineData hook, VWAP calculations for the timeline5 period, and improved zoom state management to maintain the visible range when prepending data. Additionally, a new showDataZoomSlider prop allows for granular control over the zoom slider's visibility across different chart periods. I have no feedback to provide as there are no review comments to address.

@Southseast Southseast force-pushed the feat/timeline5-support branch 4 times, most recently from 156ac4a to 8fcd77d Compare April 25, 2026 14:22
@Southseast Southseast marked this pull request as ready for review April 25, 2026 14:23
@Southseast Southseast force-pushed the feat/timeline5-support branch 3 times, most recently from 121ac8b to 8346c7c Compare April 25, 2026 14:39
## 新增功能

- 五日分时图(timeline5):VWAP 均价线计算(按交易日重置累计量),多日日期标签居中显示,日间虚线分隔
- 无限滚动加载(loadMore):日K/周K/月K 向左滚动自动加载历史数据,通过 requestOptions.loadMoreLimit 可配置每次请求数量
- 统一 dataZoom 控制:新增 showDataZoomSlider prop,支持 boolean | Partial<Record<PeriodType, boolean>>,可按周期单独控制缩放开关(如 { timeline: false, timeline5: false })

## 修复功能

- 分时图成交量计算:修复跨交易日累计重置时差值为负,导致成交量显示异常
@Southseast Southseast force-pushed the feat/timeline5-support branch from 8346c7c to 36c49f8 Compare April 25, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant