Skip to content

Commit 9c50c84

Browse files
committed
Fix issue with bar chart and dashboard data #196
* The data used for the bar chart and dashboard charts were not properly displaying for column values that returned an array. This change extracts the individual elements out of those arrays. Signed-off-by: Jillian Daguil <[email protected]>
1 parent dacac0c commit 9c50c84

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

assets/js/aboutCodeBarChart.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,16 @@ class AboutCodeBarChart {
6868

6969
for (let i = 0; i < values.length; i++) {
7070
attributeValue = values[i][attribute];
71-
validatedValues.push(
72-
AboutCodeBarChart.isValid(attributeValue) ?
73-
attributeValue : ["No Value Detected"]);
71+
72+
if (!Array.isArray(attributeValue) || attributeValue.length === 0){
73+
attributeValue = [attributeValue];
74+
}
75+
76+
for (let j = 0; j < attributeValue.length; j++) {
77+
validatedValues.push(
78+
AboutCodeBarChart.isValid(attributeValue[j]) ?
79+
attributeValue[j] : "No Value Detected");
80+
}
7481
}
7582
return validatedValues;
7683
}

assets/js/aboutCodeDashboard.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,16 @@ class AboutCodeDashboard {
215215

216216
for (let i = 0; i < values.length; i++) {
217217
attributeValue = values[i][attribute];
218-
validatedValues.push(
219-
AboutCodeBarChart.isValid(attributeValue) ?
220-
attributeValue : ["No Value Detected"]);
218+
219+
if (!Array.isArray(attributeValue) || attributeValue.length === 0){
220+
attributeValue = [attributeValue];
221+
}
222+
223+
for (let j = 0; j < attributeValue.length; j++) {
224+
validatedValues.push(
225+
AboutCodeDashboard.isValid(attributeValue[j]) ?
226+
attributeValue[j] : "No Value Detected");
227+
}
221228
}
222229
return validatedValues;
223230
}

0 commit comments

Comments
 (0)