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

Issue with x-axis fixed label width #684

Closed
osolano opened this issue Jan 18, 2016 · 2 comments
Closed

Issue with x-axis fixed label width #684

osolano opened this issue Jan 18, 2016 · 2 comments

Comments

@osolano
Copy link

osolano commented Jan 18, 2016

Hi,
I'm trying to make sure that all data points on the line chart have a label showing below it. I've tried adjusting the _chartView.xAxis.labelWidth property to different values but it doesn't seem to make a difference. I simply just want to make sure that the label width between each data point is the same so that all the labels are shown. Any thoughts on how to adjust this?

The bottom image is what is shown when labelWidth is not set.

image

@liuxuan30
Copy link
Member

xAxis.labelWidth is already used to get max label width, and use it to calculate the modulus. If you want to show every label, try this, but you may get some overlap, since your chart seems not having enough space:

    /// 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)
    {
        _isAxisModulusCustom = true

        if (count < 0)
        {
            axisLabelModulus = 1
        }
        else
        {
            axisLabelModulus = count + 1
        }
    }

@osolano
Copy link
Author

osolano commented Jan 21, 2016

that worked for me thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants