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

Graph x-axis values not displaying in swift 3.0 #2488

Closed
Aanchaljain9988 opened this issue May 30, 2017 · 1 comment
Closed

Graph x-axis values not displaying in swift 3.0 #2488

Aanchaljain9988 opened this issue May 30, 2017 · 1 comment

Comments

@Aanchaljain9988
Copy link

Aanchaljain9988 commented May 30, 2017

@danielgindi : simulator screen shot may 30 2017 8 14 02 pm

I have added values for all bars but its not showing x-values corresponding to every bar. I am using this code :
class ChartStringFormatter: NSObject, IAxisValueFormatter {

var nameValues  = [String]()

public func stringForValue(_ value: Double, axis: AxisBase?) -> String {
    
    let index = Int(value.rounded())
    
    if index < 0 || index >= nameValues.count || index != Int(value)
    {
        return ""
    }
    
    print("arry is",nameValues)
    return String(describing: nameValues[Int(value)])
}

}

@liuxuan30
Copy link
Member

Not every bar can show x value by default due to space limit. Check out ChartsDemo and computeAxisValues to see how the x entries are generated, and override it and supply what you need

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