Skip to content

Commit f309cf4

Browse files
odmirKarthikRIyer
authored andcommitted
rfac: Make suggested improvements from PR #52 to drawPlotLines() (#56)
* Make suggested improvements from PR #52 to `drawPlotLines()` * Add explicit `self.`
1 parent d34b616 commit f309cf4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/SVGRenderer/SVGRenderer.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,14 @@ public class SVGRenderer: Renderer{
191191
isDashed: Bool) {
192192
guard p.count > 1 else { return }
193193

194-
let pointsString = p.map { point in
195-
let convertedPoint = convertToSVGCoordinates(point)
194+
let pointsString = p.lazy.map { point in
195+
let convertedPoint = self.convertToSVGCoordinates(point)
196196
return "\(convertedPoint.x),\(convertedPoint.y)"
197197
}.joined(separator: " ")
198198

199-
let dashedString = isDashed ? ";stroke-dasharray:4 1" : ""
199+
let dashedString = isDashed ? "stroke-dasharray:4 1;" : ""
200200

201-
lines.append(#"<polyline points="\#(pointsString)" style="stroke:\#(strokeColor.svgColorString);stroke-width:\#(thickness);opacity:\#(strokeColor.a);stroke-linecap:butt;fill:none\#(dashedString)" />"#)
201+
lines.append(#"<polyline points="\#(pointsString)" style="stroke:\#(strokeColor.svgColorString);stroke-width:\#(thickness);opacity:\#(strokeColor.a);stroke-linecap:butt;fill:none;\#(dashedString)" />"#)
202202
}
203203

204204
public func drawText(text s: String,

0 commit comments

Comments
 (0)