-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sticky Y axis when scrolling horizontally #271
Comments
Hey, sorry we haven't implemented panning/scrolling yet. |
+1 |
Hey @zibs Do you have any tips on go about creating a custom implementation for panning or if me or someone on my team can contribute to the process of implementing it (if this is on the eventual roadmap for xl)? |
@manyaagarwal Brush and Zoom containers are on the roadmap, but we do not have resources assigned to work on it currently. |
yeah, the chart on the mobile is really need this feature (cause the size of device is too small, user need to scroll), this is only reason right now stoping me from using Victory native chart. I hope this feature will be on in the nearest future. Thank for your great lib. @carbonrobot |
+1 |
This alone doesn't quite get the required functionality, but here's a pan/zoom PR I've been working on: #413 , I'll see if I can build upon this to implement the Brush Container from original Victory. |
Hi maciejbaczynski, How can you implement the horizontal scrolling like GIF above?. Because I stuck with the issue for weeks, I'm so glad if you share the idea about the horizontal scroll to me. Thank you so much in advance. |
The PR for panning/zoom was merged today. I think it can be extended to allow for the horizontal axis scrolling only relatively easily. |
|
Released in |
@alvintwking there currently isn't a configuration to limit the min/max scale values. I can look into added that if you want to create a new issue. In the meantime, you can reference some of the example app code that resets the zoom value automatically. You can modify it so that it will reset if the user goes outside your desired range: const { state } = useChartTransformState();
const k = useSharedValue(1);
const tx = useSharedValue(0);
const ty = useSharedValue(0);
useAnimatedReaction(
() => {
return state.panActive.value || state.zoomActive.value;
},
(cv, pv) => {
if (!cv && pv) {
const vals = getTransformComponents(state.matrix.value);
k.value = vals.scaleX;
tx.value = vals.translateX;
ty.value = vals.translateY;
k.value = withTiming(1);
tx.value = withTiming(0);
ty.value = withTiming(0);
}
},
);
useAnimatedReaction(
() => {
return { k: k.value, tx: tx.value, ty: ty.value };
},
({ k, tx, ty }) => {
const m = setTranslate(state.matrix.value, tx, ty);
state.matrix.value = setScale(m, k);
},
); Screen.Recording.2024-12-31.at.9.43.10.AM.mov |
@keithluchtel , thanks will try it out |
@keithluchtel happy new year, will you be able to share the complete code of the example. |
https://github.com/FormidableLabs/victory-native-xl/blob/main/example/app/pan-zoom.tsx |
Is there a way to achieve sticky Y axis when scrolling horizontally? Something like VictoryZoomContainer in old version. Right now Im using ScrollView outside CartesianChart but it would be great to use it inside, only over lines so Y axis legend is always visible.
scroll.webm
The text was updated successfully, but these errors were encountered: