我正在寻找解决方案,以将所有数据显示在amcharts4中,我的数据没有准确显示,只是在显示它们之前就中了,对他们有什么解决办法?
chart.dataSource.url ="/static/json/{{ Post.Datasource|safe }}.json";
chart.dataSource.parser = new am4core.JSONParser();
chart.dataSource.reloadFrequency = 5000;
chart.dateFormatter.inputDateFormat = "i";
var title = chart.titles.create();
//Funtion Date From and to
chart.dataSource.events.on("parseended", function(ev) {
var data = ev.target.data;
for (var i = 0; i < data.length; i++) {
var startdate = new Date(data[0]["DATETIME"]).toISOString().replace("T"," ").replace("Z","").replace(".000","");
var enddate = new Date(data[data.length -1]["DATETIME"]).toISOString().replace("T"," ").replace("Z","").replace(".000","");
}
title.html = (
"Data from :" + '<span class="colors"> ' +
startdate+ '</span> ' +
" to " + '<span class="colors">' +
enddate + '</span>'
);
});
文字显示的长度不足数据,我的标题也没有刷新
答案 0 :(得分:0)
时刻库可以轻松转换数据
starttime = moment(starttime).format(“ YYYY-MM-DD HH:mm:ss”);