MCPcopy Create free account
hub / github.com/SiddhantSilwal/RaspberryPi-GPIO-Web-Controller / updateEquation

Function updateEquation

AppData/static/js/graph.js:172–188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170 }
171
172 function updateEquation() {
173 try {
174 state.fn = new MathParser(eqnInput.value).parseExpression();
175 state.points = [];
176 for (let i = 0; i <= 500; i++) {
177 let x = i * (state.viewport.xMax / 500);
178 state.points.push({ x, y: state.fn(x) });
179 }
180 document.getElementById("errorMsg").style.display = "none";
181
182 // Auto-pause scan if equation is changed to prevent weird behavior
183 state.isScanning = false;
184 playBtn.innerText = "Play";
185 } catch (e) {
186 document.getElementById("errorMsg").style.display = "block";
187 }
188 }
189
190 function resize() {
191 const dpr = window.devicePixelRatio || 1;

Callers 1

initFunction · 0.85

Calls 1

parseExpressionMethod · 0.80

Tested by

no test coverage detected