Skip to content
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

Transition when windowing data #319

Open
sampaioletti opened this issue Sep 16, 2024 · 0 comments
Open

Transition when windowing data #319

sampaioletti opened this issue Sep 16, 2024 · 0 comments

Comments

@sampaioletti
Copy link

Title is probably wrong (: but couldn't think of a better one.

Trying to get a 'windowing' like scroll from a LineMark by removing the first data element when adding a new value to the end of data.

The resulting graph is correct, but the transition is awkward as seen in the below video. It starts out looking good, when just adding points, but not as expected when you start shifting values.

If you add points to the end of data it correctly transitions right to left, but once the length of data doesn't change (same points but shifted right to left) it doesn't recognize the right to left movement and assumes they are just changing values and transitions vertically.

Not sure if there is another way to achieve this or a limitation for the current transition implementation.

stream?.listen((newData) {
  if (limit != null && data.length > limit) {
    data.removeAt(0); //remove first element and shift
  }
  data.add(newData.value!); // add element to end
  changeDataStream?.sink.add(ChangeDataEvent(data));
});
//[...]
//LineMark Definition inside Chart
LineMark(
  transition: Transition(
    duration: const Duration(
      seconds: 1,
    ),
  ),
)

chart transition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant