Coder Social home page Coder Social logo

Comments (11)

martynasma avatar martynasma commented on August 22, 2024

At this moment there's no way to do that, I'm afraid.

That said, I can see how it might be useful. We will consider it.

Leaving this open until we reach a decision. However, I can't provide an ETA for it. Sorry.

from amcharts5.

nizhnikovskiy avatar nizhnikovskiy commented on August 22, 2024

I managed to implement it as follows, but with bugs. You need to try to zoom the map using ctrl + wheel and hover at the yellow dots. Apparently at some point, the cursor is above the tooltip and browser zoom occurs

https://codepen.io/nizhnikovskiy/pen/eYEvaLW

from amcharts5.

samkristoff avatar samkristoff commented on August 22, 2024

I'd use this feature.

from amcharts5.

samkristoff avatar samkristoff commented on August 22, 2024

@nizhnikovskiy Thank you for posting that example. I was able to adapt it to work on my XY chart. I didn't notice any bugs related to scrolling while hovering over a tooltip on the XY chart.

In my case I'm using a 'busy' overlay div to gray out the chart (very similar to the no-scroll div in your example). When the user ctrl+scroll while the chart is busy (ie the busy div is visible) it zooms the browser. I tried to catch and prevent this but my first couple attempts didn't work so I just switched to shift+scroll to zoom the chart.

Thanks again for sharing your example.

from amcharts5.

martynasma avatar martynasma commented on August 22, 2024

You guys might find this useful:
https://www.amcharts.com/docs/v5/charts/xy-chart/zoom-and-pan/#Control_scroll
https://www.amcharts.com/docs/v5/charts/map-chart/map-pan-zoom/#Control_scroll

from amcharts5.

martynasma avatar martynasma commented on August 22, 2024

Hey guys, quick update. I updated the above sections to include option to show Google-like overlay with a message informing user they need to use CTRL to zoom:

image

Hope you find it useful.

from amcharts5.

nizhnikovskiy avatar nizhnikovskiy commented on August 22, 2024

In your example this works https://codepen.io/team/amcharts/pen/vYJPYbZ not quite right. It works by
tracking a Ctrl/Meta button, but this key can be pressed when the browser is out of focus, so JS won't catch this event. As an option, we can check if a Ctrl/Meta button is pressed in a wheel event, but then it's impossible to set a wheel property of the map correctly and enable/disable zoom of the map.

from amcharts5.

martynasma avatar martynasma commented on August 22, 2024

Yeah, agreed. It will not work reliably in iframe (unless you click on it), but should be good to go on regular pages.

We might consider adding a setting which would disable page scroll only if ctrl key is down, even if element is "wheelable".

from amcharts5.

nizhnikovskiy avatar nizhnikovskiy commented on August 22, 2024

Ok, thanks. As an option, you can allow/disallow wheel of map according to condition specified in a some callback. This will add more flexibility

from amcharts5.

martynasma avatar martynasma commented on August 22, 2024

That's actually a pretty good idea. We'll consider it. Thanks.

from amcharts5.

martynasma avatar martynasma commented on August 22, 2024

We've just released 5.0.13 which does not cancel wheel event, so we more options to set up our own wheel logic.

The following docs have been updated to reflect that:
https://www.amcharts.com/docs/v5/charts/xy-chart/zoom-and-pan/#Control_scroll
https://www.amcharts.com/docs/v5/charts/map-chart/map-pan-zoom/#Control_scroll

from amcharts5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.