Skip to content

Plotly with API #24

Description

@ddiegommachado

Hi everyone,

I need mount a graph with data of the a API. I'm using https://github.com/statnett/vue-plotly
My code is:

<vue-plotly :data="data" :layout="layout" :options="options" />
<script>
import axios from "axios";
import VuePlotly from "@statnett/vue-plotly";

export default {
  components: {
    VuePlotly
  },
  data() {
    return {
      fields: [],
      data: [{ x: [], y: [] }],
      layout: {},
      options: {},
      responsive: true
    };
  },
  mounted() {
    var url = "http://www.mocky.io/v2/5d77aa2f3200005b00923f71";

    axios.get(url).then(r => {
      this.fields = r.data.fields;
    });
  }
};
</script>

How make this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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