this is how my tsv looks like, but with a lot more of rows and the values varies more often (.tsv size is about 10MB)
cdate ctime Saarland Mecklenburg-Vorpommern Thueringen Magdeburg Dessau Halle Leipzig Dresden Chemnitz Karlsruhe Stuttgart Tuebingen Freiburg Berlin Brandenburg Schleswig-Holstein Hamburg Bremen Trier Koblenz Rheinhessen-Pfalz Unterfranken Oberfranken Mittelfranken Oberpfalz Niederbayern Oberbayern Schwaben Kassel Giessen Darmstadt Munster Detmold Arnsberg Duesseldorf Koeln Luneburg Weser-Ems Hannover Braunschweig
01.01.2011 00:00 1526.66 0.00 497.24 0.00 0.00 0.00 0.00 0.00 0.00 25484.15 319.77 5992.47 92729.72 0.00 0.00 0.00 0.00 551.05 15948.44 9511.05 0.00 12506.98 0.00 11792.09 2354.59 34020.30 40880.95 6813.97 81734.04 0.00 981.48 0.00 0.00 44933.62 1122.27 3760.11 0.00 0.00 27893.19 714.28
01.01.2011 00:15 1526.66 0.00 497.24 0.00 0.00 0.00 0.00 0.00 0.00 25484.15 319.77 5992.47 92729.72 0.00 0.00 0.00 0.00 551.05 15948.44 9511.05 0.00 12506.98 0.00 11792.09 2354.59 34020.30 40880.95 6813.97 81734.04 0.00 981.48 0.00 0.00 44933.62 1122.27 3760.11 0.00 0.00 27893.19 714.28
How can I read out the Maximum Value out of this tsv?
This is the d3.tsv call
d3.tsv("WasserNeu.tsv", importTSV);
var importedData = []; //[date][time].city
function importTSV(error, data) {
for (var row in data) {
var dataRow = data[row]; //row is just the number of the current object, data[row] represents its contents
if (importedData[dataRow.cdate] === undefined) {
importedData[dataRow.cdate] = [];
}
if (importedData[dataRow.cdate][dataRow.ctime] === undefined) {
importedData[dataRow.cdate][dataRow.ctime] = [];
}
for (var oneCity in dataRow) {
if (oneCity != "cdate" && oneCity != "ctime") {
if (importedData[dataRow.cdate][dataRow.ctime][oneCity] === undefined) {
importedData[dataRow.cdate][dataRow.ctime][oneCity] = [];
}
importedData[dataRow.cdate][dataRow.ctime][oneCity] = dataRow[oneCity];
//console.log("dataPoint ("+oneCity+"): "+dataRow[oneCity]);
}
}
//Edit
Now I've added just + before return +d3.max
var maxValue = d3.max(d3.values(importedData), function(times){
return +d3.max(d3.values(times), function(cities){
return d3.max(d3.values(cities));
});
});
Now I get 9672.44 as maximum, still this isn't my maximum..