ConstellationDiagram.html.md

This commit is contained in:
严浩
2025-04-10 15:00:10 +08:00
parent 6b99afc240
commit 106eba0053

View File

@ -0,0 +1,19 @@
## 这个代码没测试。
``javascript
// 如果需要明确设置模式(虽然默认就是星座图)
widget.setViewMode(0); // 0=星座图
widget.feed(testData);
// 如果想测试余晖效果
widget.setViewMode(3); // 3=余晖图
setInterval(() => {
const newData = [];
for (let i = 0; i < 20; i++) { // 每次添加少量新点
const x = Math.random() * 2 - 1;
const y = Math.random() * 2 - 1;
newData.push([x, y]);
}
widget.feed(newData); // 传入新数据以观察余晖
}, 500); // 每 500ms 更新一次
```