From 5550bf1f79bf8f8827f96b941194ccad2da7270a Mon Sep 17 00:00:00 2001
From: pryaniq <alexpryanichnikov@ya.ru>
Date: Thu, 12 Nov 2015 12:02:52 +0300
Subject: [PATCH 1/2] Displayed points for series in the graph.

How use:
yourSeriesName1.points = true
yourSeriesName1.points = false
chart.poinstWidth = 2.0
---
 Chart/Chart.swift       | 44 +++++++++++++++++++++++++++++++++++++++++
 Chart/ChartSeries.swift |  1 +
 2 files changed, 45 insertions(+)

diff --git a/Chart/Chart.swift b/Chart/Chart.swift
index d058376d5..36ed3aa37 100644
--- a/Chart/Chart.swift
+++ b/Chart/Chart.swift
@@ -124,6 +124,12 @@ class Chart: UIControl {
     @IBInspectable
     var lineWidth: CGFloat = 2
     
+    /**
+     Width of the chart's poinst.
+     */
+    @IBInspectable
+    var pointWidth: CGFloat = 2
+    
     /**
     Delegate for listening to Chart touch events.
     */
@@ -291,6 +297,12 @@ class Chart: UIControl {
                 
                 if series.line {
                     drawLine(xValues: scaledXValues, yValues: scaledYValues, seriesIndex: index)
+                    if series.points {
+                        for i in 1..<scaledXValues.count {
+                            drawPoints(xValues: scaledXValues, yValues: scaledYValues, seriesIndex: index, i: i)
+                        }
+                    }
+
                 }
                 if series.area {
                     drawArea(xValues: scaledXValues, yValues: scaledYValues, seriesIndex: index)
@@ -451,6 +463,38 @@ class Chart: UIControl {
         return lineLayer
     }
     
+    private func drawPoints(xValues xValues: Array<Float>, yValues: Array<Float>, seriesIndex: Int, i: Int) -> CAShapeLayer {
+        
+        let circleLayer = CAShapeLayer()
+        let circleRadius: CGFloat = 2.0
+        
+        func circleFrame(x: CGFloat, y: CGFloat) -> CGRect {
+            var circleFrame = CGRect(x: x, y: y, width: 2*circleRadius, height: 2*circleRadius)
+            circleFrame.origin.x = x - circleRadius
+            circleFrame.origin.y = y - circleRadius
+            return circleFrame
+        }
+        
+        func circlePath(i: Int) -> UIBezierPath {
+            let x = xValues[i]
+            let y = yValues[i]
+            return UIBezierPath(ovalInRect: circleFrame(CGFloat(x), y: CGFloat(y)))
+        }
+        
+        circleLayer.frame = self.bounds
+        circleLayer.path = circlePath(i).CGPath
+        
+        circleLayer.lineWidth = pointWidth
+        circleLayer.fillColor = series[seriesIndex].colors.above.CGColor
+        circleLayer.strokeColor = series[seriesIndex].colors.above.CGColor
+        
+        self.layer.addSublayer(circleLayer)
+        
+        layerStore.append(circleLayer)
+        
+        return circleLayer
+    }
+   
     private func drawArea(xValues xValues: Array<Float>, yValues: Array<Float>, seriesIndex: Int) {
         let isAboveXAxis = isVerticalSegmentAboveXAxis(yValues)
         let area = CGPathCreateMutable()
diff --git a/Chart/ChartSeries.swift b/Chart/ChartSeries.swift
index d878d1663..f29c1542a 100644
--- a/Chart/ChartSeries.swift
+++ b/Chart/ChartSeries.swift
@@ -14,6 +14,7 @@ class ChartSeries {
     var data: Array<(x: Float, y: Float)>
     var area: Bool = false
     var line: Bool = true
+    var points: Bool = true
     var color: UIColor = ChartColors.blueColor() {
         didSet {
             colors = (above: color, below: color)

From 6328f2643201a7ea3650462fed9d88785467ce4b Mon Sep 17 00:00:00 2001
From: pryaniq <alexpryanichnikov@ya.ru>
Date: Thu, 12 Nov 2015 13:09:33 +0300
Subject: [PATCH 2/2] no message

---
 Chart/ChartSeries.swift | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Chart/ChartSeries.swift b/Chart/ChartSeries.swift
index f29c1542a..154765046 100644
--- a/Chart/ChartSeries.swift
+++ b/Chart/ChartSeries.swift
@@ -14,7 +14,7 @@ class ChartSeries {
     var data: Array<(x: Float, y: Float)>
     var area: Bool = false
     var line: Bool = true
-    var points: Bool = true
+    var points: Bool = false
     var color: UIColor = ChartColors.blueColor() {
         didSet {
             colors = (above: color, below: color)