diff --git a/src/graph-types/polyline.ts b/src/graph-types/polyline.ts index 06d671b..45656b1 100644 --- a/src/graph-types/polyline.ts +++ b/src/graph-types/polyline.ts @@ -18,6 +18,11 @@ export default function polyline(chart: Chart) { const yRange = chart.meta.yScale.range() let yMax = yRange[0] let yMin = yRange[1] + + // Fix #342 + // When yAxis is reversed, the yRange is inverted, i.e. yMin > yMax + if (yMin > yMax) [yMin, yMax] = [yMax, yMin] + // workaround, clamp assuming that the bounds are finite but huge const diff = yMax - yMin yMax += diff * 1e6 diff --git a/test/e2e/graphs.test.ts b/test/e2e/graphs.test.ts index 29d20cc..b1b591d 100644 --- a/test/e2e/graphs.test.ts +++ b/test/e2e/graphs.test.ts @@ -45,7 +45,7 @@ describe('Function Plot', () => { // This adds an artificial spin only on functions that are labeled with [async] if (snippet.testName.indexOf('[async]') >= 0) { await new Promise((resolve) => { - setTimeout(resolve, 100) + setTimeout(resolve, 3000) }) }