You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As v3.0 is still not in cocoapods and I cannot find the exact reference in the newer code but I think the issue is around the following place:
// in Charts/Core/ChartXAxisRenderer.swift
open func drawLabels(context: CGContext, pos: CGFloat, anchor: CGPoint) {
...
for i in stride(from: self.minX, to: min(self.maxX + 1, xAxis.values.count), by: xAxis.axisLabelModulus)
...
}
}
Basically this would simplify to the following:
for i in stride(from: 0, to: 50, by: 25)
Which would convert to following [0, 25] array missing therefore the last element ([50]).
I'm using: pod 'Charts', :git => 'https://github.com/danielgindi/Charts.git', :branch => 'Swift-3.0'
First you should try Chart 3.0, it has redesigned x axis rendering. Chart 2.2.5 will not have bug fix anymore.
For your question, you call stride(from: 0, to: 50, by: 25) where last value will be 0 + 25; It's your step issue. If you want to sure a middle value, I guess you have to override this method. Also You need to consider when you zooming, how do you display the middle value as well.
Hi, I'm also not able to show the last label on the xAxis.
Example:
50
data points[0]
, a mid point[24]
and the last[49]
labelsHere's a set of different attempts:
view.xAxis.setLabelsToSkip(25)
view.xAxis.setLabelsToSkip(24)
view.xAxis.axisLabelModulus = 24
(I'm using
avoidFirstLastClippingEnabled
which is fitting only the first label)I followed Stackoverflow, a similar issue on previous version and apparently the Android version have the something along the lines.
Thank you!
The text was updated successfully, but these errors were encountered: