Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: graphType doesn't update correctly #329

Open
ii888ii opened this issue Nov 10, 2024 · 1 comment
Open

Bug: graphType doesn't update correctly #329

ii888ii opened this issue Nov 10, 2024 · 1 comment

Comments

@ii888ii
Copy link

ii888ii commented Nov 10, 2024

<!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>
@Linho1219
Copy link

I've met the same issue. Destroying function plot instance and rebuilding now as a temporary solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants