Skip to content

Commit ad7883d

Browse files
committed
rfac: Improve rules of .step so no lines with 0 or 1 points are asked to draw.
There is no change in the output. This change is the same as the one made in PR #64.
1 parent 2787d7c commit ad7883d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Sources/SwiftPlot/Histogram.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,12 @@ extension Histogram: HasGraphLayout {
340340
let c3 = backLeftBinHeight > frontRightBinHeight
341341
let c4 = backRightBinHeight > frontLeftBinHeight
342342

343-
if c1 || c3 && c4 { line.append(Point(x, backLeftBinHeight)) }
344-
if !c3 { endLine() }
345-
if c1 && !c4 { line.append(Point(x, frontLeftBinHeight)) }
346-
if !c4 { endLine() }
347-
if c2 && !c3 { line.append(Point(x, frontRightBinHeight)) }
348-
if c2 || c3 && c4 { line.append(Point(x, backRightBinHeight)) }
349-
if !c2 { endLine() }
343+
if c1 || c3 && c4 { line.append(Point(x, backLeftBinHeight)) }
344+
if c1 && !c4 { line.append(Point(x, frontLeftBinHeight)) }
345+
if c1 && (!c3 || !c4) { endLine() }
346+
if c2 && !c3 { line.append(Point(x, frontRightBinHeight)) }
347+
if c2 || c3 && c4 { line.append(Point(x, backRightBinHeight)) }
348+
if !c2 && c3 && c4 { endLine() }
350349

351350
backLeftBinHeight = backRightBinHeight
352351
frontLeftBinHeight = frontRightBinHeight

0 commit comments

Comments
 (0)