Skip to content

Commit

Permalink
Revert "Import swift algorithms (ChartsOrg#4497)"
Browse files Browse the repository at this point in the history
This reverts commit b8dba59.

# Conflicts:
#	Charts.xcodeproj/project.pbxproj
#	Charts.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	Package.resolved
#	Package.swift
#	Source/Charts/Data/Implementations/Standard/ChartDataSet.swift
  • Loading branch information
leinhauplk committed Oct 20, 2022
1 parent 2037006 commit 9d97ce6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 37 deletions.
25 changes: 0 additions & 25 deletions Package.resolved

This file was deleted.

6 changes: 1 addition & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,9 @@ let package = Package(
targets: ["Charts"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-algorithms", from: "1.0.0")
],
targets: [
.target(
name: "Charts",
dependencies: [.product(name: "Algorithms", package: "swift-algorithms")]
)
.target(name: "Charts")
],
swiftLanguageVersions: [.v5]
)
3 changes: 1 addition & 2 deletions Source/Charts/Highlight/ChartHighlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// https://github.com/danielgindi/Charts
//

import Algorithms
import Foundation
import CoreGraphics

Expand Down Expand Up @@ -74,7 +73,7 @@ open class ChartHighlighter : NSObject, Highlighter

guard let data = self.data else { return vals }

for (i, set) in data.indexed() where set.isHighlightEnabled
for (i, set) in zip(data.indices, data) where set.isHighlightEnabled
{
// extract all y-values from all DataSets at the given x-value.
// some datasets (i.e bubble charts) make sense to have multiple values for an x-value. We'll have to find a way to handle that later on. It's more complicated now when x-indices are floating point.
Expand Down
7 changes: 4 additions & 3 deletions Source/Charts/Highlight/CombinedHighlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// https://github.com/danielgindi/Charts
//

import Algorithms
import Foundation
import CoreGraphics

Expand All @@ -36,8 +35,10 @@ open class CombinedHighlighter: ChartHighlighter
let dataObjects = chart.combinedData?.allData
else { return vals }

for (i, dataObject) in dataObjects.indexed()
for i in dataObjects.indices
{
let dataObject = dataObjects[i]

// in case of BarData, let the BarHighlighter take over
if barHighlighter != nil && dataObject is BarChartData,
let high = barHighlighter?.getHighlight(x: x, y: y)
Expand All @@ -47,7 +48,7 @@ open class CombinedHighlighter: ChartHighlighter
}
else
{
for (j, set) in dataObject.indexed() where set.isHighlightEnabled
for (j, set) in zip(dataObject.indices, dataObject) where set.isHighlightEnabled
{
let highs = buildHighlights(dataSet: set, dataSetIndex: j, xValue: xValue, rounding: .closest)

Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Highlight/RadarHighlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ open class RadarHighlighter: PieRadarHighlighter
let sliceangle = chart.sliceAngle
let factor = chart.factor

for (i, dataSet) in chartData.indexed()
for (i, dataSet) in zip(chartData.indices, chartData)
{
guard let entry = dataSet.entryForIndex(index) else { continue }

Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Renderers/YAxisRendererRadarChart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ open class YAxisRendererRadarChart: YAxisRenderer
let xOffset = axis.labelXOffset

let entries = axis.entries[from..<to]
entries.indexed().forEach { index, entry in
zip(entries.indices, entries).forEach { index, entry in
let r = CGFloat(entry - axis._axisMinimum) * factor
let p = center.moving(distance: r, atAngle: chart.rotationAngle)
let label = axis.getFormattedLabel(index)
Expand Down

0 comments on commit 9d97ce6

Please sign in to comment.