我需要為我的 amChart 源使用 Unix 時(shí)間 (1608713282) 應(yīng)該是 12/23/20 04:30:00,但是它在工具提示中似乎將其讀取為 01/19/70 00:00:00。我嘗試使用以下代碼行在圖表和 dateAxis 上正確格式化它...chart.dateFormatter.inputDateFormat = 'x';chart.dataSource.parser.options.dateFormat = 'x';chart.dateFormatter.utc = true;dateAxis.dateFormatter.inputDateFormat = 'x';dateAxis.dataSource.parser.options.dateFormat = 'x';dateAxis.dateFormatter.utc = true;這是與我的 dateAxis 相關(guān)的代碼:// TimeStamp Axesvar dateAxis = chart.xAxes.push(new am4charts.DateAxis());dateAxis.renderer.grid.template.location = 0;dateAxis.renderer.minGridDistance = 100;dateAxis.tooltipDateFormat = 'MM/dd/yy H:mm:ss';通過一些調(diào)試,我發(fā)現(xiàn)有趣的是,將 JSON 源中的時(shí)間戳值用引號(hào)括起來(lái)會(huì)將顯示的日期從 01/19/70 00:00:00 更改為 11/16/13 23:59:58,不同但仍然不正確。這是我的數(shù)據(jù)的示例:{ "tstamp": 1608697800, "vol": 144, "staff": 61, "avail": 0}
amCharts dateFormatter.inputDateFormat 未正確讀取
繁花不似錦
2024-01-18 14:55:16