解決辦法一:
創(chuàng)建節(jié)點(diǎn)的時(shí)候陌凳,改成 document.createElementNS('http://www.w3.org/2000/svg', 'line');
var xKeDu = document.createElementNS('http://www.w3.org/2000/svg', 'line');
xKeDu.setAttribute("x1",100);
xKeDu.setAttribute("y1",590);
xKeDu.setAttribute("x2",100);
xKeDu.setAttribute("y2",600);
xKeDu.style.stroke = "#333333";
xKeDu.style.strokeWidth = "1px";
xKeDuList.appendChild(xKeDu);
解決辦法二:
var xKeDuText = document.createElement('text');
xKeDuText.textContent = item.time;
xKeDuText.setAttribute("x",824 / (data.length + 1) * (index+1) + 80);
xKeDuText.setAttribute("y",630);
// xKeDuList.appendChild(xKeDuText);
xKeDuList.innerHTML = xKeDuList.innerHTML + xKeDuText.outerHTML;