Fix 0 price visualization (#8099)

This commit is contained in:
Michael Geers 2023-05-20 16:06:50 +02:00 • committed by GitHub
parent 6c4d9d6fed
commit ec81ad4d12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -25,9 +25,9 @@ function createRate(price, hoursFromNow, durationHours = 1) {
const co2 = {
rates: [
545, 518, 545, 518, 213, 545, 527, 527, 536, 518, 400, 336, 336, 339, 344, 336, 336, 336,
372, 400, 555, 555, 545, 555, 564, 545, 555, 545, 536, 545, 527, 536, 518, 545, 509, 336,
336, 336,
545, 518, 545, 518, 0, 545, 527, 527, 536, 518, 400, 336, 336, 339, 344, 336, 336, 336, 372,
400, 555, 555, 545, 555, 564, 545, 555, 545, 536, 545, 527, 536, 518, 545, 509, 336, 336,
336,
].map((price, i) => createRate(price, i)),
duration: 8695,
plan: [createRate(213, 4), createRate(336, 11), createRate(336, 12)],

View file

@ -89,7 +89,7 @@ export default {
},
priceStyle(price) {
const value = price === undefined ? this.avgPrice : price;
const height = value ? `${(100 / this.maxPrice) * value}%` : "100%";
const height = value !== undefined ? `${5 + (95 / this.maxPrice) * value}%` : "100%";
return { height };
},
},