Comments (18)
Mouse wheel events have a deltaX
, deltaY
, and deltaZ
property. I think the code you are looking for is
window.addEventListener("wheel", event => console.log(event.deltaY > 0 ? "scroll-up (zoom-in)" : "scroll-down (zoom-out)"));
from victory.
The zoom is relative to your cursor position, try zooming out / in with your cursor centered in the graph
from victory.
@carbonrobot first of all, why can I zoom off the chart?
second, it's not about that, watch the screencast more carefully, when I am off the chart, I ONLY zoom out, but the chart is in a loop of zoom-in/out!
from victory.
Your cursor appears to be still over the chart. Remember, the chart has padding all the way around and fills the entire column.
watch the screencast more carefully
Obviously, it is unclear what your mouse is doing, because we can't see what buttons are being pressed via the video.
I am unable to replicate that behaviour using Edge/Chrome/Firefox/Safari.
from victory.
Sure you cannot see what I do with my mouse buttons :D But I'm telling you what I'm doing.
Steps to reproduce:
- Go inside and zoom in
- Go in the white part, out of the chart and zoom out a lot
from victory.
Everything appears to be working as intended. The zoom is correct relative to the mouse position in the data points.
Could you describe the behavior you are expecting?
from victory.
what you have done is correct, but zoom out more than that, don't stop zooming out.
to face the issue earlier, you don't need to zoom in a lot, one step is enough.
from victory.
I'm still unclear what you are asking. Are you talking about the numbers repeating due to the datum using Math.Pi
and Sin
?
from victory.
It's generally about both axises, but in the video you can see x-axis.
In the video below, I ONLY ONCE, scroll up (zoom-in) and after that JUST scroll down (zoom-out).
The scroll down is happening FIRST out of the chart THEN inside and outside of the chart.
Peek.2024-01-31.14-03.mp4
from victory.
The video looks normal to me, I'm still unclear on the question.
Here is the charts bounding box (it receives mouse events inside this red border)
Could you describe the problem with the following format?
- Test steps
- Expected result
- Actual result
from victory.
I used this script to show my mouse events :D
window.addEventListener("wheel", event => console.log(event.wheelDelta > 0 ? "scroll-up (zoom-in)" : "scroll-down (zoom-out)"));
Steps:
- ONE zoom in, inside the chart
- MANY zoom outs in the white area (actually zoom out kinda zoom in)
In the video below, there is ONLY ONE zoom in, and after that, all others are zoom out!
Peek.2024-01-31.16-19.mp4
from victory.
Don't debug my code snippet, debug the library :D
In both cases, the bug is there and is the same.
from victory.
Do you see the problem in this screen cap? I'm not seeing anything incorrect, but maybe we are talking about different things.
from victory.
yes, I see that :)
when you did 26 scroll-ups, it means ZOOM OUT... but actually the chart zooming in.
To see the bug better, never do scroll-down after the first one. do scroll-down JUST ONCE
from victory.
I'm not seeing a bug, I'm just seeing the designed behavior. Can you describe the actual VS expected behavior?
from victory.
Perhaps there is some confusion in this example because it uses an initial zoom domain (in other words, the charts starts pre-zoomed-in).
You can paste the following code into the "Editable Source" box to see if that changes anything for you.
class App extends React.Component {
constructor(props) {
super(props);
}
state = {
data: this.getScatterData()
}
getScatterData() {
return range(50).map((index) => {
return {
x: random(1, 50),
y: random(10, 90),
size: random(8) + 3
};
});
}
render() {
return (
<VictoryChart
containerComponent={<VictoryZoomContainer/>}
>
<VictoryScatter
data={this.state.data}
style={{
data: {
opacity: ({ datum }) => datum.y % 5 === 0 ? 1 : 0.7,
fill: ({ datum }) => datum.y % 5 === 0 ? "tomato" : "black"
}
}}
/>
</VictoryChart>
);
}
}
ReactDOM.render(<App/>, mountNode)
I think we are more than happy to change something, we just need to know what you would like changed.
from victory.
same :/
Peek.2024-01-31.18-16.mp4
from victory.
@carbonrobot can we meet somewhere? google meet or discord or wherever you can?
from victory.
Related Issues (20)
- Type Error in Victory Container 36.9.1 HOT 3
- Axis and bars overlap HOT 1
- Upgrade Babel and Targeted Browsers to Modern
- Polyline Label Indicators on Pie Chart
- When using VictoryLine with animation enabled, it experiences lag when attempting to render a large amount of data. HOT 2
- LineSegment y2 prop ignored for cursorComponent HOT 4
- How to disable one behavior when using createContainer() HOT 4
- Safari Tooltip Incorrect Size Scaling in VictoryBar with VictoryTooltip HOT 4
- Chart order affects axis HOT 1
- How to chart date ranges with bars HOT 6
- Version 37 SyntaxError Unexpected number when importing HOT 3
- Combining VictoryZoomContainer with VictoryVoroniContainer HOT 1
- Is RTL layout supported for Victory charts? HOT 4
- Unable to use all null data in timeseries with VictoryStack
- Histogram bins overflowing start of axis
- Getting Started not showing anything just blank HOT 2
- VictoryVoronoiContainer with VictoryBar inside VictoryGroup gives inconsistent grouping in tooltip depending on bar values HOT 6
- Undefined containerComponent results in TypeError HOT 2
- Applying transform in style doesn't work on VictoryLabel or Point HOT 1
- The Tooltip component is being cutting at the border HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from victory.