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

UMD build does not work #19

Open
simevo opened this issue Jun 26, 2020 · 1 comment
Open

UMD build does not work #19

simevo opened this issue Jun 26, 2020 · 1 comment

Comments

@simevo
Copy link

simevo commented Jun 26, 2020

I tried this:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Test vue-plotly</title>
    <script src="https://unpkg.com/vue@latest/dist/vue.min.js"></script>
  </head>
  <body>
    <div id="settings">
      <v-plotly :data="plots" :layout="layout" :display-mode-bar="false" :displaylogo="false" ></v-plotly>
    </div>
  </body>
  <script src="https://unpkg.com/vue-plotly@latest/dist/vue-plotly.umd.js"></script>
  <script>
    Vue.component('v-plotly', Plotly);
    var app = new Vue({
      el: '#settings',
      data: {
        parameters: [],
        sensors: {},
        plots: [
          {
            x: [1, 2, 3, 4],
            y: [10, 15, 13, 17],
            type: "scatter"
          }
        ],
        layout: {
          title: "My graph"
        }
      }
    });
  </script>
</html>

results:

index.html:14 Uncaught ReferenceError: Plotly is not defined
    at index.html:14
@simevo
Copy link
Author

simevo commented Jun 27, 2020

This works:

<vue-plotly :data="plots" :layout="layout" :display-mode-bar="false" :displaylogo="false" ></vue-plotly>

and:

Vue.component('vue-plotly', window['vue-plotly'].Plotly);

you may want to mention this in the docs / provide an example

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

1 participant