Skip to content

Commit 0ef6ac3

Browse files
committed
Add acceptance rate chart to MetricsViewer.vue
1 parent 8f87eb7 commit 0ef6ac3

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

src/components/MetricsViewer.vue

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<div>
33
<h1>GitHub Copilot Business Metrics Viewer</h1>
44

5+
<h2>Acceptance rate (%)</h2>
6+
<Bar :data="acceptanceRateChartData" :options="totalActiveUsersChartOptions" />
7+
58
<h2>Total Suggestions Count | Total Acceptances Count</h2>
69
<Line :data="totalSuggestionsAndAcceptanceChartData" :options="chartOptions" />
710

@@ -54,6 +57,10 @@ export default defineComponent({
5457
setup() {
5558
const metrics = ref<Metrics[]>([]);
5659
60+
//Acceptance Rate
61+
const acceptanceRateChartData = ref<{ labels: string[]; datasets: any[] }>({ labels: [], datasets: [] });
62+
63+
5764
//Total Suggestions Count | Total Acceptance Counts
5865
const totalSuggestionsAndAcceptanceChartData = ref<{ labels: string[]; datasets: any[] }>({ labels: [], datasets: [] });
5966
@@ -63,6 +70,7 @@ export default defineComponent({
6370
//Total Active Users
6471
const totalActiveUsersChartData = ref<{ labels: string[]; datasets: any[] }>({ labels: [], datasets: [] });
6572
73+
6674
6775
const chartOptions = {
6876
responsive: true,
@@ -100,7 +108,8 @@ export default defineComponent({
100108
data: data.map(m => m.total_acceptances_count),
101109
backgroundColor: 'rgba(153, 102, 255, 0.2)',
102110
borderColor: 'rgba(153, 102, 255, 1)'
103-
}
111+
},
112+
104113
]
105114
};
106115
@@ -123,6 +132,24 @@ export default defineComponent({
123132
]
124133
};
125134
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+
126153
totalActiveUsersChartData.value = {
127154
labels: data.map(m => m.day),
128155
datasets: [
@@ -136,7 +163,7 @@ export default defineComponent({
136163
};
137164
});
138165
139-
return { totalSuggestionsAndAcceptanceChartData, chartData, chartOptions, totalActiveUsersChartData, totalActiveUsersChartOptions };
166+
return { totalSuggestionsAndAcceptanceChartData, chartData, chartOptions, totalActiveUsersChartData, totalActiveUsersChartOptions, acceptanceRateChartData };
140167
}
141168
});
142169
</script>

0 commit comments

Comments
 (0)