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

Changes to yAxisID property does not re-render chart #177

Closed
hunterwebsiteservices opened this issue Aug 23, 2017 · 5 comments
Closed

Changes to yAxisID property does not re-render chart #177

hunterwebsiteservices opened this issue Aug 23, 2017 · 5 comments

Comments

@hunterwebsiteservices
Copy link

Expected Behavior

Would like the chart to re-render after a change to the yAxisID property within the dataset. Using the reactiveProp mixin other changes are reflected as expected. This includes new or removed datasets as well as changes to backgroundColor property. For some reason yAxisID does not work in the same way.

I presume this is because chart.update(); works for backgroundColor and not for yAxisID. Quickly hacking the source has allowed me to force re-render on each change which is acceptable for my app, but is not a proper fix. See: hunterwebsiteservices@0847898#diff-24b15a098615f4b31bc5662babd25b49

Same applies for both reactiveProp and reactiveData mixins.

Actual Behavior

Changes to the yAxisID property within the dataset should cause a re-render of the chart, and not an update.

Environment

  • vue.js version: 2.4.2
  • vue-chart.js version: 2.8.2
  • npm version: not used
@apertureless
Copy link
Owner

Hey @feltoar,

thanks for the issue. I will have a look into this. However it seems this is an edge case, because chart.update() does not update the yAxisID.

Quick Fix for you would be to make your own mixins or add a watcher to the yAxisID and then force a re-render by yourself.

I am not sure if this can be implemented in a clean way in the mixins 🤔 But I will have a look.

@hunterwebsiteservices
Copy link
Author

Thank you. I have a quick work around already so I am sorted. Thought I would raise the issue anyway just so you were aware. Thank you for bringing ChartJs to Vue!

@apertureless
Copy link
Owner

Hey @feltoar

can you give me some sample data or a jsfiddle/webpackbin/codepen for reproduction?

@apertureless
Copy link
Owner

closed due to inactivity

@jcushman
Copy link

jcushman commented Jun 4, 2019

@apertureless, here's a jsfiddle reproducing this issue. Can this bug be re-opened?

https://jsfiddle.net/jcushman/xrtmz7ch/12/

The demo chart has a button that switches the two datasets to be displayed on the same scale or separate scales (which is the usecase that led me to this bug). The button only works if the chart is manually re-rendered on click, because dataset.yAxisID is not reactive.

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

No branches or pull requests

3 participants