MCPcopy Index your code
hub / github.com/tensorflow/tfjs-examples / drawXYData

Function drawXYData

polynomial-regression/index.js:50–61  ·  view source on GitHub ↗
(canvas, xyData)

Source from the content-addressed store, hash-verified

48// canvas: The canvas to draw the data in.
49// xyData: An Array of [x, y] Arrays.
50function drawXYData(canvas, xyData) {
51 drawAxes(canvas);
52 const ctx = canvas.getContext('2d');
53 for (let i = 0; i < xyData.length; ++i) {
54 ctx.beginPath();
55 const x = xyData[i][0];
56 const y = xyData[i][1];
57 const canvasCoord = world2canvas(canvas, x, y);
58 ctx.arc(canvasCoord[0], canvasCoord[1], 4, 0, Math.PI * 2, true);
59 ctx.stroke();
60 }
61}
62
63// Calculate the arithmetic mean of a vector.
64//

Callers 1

fitAndRenderFunction · 0.85

Calls 2

drawAxesFunction · 0.85
world2canvasFunction · 0.85

Tested by

no test coverage detected