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

Values overlap for bar chart and labels of X-Axis #1923

Closed
ios-sagar opened this issue Dec 6, 2016 · 4 comments
Closed

Values overlap for bar chart and labels of X-Axis #1923

ios-sagar opened this issue Dec 6, 2016 · 4 comments

Comments

@ios-sagar
Copy link

I am happy to use charts library and working well

but faced some weired issue and I tried lot to overcome but failed.

  1. My Bar Chart is having 2 values for each X-axis value. (male-female ratio) for each department.
    but I am not able to see correct value for any of the value is "0". If male or female count in particular department is "0" then that "0" get overlapped with other value.
    (see first bar in image. "0" is overlapped with "2")

  2. I have department names quite bigger in text. like "Developers", "Designer", "Networking" , "Quality Analyst", "HR management" etc.
    but If department name is bigger with number of bars. alternate name is not visible. any option, how can I turn the labels to show them vertically or diagonally or any other option for the same.

unadjustednonraw_thumb_1d

@liuxuan30
Copy link
Member

  1. That's a known issue. Because we have to draw 0 somewhere, and it will overlap.. You can override drawLabels() to get rid of what you don't want. But for the library, there is no decent solution yet.
  2. I don't know why 'Develop' got cut off to 'Develo', I checked ChartsDemo, it seems fine.. even though the x labels will have overlap...

Would you please debug a little x axis renderer - drawLabels() to see how it goes? It could be problems or bug while calculating the max width, etc. But I can't reproduce it.

BTW, you can turn on wordWrapEnabled for x axis for long labels.

@ios-sagar
Copy link
Author

  1. For the first issue, I disabled all the values shown over the bar using the method drawValuesEnabled. So OK from QA team for the same.

  2. For second issue, I am getting all the values for x-axis and then I am just taking only first 6 characters of the string.
    but I wanted to rotate X-axis labels vertically or diagonally will also work. Any idea how to achieve this.

@liuxuan30
Copy link
Member

It supports x axis label rotation:

/// This is the angle for drawing the X axis labels (in degrees)
    open var labelRotationAngle = CGFloat(0.0)

@ios-sagar
Copy link
Author

Cool.....

It works well.
Thanks buddy. Thank you very much.....

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