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.

Dynamic data zoom

See original GitHub issue

Hi maintainers 🙂

Can I stop the zoom from happening and get the time axis for the dragged selection and do the zoom myself?

I saw that feature in other libraries and it’s really good since I can get the data from startTime to endTime with higher resolution as I need without just regular scaling.

Some libraries implemented this by returning false in the onZoom callback.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
prakiscommented, May 1, 2019

My requirement is similar when user tries to zoom an area, we want to call server to fetch new data in the zoomed rectangle area.

When user tries to zoom, the mouse down point is ActualStartPoint. User drag and leave (mouse up), this is ActualEndPoint. (Let me know if the variable names are misleading and you have better suggestion).

Using ActualStartPoint and ActualEndPoint I will match the corresponding datapoints(timestamp in your case). We can return the datapoints(timestamps) directly instead of drag x,y values but this fails in cases where we may not have datapoints(timestamp) at the exact zoom mouse points. In our case we need to calculated with special cases. Sending the datapoints(timestamps) will do too much abstraction, we need more control on how the x,y to actual datapoints are calculated.

ActualStartPoint and ActualEndPoint already subtract the margin offset(left for labels, legend). I am passing ‘margins’ parameter to onZoom() for any special cases where they need do some calculations.

Let me know if this helped you to understand.

1reaction
prakiscommented, Apr 30, 2019

I couldn’t find anyway to get the drag events so I forked and made those changes temporarily. It is not very well tested.

Until you find a official support for this you can use my fork, which does exactly that. https://github.com/prakis/chartjs-plugin-zoom

Please note In couple of days I will be making some minor modifications to support the direction properties. This is needed if you want to do custom Pan along with Zoom.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Displaying dynamic data on the video stream - Web
Hello everyone, I'm studying master deg in computer science and I want to create my final project using Zoom API.
Read more >
Dynamic data loading on zoom | JavaScript Chart Forums
I have a huge dataset to display in graphical form starting from the daily data for 30 days and then to each minute...
Read more >
Trying to change the data-zoom-image attribute of an ...
I am trying to change the data-zoom-image attribute of a dynamically created tag but its unsuccesful here is the code bellow: here is...
Read more >
Dynamic Planning How to Use Drag, Drop, Pivot, and ...
Dynamic Planning How to Use Drag, Drop, Pivot, and Zoom Actions to Analyze Data. 27 Jan 2022; 1 Minute to read.
Read more >
3 Simple Zoom Tips to Record Dynamic Content
Movement: One way to make a Zoom recording more dynamic is to bring more movement into your editing. For example, try panning through...
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