[O] Separate the generation of the gp dataset
This commit is contained in:
@@ -47,7 +47,7 @@ export default class GraphAverage extends Vue
|
|||||||
{
|
{
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barGap: '-100%',
|
barGap: '-100%',
|
||||||
data: this.courses.map(course => [course.name, GPAUtils.getGP(course, course.letterGrade)]),
|
data: this.generateGPData(),
|
||||||
|
|
||||||
label:
|
label:
|
||||||
{
|
{
|
||||||
@@ -69,4 +69,22 @@ export default class GraphAverage extends Vue
|
|||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate GP data for each course
|
||||||
|
*/
|
||||||
|
private generateGPData()
|
||||||
|
{
|
||||||
|
let data: any = [];
|
||||||
|
|
||||||
|
this.courses.forEach(course =>
|
||||||
|
{
|
||||||
|
data.push(
|
||||||
|
{
|
||||||
|
value: [course.name, GPAUtils.getGP(course, course.letterGrade)],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user