Commit 58b529fc authored by Pithon Kabiro's avatar Pithon Kabiro
Browse files

Edit function: create y-axis title scatter plot

Move creation of the combined names + symbols array to the if/else
block
parent 0bc96c6a
...@@ -106,11 +106,6 @@ const createYAxisTitleTextScatterPlot = function ( ...@@ -106,11 +106,6 @@ const createYAxisTitleTextScatterPlot = function (
// y-axis phenomenon symbols start at array index 1 // y-axis phenomenon symbols start at array index 1
const unitOfMeasurementSymbolsYAxisArr = unitOfMeasurementSymbolsArr.slice(1); const unitOfMeasurementSymbolsYAxisArr = unitOfMeasurementSymbolsArr.slice(1);
const combinedNameSymbolArr = phenomenonNamesYAxisArr.map(
(phenomenonNameYAxis, i) =>
`${phenomenonNameYAxis} [${unitOfMeasurementSymbolsYAxisArr[i]}]`
);
// The phenomenon names and unit of measurement arrays should have equal lengths // The phenomenon names and unit of measurement arrays should have equal lengths
// Use one of the arrays for looping // Use one of the arrays for looping
if ( if (
...@@ -120,6 +115,11 @@ const createYAxisTitleTextScatterPlot = function ( ...@@ -120,6 +115,11 @@ const createYAxisTitleTextScatterPlot = function (
"The phenomenon names array and unit of measurement symbols array have different lengths" "The phenomenon names array and unit of measurement symbols array have different lengths"
); );
} else { } else {
const combinedNameSymbolArr = phenomenonNamesYAxisArr.map(
(phenomenonNameYAxis, i) =>
`${phenomenonNameYAxis} [${unitOfMeasurementSymbolsYAxisArr[i]}]`
);
return createCombinedTextDelimitedByComma(combinedNameSymbolArr); return createCombinedTextDelimitedByComma(combinedNameSymbolArr);
} }
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment