question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

zoom and annotation don't work together

See original GitHub issue

Well, I’ll try to ask here, trying to use both plugins

    const options = useMemo(() => ({
        plugins: {
            zoom: zoomOptions,
            annotation: annotationOptions,
            legend: {
                display: false
            },
            tooltip: {
                enabled: false
            },
        },
        responsive: true,
        maintainAspectRatio: false,
        scales: scales,
        elements: {
            point: {
                radius: 0,
                hoverRadius: 0,
                borderWidth: 0,
                backgroundColor: 'rgba(0,0,0,0)'
            }
        }
    }), [zoomOptions, annotationOptions, preparedSpectraData]);

But when I set custom zoom in my chart and change annotation options by, for ex. pressing the button that adds a line on my chart, then zoom is resetting because whole chart is updating. Maybe you have some thoughts on this how can I avoid this behavior?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
LeeLenaleeecommented, Jun 29, 2022

not totally sure where the issue lies, within the plugin or withing the wrapper.

It seems that it is not an issue with the annotation plugin, if you make a state for the labels array zoom and change the labels array to somthing else it also happens.

Although I am suspecting the issue to be in the wrapper since if you go into the chart object and add the annotion that way and update it, it works fine: https://stackblitz.com/edit/react-ts-7g5czk?file=Chart.js

@kurkle can you switch this issue over to the zoom repo?

1reaction
kurklecommented, Jun 29, 2022

@kurkle can you switch this issue over to the zoom repo?

I’m not sure the issue is in the zoom plugin either. The chart is re-created due to state change, so the issue is actually the usage of state for the annotation options. I’m sure there are use cases where its better to re-create the chart when options change, but this is not one of those.

Similar to @LeeLenaleee workaround, but updating the original object (reference) instead. https://stackblitz.com/edit/react-ts-7fmejn

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enabling or disabling annotation tools for meetings
Sign in to the Zoom web portal · In the navigation panel, click Account Management then Account Settings. · Click the Meeting tab....
Read more >
Annotation not working consistently after I did the recent update
Hello,. I did the update recommended last evening and when I was in a Zoom Meeting tutoring a student, my writing tool would...
Read more >
Zoom Screen Sharing and Annotation - CTE Resources
This allows you to look at a program or document together, and to share PowerPoint slides with your class as you lecture via...
Read more >
Guide to Zoom: Annotation Tools
Mouse: Deactivate annotation tools and switch to your mouse pointer. · Select (only available if you started the shared screen or whiteboard): Select,...
Read more >
Use annotation while sharing your screen in Teams
Annotation—powered by Microsoft Whiteboard—helps you collaborate on things like a design or presentation while sharing your screen in a Teams meeting.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found