Fix historical chart blank — ISO time strings rejected by LightweightCharts
The historical runner stores equity curve times as ISO strings like "2026-07-05T07:00:00" but LightweightCharts only accepts Unix timestamps. Chart was loading 721 data points but rendering blank because time values were silently rejected. Changes: - renderBTDetail: convert string times to Unix timestamps before setData() - openDetail: same conversion for live/paper detail charts - pushEquity: same conversion for main area equity charts All chart codepaths now handle both string ISO and numeric timestamps.
This commit is contained in:
@@ -322,7 +322,7 @@ function renderBTDetail(full){
|
||||
// Equity chart
|
||||
if(!detChart)initDetChart();
|
||||
var pts=[],curve=full.equity_curve||[];
|
||||
for(var i=0;i<curve.length;i++){if(curve[i]&&curve[i].t)pts.push({time:curve[i].t,value:curve[i].v})}
|
||||
for(var i=0;i<curve.length;i++){if(curve[i]&&curve[i].t)var ct=curve[i].t;if(typeof ct==="string")ct=Math.floor(new Date(ct).getTime()/1000);pts.push({time:ct,value:curve[i].v})}
|
||||
if(pts.length>0){detSer.setData(pts);detChart.timeScale().fitContent();setTimeout(function(){detChart.timeScale().fitContent()},200)}
|
||||
// Trades table (show pnl_net or pnl_gross based on toggle)
|
||||
var trows='',tlist=full.trades||[];
|
||||
@@ -391,7 +391,7 @@ function openDetail(name,tab){
|
||||
if(!detChart)initDetChart();
|
||||
var eqData=Array.isArray(equity)?equity:(equity[name]||[]);
|
||||
if(eqData.length>0){
|
||||
var pts=[];for(var i=0;i<eqData.length;i++){if(eqData[i]&&eqData[i].t)pts.push({time:eqData[i].t,value:eqData[i].v})}
|
||||
var pts=[];for(var i=0;i<eqData.length;i++){if(eqData[i]&&eqData[i].t){var edt=eqData[i].t;if(typeof edt==='string')edt=Math.floor(new Date(edt).getTime()/1000);pts.push({time:edt,value:eqData[i].v})}}
|
||||
detSer.setData(pts);detChart.timeScale().fitContent();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user