Skip to content

Commit 6462f25

Browse files
committed
Fix #342 polyline disappear when yAxis inverted
1 parent 792eca4 commit 6462f25

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/graph-types/polyline.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ export default function polyline(chart: Chart) {
1818
const yRange = chart.meta.yScale.range()
1919
let yMax = yRange[0]
2020
let yMin = yRange[1]
21+
22+
// Fix #342
23+
// When yAxis is reversed, the yRange is inverted, i.e. yMin > yMax
24+
if (yMin > yMax) [yMin, yMax] = [yMax, yMin]
25+
2126
// workaround, clamp assuming that the bounds are finite but huge
2227
const diff = yMax - yMin
2328
yMax += diff * 1e6

0 commit comments

Comments
 (0)