1
1
<template >
2
2
<div >
3
3
<h1 >GitHub Copilot Business Metrics Viewer</h1 >
4
+ <h2 >Total Suggestions Count | Total Acceptances Count</h2 >
5
+ <Line :data =" totalSuggestionsAndAcceptanceChartData" :options =" chartOptions" />
6
+
4
7
<h2 >Total Lines Suggested | Total Lines Accepted</h2 >
5
8
<Line :data =" chartData" :options =" chartOptions" />
6
9
7
10
<h2 >Total Active Users</h2 >
8
11
<Bar :data =" totalActiveUsersChartData" :options =" totalActiveUsersChartOptions" />
9
12
13
+
10
14
</div >
11
15
</template >
12
16
@@ -49,11 +53,17 @@ export default defineComponent({
49
53
setup() {
50
54
console .log (' MetricsViewer setup' );
51
55
const metrics = ref <Metrics []>([]);
56
+
57
+ // Total Suggestions Count | Total Acceptance Counts
58
+ const totalSuggestionsAndAcceptanceChartData = ref <{ labels: string []; datasets: any [] }>({ labels: [], datasets: [] });
59
+
52
60
// Total Lines Suggested | Total Lines Accepted
53
61
const chartData = ref <{ labels: string []; datasets: any [] }>({ labels: [], datasets: [] });
62
+
54
63
// Total Active Users
55
64
const totalActiveUsersChartData = ref <{ labels: string []; datasets: any [] }>({ labels: [], datasets: [] });
56
65
66
+
57
67
const chartOptions = {
58
68
responsive: true ,
59
69
maintainAspectRatio: true
@@ -74,6 +84,26 @@ export default defineComponent({
74
84
75
85
getGitHubCopilotMetricsApi ().then (data => {
76
86
metrics .value = data ;
87
+
88
+ totalSuggestionsAndAcceptanceChartData .value = {
89
+ labels: data .map (m => m .day ),
90
+ datasets: [
91
+ {
92
+ label: ' Total Suggestions' ,
93
+ data: data .map (m => m .total_suggestions_count ),
94
+ backgroundColor: ' rgba(75, 192, 192, 0.2)' ,
95
+ borderColor: ' rgba(75, 192, 192, 1)'
96
+
97
+ },
98
+ {
99
+ label: ' Total Acceptance' ,
100
+ data: data .map (m => m .total_acceptances_count ),
101
+ backgroundColor: ' rgba(153, 102, 255, 0.2)' ,
102
+ borderColor: ' rgba(153, 102, 255, 1)'
103
+ }
104
+ ]
105
+ };
106
+
77
107
chartData .value = {
78
108
labels: data .map (m => m .day ),
79
109
datasets: [
@@ -106,7 +136,7 @@ export default defineComponent({
106
136
};
107
137
});
108
138
109
- return { chartData , chartOptions , totalActiveUsersChartData , totalActiveUsersChartOptions };
139
+ return { totalSuggestionsAndAcceptanceChartData , chartData , chartOptions , totalActiveUsersChartData , totalActiveUsersChartOptions };
110
140
}
111
141
});
112
142
</script >
0 commit comments