Skip to content

Commit

Permalink
feat(Milestone Report Graph): Specify location for graph
Browse files Browse the repository at this point in the history
Milestone Report Graph displays data from all the locations in the Milestone. Each component is displayed as a separate data series.

Allow authors to specify one or more specific locations for each graph via a "locations" input parameter. If no locations are specified, show data series for all locations (like we currently do).

Closes #377.
  • Loading branch information
geoffreykwan authored Oct 21, 2021
1 parent 20dff86 commit feef875
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MilestoneReportGraphController {
const color = this.barColor ? this.barColor : this.defaultColor;
const step = 100 / this.data.length / 100;
let opacity = 0;
for (const componentData of this.data) {
for (const componentData of this.getDataToGraph(this.data, this.locations)) {
opacity += step;
const singleSeries = {
name: this.UtilService.trimToLength(componentData.stepTitle, 26),
Expand All @@ -95,6 +95,20 @@ class MilestoneReportGraphController {
this.series = series;
}

getDataToGraph(data, locations) {
if (locations == null) {
return data;
} else {
return this.getDataFromLocations(data, locations);
}
}

getDataFromLocations(data, locations) {
const dataFromLocations = [];
locations.forEach((location) => { dataFromLocations.push(data[location - 1]) });
return dataFromLocations;
}

getComponentSeriesData(componentData) {
const seriesData = [];
const scoreKeys = Object.keys(componentData.counts);
Expand All @@ -120,6 +134,7 @@ MilestoneReportGraphController.$inject = ['$filter', 'UtilService'];
const MilestoneReportGraph = {
bindings: {
id: '@',
locations: '<',
name: '@',
titleColor: '@',
barColor: '@',
Expand Down

0 comments on commit feef875

Please sign in to comment.