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

How to access Chart.defaults.global #234

Closed
egorzekov opened this issue Oct 25, 2017 · 4 comments
Closed

How to access Chart.defaults.global #234

egorzekov opened this issue Oct 25, 2017 · 4 comments

Comments

@egorzekov
Copy link

Hello Jakub.

First of all, thanks a lot for such handy package. I appreciate your work a lot!

I easily integrated it to my project, but unfortunately faced one problem (didn't find an answer in docs/created issues).

I want to set up global settings that can change all of the fonts on the chart (http://www.chartjs.org/docs/latest/general/fonts.html).

I tried to do it with Chart.js object (http://vue-chartjs.org/#/home?id=chart-js-object), but didn't success.

Could you please clarify if it's possible to do using your package?

Many thanks in advance.

@apertureless
Copy link
Owner

apertureless commented Oct 28, 2017

@egorzekov

The this.$data._chart is the current chart instance. Which is created on the first renderChart call. docs

If you want to overwrite the global settings, just import Chartjs before.

import Chart from 'chart.js'

Chart.defaults.global.defaultFontColor = 'red';

@urvi2429
Copy link

So this.$chart._chart is instance of vue chart.js ?

@apertureless
Copy link
Owner

@urvi2429 No. Like I said and mentioned in the docs http://vue-chartjs.org/#/home?id=chart-js-object

You can access the chart instance over this.$data._chart.

@CamilaNiebles
Copy link

@apertureless Hi! I'm trying something and I want to know if it is possible. I want to change my doughnut chart when the user make a click over it i.e, I want to show the detail about some region, is it possible?
Congratulations for your work! (:

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

4 participants