Mercurial > gemma
comparison client/src/store/fairwayavailability.js @ 4437:a075da82e875
client:FWD: change unit to meter for the generated csv file
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Thu, 19 Sep 2019 15:33:22 +0200 |
parents | 47aa3be2a7de |
children | 130e929bab8f |
comparison
equal
deleted
inserted
replaced
4436:a66275cf4490 | 4437:a075da82e875 |
---|---|
190 state.headerLNWL = headerLNWL; | 190 state.headerLNWL = headerLNWL; |
191 }, | 191 }, |
192 // See docs/developers.md for an example how to directly | 192 // See docs/developers.md for an example how to directly |
193 // call this method for testing. | 193 // call this method for testing. |
194 setAvailableFairwayDepthData: (state, data) => { | 194 setAvailableFairwayDepthData: (state, data) => { |
195 state.csv = data; | 195 const lines = data.split("\n"); |
196 const csv = data.split("\n").filter(x => x !== ""); //omit empty lines | 196 let [header, rest] = [lines.shift(), lines]; |
197 // convert values to meter in the csv header | |
198 state.csv = [ | |
199 header.replace(/\d+\.?\d*/g, x => `${x / 100}m`), | |
200 ...rest | |
201 ].join("\n"); | |
202 const csv = [header, ...rest].filter(x => x !== ""); //omit empty lines | |
197 | 203 |
198 // setLegend | 204 // setLegend |
199 const headerEntries = csv.shift().split(","); | 205 const headerEntries = csv.shift().split(","); |
200 headerEntries.shift(); | 206 headerEntries.shift(); |
201 headerEntries.shift(); | 207 headerEntries.shift(); |