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

Hide specific labels on y axis #1253

Closed
jayesh15111988 opened this issue Jul 15, 2016 · 2 comments
Closed

Hide specific labels on y axis #1253

jayesh15111988 opened this issue Jul 15, 2016 · 2 comments

Comments

@jayesh15111988
Copy link

I was looking for a way to hide specific labels on the y axis. I have a y axis values ranging from 0-100. I don't want to show the zero value at all. At the same time I was to make it looks like as if zero value were there. Any help is much appreciated.

@shgodoroja
Copy link

shgodoroja commented Jul 15, 2016

I've had similar issue these days and had to modify the framework's source code. What I did is added in ChartYAxis class a bool value, in your case could be hideFirstValue, then in ChartYAxisRenderer modify drawYLabels method, serch for for i in 0 ..< yAxis.entryCount code, inside of for statment check if yAxis must hide it's first value then if i == 0 then bypass current iteration using continue, this way it won't add label for first value.

for i in 0 ..< yAxis.entryCount {

   if yAxis.hideFirstValue {

      if i  == 0 {
         continue
      }

  }

  // the rest of the code
}

Of course instead of bool value you can add an index or an array of indexes, would be more flexible to hide any label you want.

@jayesh15111988
Copy link
Author

@mancunianetz I just used chart.leftAxis.startAtZeroEnabled = NO to suppress the zero value at the beginning.

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

3 participants