Closed
Description
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="https://unpkg.com/function-plot/dist/function-plot.js"></script>
</head>
<body>
Does nothing:
<button id=upd>update existing fn</button>
<br>
Doesn't remove old polyline plot:
<button id=redefine>redefine data</button>
<div id=plot></div>
<script>
let obj = {
target: plot,
grid: true,
data: [
{ fn: 'x' }
]
}
functionPlot(obj)
upd.addEventListener('click', evt => {
obj.data[0].nSamples = 10
obj.data[0].graphType = 'scatter'
console.log(obj)
functionPlot(obj)
})
redefine.addEventListener('click', evt => {
obj.data = [{
fn: 'x', nSamples: 10, graphType: 'scatter'
}]
console.log(obj)
functionPlot(obj)
})
</script>
</body>
</html>