Skip to content

Commit

Permalink
1. try to fix xBounds iterator() to match the behavior of `stride(fro…
Browse files Browse the repository at this point in the history
…m: _xBounds.min, through: _xBounds.range + _xBounds.min, by: 1)`

this fix issues from 2a1ecb4

2. revert clipValuesToContentEnabled to false by default. but enable it for bar chart test - testPositiveValuesWithCustomAxisMaximum()

3. update tvOS test image for testPositiveValuesWithCustomAxisMaximum. After changing tolerance to 0.001, it fails while the same iOS test pass.
I looked into the image diff, it shows the intersect of bar top edge and axis line at value 50 has diff, but I suppose the image is the same. safe to merge.
  • Loading branch information
liuxuan30 committed Apr 11, 2019
1 parent 83c3b61 commit e80f907
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/Charts/Charts/BarLineChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
@objc open var drawBordersEnabled = false

/// When enabled, the values will be clipped to contentRect, otherwise they can bleed outside the content rect.
@objc open var clipValuesToContentEnabled: Bool = true
@objc open var clipValuesToContentEnabled: Bool = false

/// When disabled, the data and/or highlights will not be clipped to contentRect. Disabling this option can
/// be useful, when the data lies fully within the content rect, but is drawn in such a way (such as thick lines)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ extension BarLineScatterCandleBubbleRenderer.XBounds: Sequence {
}

public mutating func next() -> Int? {
guard value < bounds.max else { return nil }
guard value <= bounds.max else { return nil }
value += 1
return value
return value - 1
}
}

Expand Down
1 change: 1 addition & 0 deletions Tests/Charts/BarChartTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class BarChartTests: FBSnapshotTestCase
let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries)
let chart = setupDefaultChart(dataSets: [dataSet])
chart.leftAxis.axisMaximum = 50
chart.clipValuesToContentEnabled = true
chart.notifyDataSetChanged()
ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance)
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e80f907

Please sign in to comment.