Skip to content

Commit

Permalink
added shift tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasmllr committed Feb 15, 2024
1 parent 9c59e41 commit e61da52
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1037,21 +1037,30 @@

// find discharge from rating curve for this stage
let q_model = null
let h_model = null
let r_percent = null
for (var seg = 1; seg < residualData.length; seg++){
for (var j in residualData[seg].data){
if (residualData[seg].data[j][0] == fielddatacsv.stage[idx]){
console.log(residualData[seg])
console.log(rcParam)
q_model = residualData[seg].data[j][1]
h_model = Math.exp(1/rcParam[seg - 1].exp * Math.log(context.parsed.x / rcParam[seg - 1].const)) + rcParam[seg - 1].offset
console.log("q = " + context.parsed.x + " exp " + rcParam[seg - 1].exp)
console.log("h_model " + h_model)
r_percent = residualData[seg].data[j][2]
}
}
}
label.push(['H: ' + context.parsed.y.toFixed(2) + ' m']);
label.push(['Q: ' + context.parsed.x.toFixed(2) + ' m³/s']);
label.push(['date: ' + fielddatacsv.datetime[idx]]);
if (q_model !== null){
label.push(['Q model: ' + q_model.toFixed(2) + ' m³/s']);
if (h_model !== null) {
label.push(['H shift: ' + (context.parsed.y - h_model).toFixed(2) + ' m'])
}
//if (q_model !== null){
// label.push(['Q model: ' + q_model.toFixed(2) + ' m³/s']);
//}
if (r_percent !== null){
if (r_percent > 0){
// show + sign for positive values
Expand Down

0 comments on commit e61da52

Please sign in to comment.