Skip to content

Usage of 0.7.7 in Nuxt.js #654

@DepkaCZ

Description

@DepkaCZ

Hi,

is there a way how to use this plugin in Nuxt.js ?

  1. If i import the plugin in the component, nuxt gives me 'window not defined' which i understand as it tries to import it on server side
  2. If i create a Nuxt.js plugin zoom.client.js like this :
import Vue from 'vue'
import * as Zoom from 'chartjs-plugin-zoom'

Vue.use(Zoom)

and then register it as a nuxt.js plugin i dont really know how to register that plugin in the component, like, how do i call something like Chart.register(Zoom) or something to make it work ?

  1. Lastly as the nuxt.js plugin way is a mystery to me, I've tried to include cdn links in head but that crashes on
Uncaught TypeError: Cannot read properties of undefined (reading 'helpers')
    at Object.2.chart.js (Chart.Zoom.min.js:10:3567)
    at o (Chart.Zoom.min.js:10:254)
    at t (Chart.Zoom.min.js:10:421)
    at Chart.Zoom.min.js:10:438

So is there a way how to make the zoom plugin work ? I've spent two nights trying to figure this out but without luck :/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions