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

Stale data and labels due to merging #1320

Closed
Ondrashx opened this issue Jun 11, 2021 · 5 comments
Closed

Stale data and labels due to merging #1320

Ondrashx opened this issue Jun 11, 2021 · 5 comments
Assignees
Milestone

Comments

@Ondrashx
Copy link

Reproduction of the problem
First of all thanks for making your work public.

There is one problem I run into
The merging of the config on ngChanges is not ok. New data and labels are merged. When input of baseChart directive of data and labels changes only those new data and labels should be used. Instead they are merged together. The merging happens here:

image

What I have done in my client code to overcome this issue, is that I clear the data and labels before assigning to inputs of baseChartDirective new data, but it is just hack.

image

I think the merging should not be employed at all, but maybe there is some reason I do not see.

Anyway, just wanted to let you know.

@santam85
Copy link
Contributor

@Ondrashx the reason it is done that way is to support Chart.js animations, which require the JS object ref to stay the same. The solution is definitely not perfect yet, I'll add some tests to check animations still work when not merging labels and datasets.

@Gimly
Copy link

Gimly commented Jun 23, 2021

@santam85 We're getting a very weird behavior where we have a time serie which data is bound to an Observable collection.

If we change the values of the the existing points everything seems to work correctly, but as soon as we reduce or add more points the graph behaves really weirdly, keeping the previous data points and messing up the time scale.

Is this related to this issue?

@Ondrashx
Copy link
Author

@Gimly Yep, that seems exactly like the issue caused by merging. The fix is simple though ... you can tap into the stream of data and reset the datasets and labels, like I did in the client code.

@santam85 santam85 added this to the 3.0 milestone Jun 25, 2021
@santam85
Copy link
Contributor

santam85 commented Jul 6, 2021

@Ondrashx could you try the latest RC? I believe I got this fixed...

@santam85 santam85 self-assigned this Jul 7, 2021
@Ondrashx
Copy link
Author

@santam85 Yep, it seems to work now. Sorry for late answer, not going here that much ... . Thanks.

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

3 participants