[O] Use afterconfig

This commit is contained in:
Hykilpikonna
2019-11-09 16:24:00 -05:00
parent 4a7ff0ea55
commit 9a279b3417
2 changed files with 13 additions and 8 deletions
+12 -7
View File
@@ -12,6 +12,17 @@ export default class OverallLine extends Vue
{
@Prop({required: true}) courses: Course[];
/**
* Override options
*
* @param options Original options (Unused)
*/
afterConfig(options: any)
{
console.log(options);
return this.settings;
}
private settings =
{
...GraphUtils.getBaseSettings('Average Grade', 'Average score trend for every course'),
@@ -44,16 +55,11 @@ export default class OverallLine extends Vue
}
};
chartCache: any;
/**
* Convert assignments list to a graph dataset.
*/
get convertChart()
{
// Caching
if (this.chartCache != undefined) return this.chartCache;
let courses = this.courses.filter(c => c.assignments.length > 0);
// Compute the column names
@@ -158,8 +164,7 @@ export default class OverallLine extends Vue
rows.push(row);
});
return this.chartCache =
{
return {
columns: columns,
rows: rows
}
@@ -1,6 +1,6 @@
<template>
<div id="overall-line">
<ve-line :data="convertChart" :extend="settings"></ve-line>
<ve-line :data="convertChart" :extend="{a: this.courses}" :after-config="afterConfig"></ve-line>
</div>
</template>