-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
How to control which entries on xAxis be shown? #768
Comments
By the way, the last entry label on xAxis(11:30) always invisible, how to make it visible? |
the x axis labels are controlled by some logic called axisLabelModulus. if you let ios-charts calculates it, it will calculate the axisLabelModulus to a proper value to let the labels display properly. If you use resetLabelsToSkip(), then you should be able to show 9:30, 10:30, etc. About the last one disappearing, try avoidFirstLastClippingEnabled = true. /// the modulus that indicates if a value at a specified index in an array(list) for the x-axis-labels is drawn or not. Draw when `(index % modulus) == 0`.
public var axisLabelModulus = Int(1)
/// if set to true, the chart will avoid that the first and last label entry in the chart "clip" off the edge of the chart
public var avoidFirstLastClippingEnabled = false
/// Sets the number of labels that should be skipped on the axis before the next label is drawn.
/// This will disable the feature that automatically calculates an adequate space between the axis labels and set the number of labels to be skipped to the fixed number provided by this method.
/// Call `resetLabelsToSkip(...)` to re-enable automatic calculation.
public func setLabelsToSkip(count: Int)
{
...
} |
|
That's not the first/last that's clipped explicitly - but the whole drawing
|
@liuxuan30 How would I use the resetLabelToSkip() method? |
it's deprecated |
Well, I have many entries in the xAxis, for example :
But I only want to show 9:30 and 10:30 and 11:30 on the xAxis, the entries are equidistant and must be the chosen ones, how to do with it ? Thanks
The text was updated successfully, but these errors were encountered: