Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move isDrawCirclesEnabled check further up in code to avoid creating … #4050

Merged
merged 2 commits into from
Nov 11, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
move isDrawCirclesEnabled check further up in code to avoid creating …
…accessibility labels that will never appear anyway. Reduces CPU significantly for larger datasets.
Andy Martushev committed Jun 28, 2019
commit 13094be1f0286c5a4de087db9ef48970bb30d934
13 changes: 8 additions & 5 deletions Source/Charts/Renderers/LineChartRenderer.swift
Original file line number Diff line number Diff line change
@@ -601,6 +601,14 @@ open class LineChartRenderer: LineRadarRenderer
continue
}


// Skip Circles and Accessibility if not enabled.
//reduces CPU significantly if not needed
if !dataSet.isDrawCirclesEnabled
{
continue
}

// Accessibility element geometry
let scaleFactor: CGFloat = 3
let accessibilityRect = CGRect(x: pt.x - (scaleFactor * circleRadius),
@@ -621,11 +629,6 @@ open class LineChartRenderer: LineRadarRenderer
accessibilityOrderedElements[i].append(element)
}

if !dataSet.isDrawCirclesEnabled
{
continue
}

context.setFillColor(dataSet.getCircleColor(atIndex: j)!.cgColor)

rect.origin.x = pt.x - circleRadius