File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 },
1010 "dependencies" : {
1111 "core-js" : " ^3.8.3" ,
12- "vue" : " ^3.2.13"
12+ "plotly.js" : " ^1.44.4" ,
13+ "vue" : " ^3.2.13" ,
14+ "vuetify" : " ^3.4.8"
1315 },
1416 "devDependencies" : {
1517 "@babel/core" : " ^7.12.16" ,
Original file line number Diff line number Diff line change 11<template >
2- <HelloWorld />
2+ <div id =" app" >
3+ <v-container >
4+ <v-row no-gutters alignContent =" center" justify =" space-between" >
5+ <v-col md =" 4" >
6+ <PlotlyChart :propData =" plotInfo " divId="plot1" />
7+ </v-col >
8+ <v-col md =" 4" >
9+ <PlotlyChart :propData =" plotInfo " divId="plot2" />
10+ </v-col >
11+ <v-col md =" 4" >
12+ <PlotlyChart :propData =" plotInfo " divId="plot3" />
13+ </v-col >
14+ </v-row >
15+ </v-container >
16+ </div >
317</template >
4-
518<script >
6- import HelloWorld from " ./components/HelloWorld .vue" ;
19+ import PlotlyChart from " ./components/PlotlyChart .vue" ;
720
821export default {
9- name: " App " ,
22+ name: " app " ,
1023 components: {
11- HelloWorld,
24+ PlotlyChart,
25+ },
26+ data : function () {
27+ return {
28+ plotInfo: {
29+ data: null ,
30+ },
31+ loadingData: true ,
32+ };
33+ },
34+ mounted () {
35+ this .fetchData ();
36+ },
37+ methods: {
38+ async fetchData () {
39+ try {
40+ this .loadingData = true ;
41+ const response = await fetch (
42+ process .env .VUE_APP_BACKEND_ROOT_ENDPOINT + " ArielMAJ/repos"
43+ );
44+ const data = await response .json ();
45+ this .plotInfo .data = data .forks ;
46+ console .log (this .plotInfo .data );
47+ this .loadingData = false ;
48+ } catch (error) {
49+ console .error (" Error fetching data:" , error);
50+ }
51+ },
1252 },
1353};
1454 </script >
@@ -20,10 +60,23 @@ export default {
2060}
2161
2262#app {
23- font-family : Avenir, Helvetica , Arial , sans-serif ;
63+ font-family : " Avenir" , Helvetica , Arial , sans-serif ;
2464 -webkit-font-smoothing : antialiased ;
2565 -moz-osx-font-smoothing : grayscale ;
2666 text-align : center ;
2767 color : #2c3e50 ;
68+ background-color : bisque ;
69+ min-height : 100vh ;
70+ min-width : 100vw ;
71+ max-width : 100vw ;
72+ position : absolute ;
73+ }
74+
75+ body {
76+ scroll-behavior : smooth ;
77+ overflow-y : hidden ;
78+ overflow-x : hidden ;
79+ min-width : 100vw ;
80+ max-width : 100vw ;
2881}
2982 </style >
Load diff This file was deleted.
Original file line number Diff line number Diff line change 1+ <template >
2+ <div
3+ class =" plotly-chart"
4+ ref =" container"
5+ :id =" divId"
6+ :style =" {
7+ height: height,
8+ width: width,
9+ }"
10+ ></div >
11+ </template >
12+
13+ <script >
14+ import Plotly from " plotly.js/dist/plotly" ;
15+
16+ export default {
17+ name: " Plotly-Chart" ,
18+ props: {
19+ propData: {
20+ type: Object ,
21+ required: true ,
22+ },
23+ divId: {
24+ type: String ,
25+ required: true ,
26+ },
27+ height: {
28+ type: String ,
29+ default: " 350px" ,
30+ },
31+ width: {
32+ type: String ,
33+ default: " 100%" ,
34+ },
35+ },
36+ data : function () {
37+ return {};
38+ },
39+ mounted () {
40+ this .newPlot ();
41+ this .bindEvents ();
42+ },
43+ created () {
44+ this .$watch (" propData" , this .update , { deep: true });
45+ },
46+ beforeUnmount () {
47+ this .unbindEvents ();
48+ },
49+ computed: {
50+ plotDiv () {
51+ return this .$refs .container ;
52+ },
53+ },
54+ methods: {
55+ bindEvents () {
56+ this .plotDiv .on (" plotly_redraw" , this .redraw );
57+ },
58+ unbindEvents () {
59+ if (! this .plotDiv [" off" ]) return ;
60+ this .plotDiv .off (" plotly_redraw" , this .redraw );
61+ },
62+
63+ // Redraw in plotly is a plot level event,
64+ // so all that's published out is the plot's divId
65+ redraw () {
66+ this .$emit (" redraw" , this .divId );
67+ },
68+
69+ newPlot () {
70+ Plotly .newPlot (this .divId , this .propData .data , {
71+ paper_bgcolor: " transparent" ,
72+ });
73+ },
74+ update () {
75+ Plotly .react (this .divId , this .propData .data , {
76+ paper_bgcolor: " transparent" ,
77+ });
78+ },
79+ },
80+ };
81+ </script >
82+
83+ <style scoped>
84+ .plotly-chart {
85+ /* margin: 20px auto; */
86+ border : 1px solid #ccc ;
87+ border-radius : 50px ;
88+ background-color : transparent ;
89+ }
90+ </style >
Original file line number Diff line number Diff line change 11import { createApp } from "vue" ;
22import App from "./App.vue" ;
3+ import { createVuetify } from "vuetify" ;
4+ import * as components from "vuetify/components" ;
5+ import * as directives from "vuetify/directives" ;
36
4- createApp ( App ) . mount ( "#app" ) ;
7+ const vuetify = createVuetify ( {
8+ components,
9+ directives,
10+ } ) ;
11+
12+ createApp ( App ) . use ( vuetify ) . mount ( "#app" ) ;
You can’t perform that action at this time.
0 commit comments