mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 14:34:15 +08:00
fix: 图表x轴显示完整日期 + 组合回测取数翻页
图表日期格式(4 个组件):KlineChart/EquityChart/CompareChart/ PortfolioCompareChart 的 xAxis 加 axisLabel.formatter,强制显示原始 日期字符串。ECharts 默认把 ISO 日期当时间对象解析,丢失年份只显示 月-日+00:00。 组合回测取数翻页(_fetch_portfolio_bars):固定 count=800 改为翻页循环 (与前端 fetchBars 同逻辑),拼接后 sort_values 排序再过滤。修复组合 回测图表从 800 根最早点(2023-03-14)开始、缺失早期数据的问题。 实测组合回测 2019-01-07 起:净值 1814 点(不再是 800),首日正确。
This commit is contained in:
@@ -41,7 +41,12 @@ function buildOption(): echarts.EChartsCoreOption {
|
||||
},
|
||||
legend: { top: 0, data: seriesData.map((s) => s.name) },
|
||||
grid: { left: '8%', right: '5%', top: 30, bottom: 50 },
|
||||
xAxis: { type: 'category', data: allDates, boundaryGap: false },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: allDates,
|
||||
boundaryGap: false,
|
||||
axisLabel: { formatter: (v: string) => v },
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
scale: true,
|
||||
|
||||
@@ -41,6 +41,7 @@ function buildOption(): echarts.EChartsCoreOption {
|
||||
data: dates,
|
||||
boundaryGap: false,
|
||||
axisLine: { onZero: false },
|
||||
axisLabel: { formatter: (v: string) => v },
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
|
||||
@@ -82,6 +82,11 @@ function buildOption(): echarts.EChartsCoreOption {
|
||||
boundaryGap: true,
|
||||
axisLine: { onZero: false },
|
||||
splitLine: { show: false },
|
||||
// 强制显示原始日期字符串,避免 ECharts 把 "2024-01-15" 当时间对象
|
||||
// 解析后默认按 {MM}-{dd} {HH}:{mm} 显示(丢年份)
|
||||
axisLabel: {
|
||||
formatter: (v: string) => v,
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
scale: true,
|
||||
|
||||
@@ -50,7 +50,12 @@ function buildOption(
|
||||
},
|
||||
legend: { top: 0, data: series.map((s) => s.name) },
|
||||
grid: { left: '8%', right: '5%', top: 30, bottom: 50 },
|
||||
xAxis: { type: 'category', data: allDates, boundaryGap: false },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: allDates,
|
||||
boundaryGap: false,
|
||||
axisLabel: { formatter: (v: string) => v },
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
scale: true,
|
||||
|
||||
Reference in New Issue
Block a user