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 we can use this with Nuxtjs #33

Open
umardraz opened this issue Aug 17, 2021 · 3 comments
Open

How we can use this with Nuxtjs #33

umardraz opened this issue Aug 17, 2021 · 3 comments

Comments

@umardraz
Copy link

Hi,

How we can use vue-plotly with NuxtJS, would you please help me

@umardraz umardraz changed the title How we can use this with NuxJS How we can use this with Nuxtjs Aug 17, 2021
@alee
Copy link

alee commented Nov 9, 2022

Late reply so you probably don't need this anymore but with Nuxt 2 you can do something like this:

... your template code ...
 <client-only placeholder="Loading...">
        <Plotly
          ref="plot"
          :data="timeSeriesData"
          :layout="layoutMetadata"
          :options="options"
          @click="updatePlotlyYear"
        />
</client-only>
...

import { Component, Prop, Watch } from "nuxt-property-decorator";

@Component({
  components: {
    // load time series plotly component lazily to avoid document is not defined errors
    // https://stackoverflow.com/a/50458090
    Plotly: () => import("vue-plotly").then((p) => p.Plotly),
  },
}

full source code file here:

https://github.com/openskope/skopeui/blob/5eb4b19568a5507c0f4e960ed1bd5a369be57b53/app/components/dataset/TimeSeriesPlot.vue

@andreemic
Copy link

nuxt-property-decorator

any idea for Nuxt 3?

@vicentecastroa
Copy link

@andreemic I Hope you have already solved it. I installed plotly.js-dist and put it all together (events, camelize function, methods, main component) in a new component under my components folder. Just copy and paste and it worked.

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