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

Horizontal Bar Chart rightAxis default maximum space #2363

Closed
thierrykoppenol opened this issue Apr 14, 2017 · 6 comments
Closed

Horizontal Bar Chart rightAxis default maximum space #2363

thierrykoppenol opened this issue Apr 14, 2017 · 6 comments

Comments

@thierrykoppenol
Copy link

thierrykoppenol commented Apr 14, 2017

Hi,

I'm trying to create a Horizontal Bar Chart where both ends (right and left axis) are aligned to the left and right side of the screen, with some offset. I've used the following code to remove both axises and set the axis minimum to zero.

self.leftAxis.enabled = false
self.leftAxis.axisMinimum = 0
self.rightAxis.enabled = false
self.rightAxis.axisMinimum = 0

The leftAxis is aligned the way is expecting it. However, the rightAxis is still showing some blank space. I can check this size with:

self.rightAxis.getRequiredHeightSpace()

Is there a way to remove or set this required space? I've tried to set spaceTop without success.

Here is an image as an example:

img_0010

@thierryH91200
Copy link
Contributor

capture d ecran 2017-04-14 a 10 02 09

xAxis is Green
leftAxis is Blue
rightAxis is Red

Do you agree ??

@thierrykoppenol
Copy link
Author

thierrykoppenol commented Apr 14, 2017

Agree. I've updated the question above. When i enable the xAxis it will show the following:

img_0011

Maybe i wasn't clear before, but i want to remove the white space on the right side of the chart. I've added the current situation without the xAxis enabled in the Question above.

I know i can set a AxisMaximum to 100 and change the values of the bar so together they will always be 100. But is there a way to set the AxisMaximum to the total of the values, without displaying the white space?

@thierrykoppenol thierrykoppenol changed the title Horizontal Bar Chart rightAxis required space Horizontal Bar Chart xAxis Default Maximun space Apr 14, 2017
@thierrykoppenol thierrykoppenol changed the title Horizontal Bar Chart xAxis Default Maximun space Horizontal Bar Chart rightAxis Default Maximum space Apr 14, 2017
@thierrykoppenol thierrykoppenol changed the title Horizontal Bar Chart rightAxis Default Maximum space Horizontal Bar Chart rightAxis default maximum space Apr 14, 2017
@thierryH91200
Copy link
Contributor

ok i have understand

capture d ecran 2017-04-14 a 10 57 58

@thierryH91200
Copy link
Contributor

and now it's ok

capture d ecran 2017-04-14 a 11 07 58

@thierrykoppenol
Copy link
Author

Thanks, didn't know I had to set both the leftAxis and rightAxis Spaces

@thierryH91200
Copy link
Contributor

After a few tests
In fact there is only the left side that walks
The right side has no effect

//: ### LeftAxis
let leftAxis = chartView.leftAxis
leftAxis.labelFont = NSUIFont.systemFont(ofSize: CGFloat(12.0))
leftAxis.drawAxisLineEnabled = true
leftAxis.drawGridLinesEnabled = true
leftAxis.axisMinimum = 0.0
leftAxis.enabled = true
leftAxis.spaceTop    = 0.0
leftAxis.spaceBottom = 0.0


//: ### RightAxis
let rightAxis                  = chartView.rightAxis
rightAxis.labelFont            = NSUIFont.systemFont(ofSize: CGFloat(12.0))
rightAxis.drawAxisLineEnabled  = true
rightAxis.drawGridLinesEnabled = false
rightAxis.axisMinimum          = 0.0
rightAxis.enabled              = true
rightAxis.spaceTop    = 0.5
rightAxis.spaceBottom = 0.5

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