adding ScatterChart2CsvConverterTest

This commit is contained in:
frankknoll
2023-11-10 17:57:07 +01:00
parent ab16d68f0f
commit acfe871d1d
6 changed files with 59 additions and 5 deletions

View File

@@ -0,0 +1,18 @@
class ScatterChart2CsvConverter {
static convertScatterChart2Csv({ symptomX, symptomY, batches, data }) {
const header = `"Batch","PRR ratio of Batch for ${symptomX}","PRR ratio of Batch for ${symptomY}"`;
return `${header}\n${ScatterChart2CsvConverter.#asCsv(batches, data)}`;
}
static #asCsv(batches, data) {
return Utils
.zip([batches, data])
.map(([batch, { x, y }]) => `${ScatterChart2CsvConverter.#quote(batch)},${x},${y}`)
.join('\n');
}
static #quote(str) {
return '"' + str + '"';
}
}