plotly.vue 794 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <div></div>
  3. </template>
  4. <script>
  5. export default {
  6. async mounted() {
  7. await this.$nextTick()
  8. Plotly.newPlot(this.$el.id, this.options.data, this.options.layout, this.options.config);
  9. },
  10. methods: {
  11. update(options) {
  12. Plotly.newPlot(this.$el.id, options.data, options.layout, options.config);
  13. },
  14. },
  15. props: {
  16. options: Object,
  17. },
  18. };
  19. </script>
  20. <style>
  21. /*
  22. fix styles to correctly render modebar, otherwise large
  23. buttons with unwanted line breaks are shown, possibly
  24. due to other CSS libraries overriding default styles
  25. affecting plotly styling.
  26. */
  27. .js-plotly-plot .plotly .modebar-group {
  28. display: flex;
  29. }
  30. .js-plotly-plot .plotly .modebar-btn {
  31. display: flex;
  32. }
  33. .js-plotly-plot .plotly .modebar-btn svg {
  34. position: static;
  35. }
  36. </style>