mauriciopoppe / function-plot

A 2d function plotter for the web

Home Page:https://mauriciopoppe.github.io/function-plot/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Including a 'class' attr causes line ghosting

adamvanaken opened this issue · comments

The path and/or line elements in the content graph are added every zoom/pan redraw, rather than updated/replaced.

Steps to reproduce:

  1. Open the code sandbox from the docs: https://codesandbox.io/s/muddy-cdn-ibl5x?from-embed

  2. Add a class attribute:

image

  1. Pan/zoom graph and notice the ghosting:

image

I believe this is happening because setting data.*.attr.class is overriding the class set by functionPlot on each datum so when there's the d3 data binding it appears to functionPlot that this is a new datum.

A small workaround would be to merge the class with functionPlot's class, on the downside it'd not be possible to remove a class on update, I think that could work.

It should be fixed in https://github.com/mauriciopoppe/function-plot/releases/tag/v1.23.3, thanks for the bug report 🙏🏼.