plot.ts aktualisiert
parent
715a3d0f4d
commit
031f151f56
6
plot.ts
6
plot.ts
|
@ -6,4 +6,10 @@ export const document = new DOMParser().parseFromString(
|
|||
|
||||
export const plot = (data) => {
|
||||
return Plot.line(data, {x: "x", y: "y"}).plot({y: {grid: true}, document})
|
||||
}
|
||||
|
||||
export const plotxy = (xmin, xmax, step, y) => {
|
||||
const x = Array.from({length: (xmax - xmin)/step}, (_, i) => (i - xmin) * step)
|
||||
const data = x.map(x => ({x, y: y(x)}))
|
||||
return Plot.line(data, {x: "x", y: "y"}).plot({y: {grid: true}, document})
|
||||
}
|
Loading…
Reference in New Issue