espaper-server-php icon indicating copy to clipboard operation
espaper-server-php copied to clipboard

Negative temperature issue

Open lorol opened this issue 8 years ago • 0 comments

Hi, the math needs to be corrected to get valid lines on negative temperatures:
Something like this:

`
function tempToPixel($height, $max, $min, $temp) { return ($temp - $min) * $height / ($max - $min); }

for ($i = 0; $i < min(32, sizeof($temps)); $i++) { $height = tempToPixel(39, $max_temp, $min_temp, $temps[$i]); $canvas->fillRect(200 + $i * 3, 116 - $height, 2, $height); } `

lorol avatar Nov 11 '17 06:11 lorol