Skip to content

Commit 3de69c7

Browse files
committed
Add total suggestions and acceptance count chart
1 parent 692e805 commit 3de69c7

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/components/MetricsViewer.vue

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
<template>
22
<div>
33
<h1>GitHub Copilot Business Metrics Viewer</h1>
4+
<h2>Total Suggestions Count | Total Acceptances Count</h2>
5+
<Line :data="totalSuggestionsAndAcceptanceChartData" :options="chartOptions" />
6+
47
<h2>Total Lines Suggested | Total Lines Accepted</h2>
58
<Line :data="chartData" :options="chartOptions" />
69

710
<h2>Total Active Users</h2>
811
<Bar :data="totalActiveUsersChartData" :options="totalActiveUsersChartOptions" />
912

13+
1014
</div>
1115
</template>
1216

@@ -49,11 +53,17 @@ export default defineComponent({
4953
setup() {
5054
console.log('MetricsViewer setup');
5155
const metrics = ref<Metrics[]>([]);
56+
57+
//Total Suggestions Count | Total Acceptance Counts
58+
const totalSuggestionsAndAcceptanceChartData = ref<{ labels: string[]; datasets: any[] }>({ labels: [], datasets: [] });
59+
5260
//Total Lines Suggested | Total Lines Accepted
5361
const chartData = ref<{ labels: string[]; datasets: any[] }>({ labels: [], datasets: [] });
62+
5463
//Total Active Users
5564
const totalActiveUsersChartData = ref<{ labels: string[]; datasets: any[] }>({ labels: [], datasets: [] });
5665
66+
5767
const chartOptions = {
5868
responsive: true,
5969
maintainAspectRatio: true
@@ -74,6 +84,26 @@ export default defineComponent({
7484
7585
getGitHubCopilotMetricsApi().then(data => {
7686
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+
77107
chartData.value = {
78108
labels: data.map(m => m.day),
79109
datasets: [
@@ -106,7 +136,7 @@ export default defineComponent({
106136
};
107137
});
108138
109-
return { chartData, chartOptions, totalActiveUsersChartData, totalActiveUsersChartOptions };
139+
return { totalSuggestionsAndAcceptanceChartData, chartData, chartOptions, totalActiveUsersChartData, totalActiveUsersChartOptions };
110140
}
111141
});
112142
</script>

0 commit comments

Comments
 (0)