Skip to content

Commit

Permalink
Skip drawing of circles by index for line charts (Fixes ChartsOrg#1795)
Browse files Browse the repository at this point in the history
Drawing of circles is skipped by providing indexes that should not be drawn. Indexes are set on the dataset and the renderer skips those.
  • Loading branch information
denrase committed Nov 6, 2016
1 parent ff0ef31 commit 84409e4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ open class LineChartDataSet: LineRadarChartDataSet, ILineChartDataSet
/// If true, drawing circles is enabled
open var drawCirclesEnabled = true

/// Prevent circle drawing by index.
open var circleIndexesNotToDraw = [Int]()

/// - returns: `true` if drawing circles for this DataSet is enabled, `false` ifnot
open var isDrawCirclesEnabled: Bool { return drawCirclesEnabled }

Expand Down
3 changes: 3 additions & 0 deletions Source/Charts/Data/Interfaces/ILineChartDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public protocol ILineChartDataSet: ILineRadarChartDataSet
/// - returns: `true` if drawing circles for this DataSet is enabled, `false` ifnot
var isDrawCirclesEnabled: Bool { get }

/// Prevent circle drawing by index.
var circleIndexesNotToDraw: [Int] { get set }

/// The color of the inner circle (the circle-hole).
var circleHoleColor: NSUIColor? { get set }

Expand Down
4 changes: 4 additions & 0 deletions Source/Charts/Renderers/LineChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,10 @@ open class LineChartRenderer: LineRadarRenderer
{
guard let e = dataSet.entryForIndex(j) else { break }

guard !dataSet.circleIndexesNotToDraw.contains(j) else {
continue
}

pt.x = CGFloat(e.x)
pt.y = CGFloat(e.y * phaseY)
pt = pt.applying(valueToPixelMatrix)
Expand Down

0 comments on commit 84409e4

Please sign in to comment.