2
2
<div >
3
3
<h1 >GitHub Copilot Business Metrics Viewer</h1 >
4
4
5
+ <h2 >Acceptance rate (%)</h2 >
6
+ <Bar :data =" acceptanceRateChartData" :options =" totalActiveUsersChartOptions" />
7
+
5
8
<h2 >Total Suggestions Count | Total Acceptances Count</h2 >
6
9
<Line :data =" totalSuggestionsAndAcceptanceChartData" :options =" chartOptions" />
7
10
@@ -54,6 +57,10 @@ export default defineComponent({
54
57
setup() {
55
58
const metrics = ref <Metrics []>([]);
56
59
60
+ // Acceptance Rate
61
+ const acceptanceRateChartData = ref <{ labels: string []; datasets: any [] }>({ labels: [], datasets: [] });
62
+
63
+
57
64
// Total Suggestions Count | Total Acceptance Counts
58
65
const totalSuggestionsAndAcceptanceChartData = ref <{ labels: string []; datasets: any [] }>({ labels: [], datasets: [] });
59
66
@@ -63,6 +70,7 @@ export default defineComponent({
63
70
// Total Active Users
64
71
const totalActiveUsersChartData = ref <{ labels: string []; datasets: any [] }>({ labels: [], datasets: [] });
65
72
73
+
66
74
67
75
const chartOptions = {
68
76
responsive: true ,
@@ -100,7 +108,8 @@ export default defineComponent({
100
108
data: data .map (m => m .total_acceptances_count ),
101
109
backgroundColor: ' rgba(153, 102, 255, 0.2)' ,
102
110
borderColor: ' rgba(153, 102, 255, 1)'
103
- }
111
+ },
112
+
104
113
]
105
114
};
106
115
@@ -123,6 +132,24 @@ export default defineComponent({
123
132
]
124
133
};
125
134
135
+ acceptanceRateChartData .value = {
136
+ labels: data
137
+ .map (m => m .day ),
138
+ datasets: [
139
+ {
140
+ type: ' line' , // This makes the dataset a line in the chart
141
+ label: ' Acceptance Rate' ,
142
+ data: data .map (m => m .total_lines_suggested !== 0 ? (m .total_lines_accepted / m .total_lines_suggested ) * 100 : 0 ),
143
+ backgroundColor: ' rgba(173, 216, 230, 0.2)' , // light blue
144
+ borderColor: ' rgba(173, 216, 230, 1)' , // darker blue
145
+ fill: false // This makes the area under the line not filled
146
+ }
147
+ ]
148
+ };
149
+
150
+ console .log (" AcceptanceRateChartData" );
151
+ console .log (acceptanceRateChartData );
152
+
126
153
totalActiveUsersChartData .value = {
127
154
labels: data .map (m => m .day ),
128
155
datasets: [
@@ -136,7 +163,7 @@ export default defineComponent({
136
163
};
137
164
});
138
165
139
- return { totalSuggestionsAndAcceptanceChartData , chartData , chartOptions , totalActiveUsersChartData , totalActiveUsersChartOptions };
166
+ return { totalSuggestionsAndAcceptanceChartData , chartData , chartOptions , totalActiveUsersChartData , totalActiveUsersChartOptions , acceptanceRateChartData };
140
167
}
141
168
});
142
169
</script >
0 commit comments