MCPcopy Create free account
hub / github.com/Marus/cortex-debug / updateGraph

Method updateGraph

src/grapher/xygraph.ts:117–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115 }
116
117 public updateGraph() {
118 if (!this.stopped) {
119 try {
120 const now = new Date().getTime();
121 const limit = now - this.span;
122
123 if (this.points.length > 0) {
124 const last = this.points[this.points.length - 1];
125
126 this.points = this.points.filter((xy) => xy.timestamp >= limit);
127 if (this.points.length === 0) { this.points.push(last); }
128
129 this.path.datum(this.points).attr('d', this.line);
130 }
131 }
132 catch (e) {
133 console.log('Error Updating Plot: ', e);
134 }
135 }
136
137 window.requestAnimationFrame(this.updateGraph.bind(this));
138 }
139}

Callers

nothing calls this directly

Calls 2

logMethod · 0.80
requestAnimationFrameMethod · 0.65

Tested by

no test coverage detected