1
0
forked from EHV/sejeteralo

amelioration courbe bleue prix

This commit is contained in:
nicoboy
2026-05-01 22:22:11 +02:00
parent b5d58911fb
commit db964d44b2
+5 -3
View File
@@ -1295,14 +1295,16 @@ const gridPrices2 = computed(() => {
return arr return arr
}) })
function toPolyline(vols: number[] | undefined, vals: number[] | undefined, cyFn: (v: number) => number): string { function toPolyline(vols: number[] | undefined, vals: number[] | undefined, cyFn: (v: number) => number, minVol = 15): string {
if (!vols?.length || !vals?.length) return '' if (!vols?.length || !vals?.length) return ''
const pts: string[] = [] const pts: string[] = []
for (let i = 0; i < vols.length; i += 4) { for (let i = 0; i < vols.length; i += 4) {
pts.push(`${cx2(vols[i]!)},${cyFn(vals[i]!)}`) const v = vols[i]!
if (v < minVol) continue
pts.push(`${cx2(v)},${cyFn(vals[i]!)}`)
} }
const last = vols.length - 1 const last = vols.length - 1
if (last % 4 !== 0) pts.push(`${cx2(vols[last]!)},${cyFn(vals[last]!)}`) if (last % 4 !== 0 && vols[last]! >= minVol) pts.push(`${cx2(vols[last]!)},${cyFn(vals[last]!)}`)
return pts.join(' ') return pts.join(' ')
} }