Compare commits

...

6 Commits

Author SHA1 Message Date
Hykilpikonna 1e28191e67 [U] Pre-Release v0.3.5.703 2019-10-20 20:27:46 -04:00
Hykilpikonna ef4d9d38e7 [O] Add '%' sign 2019-10-20 20:26:57 -04:00
Hykilpikonna 52626406bf [O] Use FormatUtils.limit 2019-10-20 20:26:18 -04:00
Hykilpikonna fec6c77dc2 [+] Create method to format string length 2019-10-20 20:23:47 -04:00
Hykilpikonna 4db8ee7837 [+] Add tooltip formatter 2019-10-20 20:20:58 -04:00
Hykilpikonna 9bfde0e39d [+] Add assignment description to the data 2019-10-20 20:20:45 -04:00
4 changed files with 23 additions and 4 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ export default class Constants
public static API_URL: string = 'https://va.hydev.org/api';
/** Current version */
public static VERSION: string = '0.3.5.697';
public static VERSION: string = '0.3.5.703';
/** Minimum version that still supports the same cookies */
public static MIN_SUPPORTED_VERSION: string = '0.3.4.561';
@@ -9,6 +9,8 @@ import moment from 'moment';
})
export default class CourseScatter extends Vue
{
private static DOT = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:{color}"></span>';
// @ts-ignore
@Prop({required: true}) course: Course;
@@ -30,6 +32,7 @@ export default class CourseScatter extends Vue
// Map assignments
let map = this.mapAssignments();
// Scatter data point style
let itemStyle =
{
normal:
@@ -94,9 +97,13 @@ export default class CourseScatter extends Vue
axisPointer:
{
type: 'cross'
}
},
formatter: (ps: any[]) => ps[0].data[0] + '<br>' + ps.map(p =>
`${CourseScatter.DOT.replace('{color}', p.color)}
${FormatUtils.limit(p.data[2], 22)}: ${p.data[1]}%<br>`).join('')
},
// Legend
legend:
{
bottom: 24,
@@ -152,6 +159,6 @@ export default class CourseScatter extends Vue
private static assignmentsData(assignments: Assignment[])
{
return assignments.filter(a => a.complete == 'Complete')
.map(a => [FormatUtils.toChartDate(a.date), (a.score / a.scoreMax * 100).toFixed(2)]);
.map(a => [FormatUtils.toChartDate(a.date), (a.score / a.scoreMax * 100).toFixed(2), a.description]);
}
}
+2 -1
View File
@@ -2,6 +2,7 @@ import {Component, Prop, Vue} from 'vue-property-decorator';
import {Course} from '@/components/app/app';
import {GPAUtils} from '@/utils/gpa-utils';
import Constants from '@/constants';
import {FormatUtils} from '@/utils/format-utils';
@Component({
})
@@ -40,7 +41,7 @@ export default class OverallBar extends Vue
rotate: 90,
// Truncate text length
formatter: (value: string) => value.length <= 16 ? value : value.substr(0, 14) + '...'
formatter: (value: string) => FormatUtils.limit(value, 16)
},
},
+11
View File
@@ -15,4 +15,15 @@ export class FormatUtils
// Convert to yyyy-mm-dd
return moment(date).format('YYYY-MM-DD');
}
/**
* Limit string length
*
* @param str String
* @param length Max length
*/
static limit(str: string, length: number): string
{
return str.length <= length ? str : str.substr(0, length - 2) + '...'
}
}