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

Problem with threshold plugin #20

Closed
rayoplateado opened this issue Feb 12, 2017 · 5 comments
Closed

Problem with threshold plugin #20

rayoplateado opened this issue Feb 12, 2017 · 5 comments

Comments

@rayoplateado
Copy link

rayoplateado commented Feb 12, 2017

Hi!

I'm using chartist through vue-chartist. The point is that I want to use the threshold plugin, but if I install it and call into a chart, it said to me Chartist is not defined, which is correct, because chartist is in Vue.chartist

How can I set Chartist value called into the plugin to point to Vue-chartist without modify the threshold plugin?

@Yopadd
Copy link
Owner

Yopadd commented Feb 14, 2017

Hi,

It's complicated, it seems that react-chartist has the same problems.
I will think about it but without guarantee.

@Yopadd
Copy link
Owner

Yopadd commented Feb 17, 2017

I found a quick dirty tricks.

Vue.use(VueChartist)
Chartist = Vue.chartist
require('chartist-plugin-pointlabels')
Vue.chartist = Chartist

...

options: {
  plugins: [
    Vue.chartist.plugins.ctPointLabels({
      textAnchor: 'middle'
    })
  ]
},

I have managed to run chartist-plugin-pointlabels but not chartist-plugin-threshold 😕
Maybe I badly use chartist-plugin-threshold ...

@rayoplateado
Copy link
Author

I think I've tried this with no success. Let me test again and I'll let you know!

Thank you @Yopadd!

@fyyyyy
Copy link

fyyyyy commented Apr 18, 2017

Vue.chartist assignment isnt required imo. You just need to define Chartist on the window object before importing the plugin

You can do this in your main/index.js

import VueChartist from 'vue-chartist';

window.Chartist = Chartist;
require('chartist-plugin-pointlabels');

Vue.use(VueChartist)

If you want to use it in a subcomponent, you can import Chartist

<script>
import _ from 'lodash';
import Chartist from 'chartist';

export default {
  props: [
  ],
  data() {
    return {
      chartOptions: {
        plugins: [
          Chartist.plugins.legend({
            legendNames: [...,
          }),

@Mathieu-R
Copy link

It doesn't work for me with threshold plugin.

@Yopadd Yopadd closed this as completed Dec 8, 2021
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

4 participants