Vue-chartjs: How to access Chart.defaults.global

Created on 25 Oct 2017  ยท  4Comments  ยท  Source: apertureless/vue-chartjs

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.

โ“ question

Most helpful comment

@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';

All 4 comments

@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';

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

@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.

@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! (:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tirke picture Tirke  ยท  4Comments

sylvaincaillot picture sylvaincaillot  ยท  3Comments

m-jooibar picture m-jooibar  ยท  4Comments

jcalonso picture jcalonso  ยท  4Comments

sergeynilov picture sergeynilov  ยท  3Comments