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

[BUG] xAxis label too long causes radar chart cannot render correctly #205

Closed
liuxuan30 opened this issue Jul 11, 2015 · 4 comments
Closed

Comments

@liuxuan30
Copy link
Member

By accident I see my data source feed a very long string, about 4xx width, and this causes the radar chart cannot draw itself.

I have managed to limit the width through hard code (not finding a good place to hold the variable):

        _xAxis.labelWidth = widthText.sizeWithAttributes([NSFontAttributeName: _xAxis.labelFont]).width;

        if (_xAxis.labelWidth > 100)
        {
            _xAxis.labelWidth = 100
        }

        _xAxis.labelHeight = _xAxis.labelFont.lineHeight;
        _xAxis.values = xValues;

However, this limit the size, but when rendering, it still draw the whole text. Is there any way to render the text only within the rect? Tried to find a API, but no good.

This is the chart after I have set the width up to 100:
labeltoolong

@davecom
Copy link

davecom commented Jul 19, 2015

I'm seeing this too - Basically if you have a label that's longer than a certain number of characters (haven't tested exactly, but it's <20 so not that long) the chart becomes tiny.

@liuxuan30
Copy link
Member Author

Yes, this is a defect because it need take the radius and label width into account while calculating. The idea is to show all the labels and chart. I am suggesting add a limit for the label width, and once it exceeds, it will render the text like "ABCD..."

I am having trouble to implement this, becuase the drawText function don't cut the rect

@danielgindi
Copy link
Collaborator

This, too, is a duplicate of #153. Please merge the discussions :-)

@danielgindi
Copy link
Collaborator

I'm just trying to track the bugs and it makes it harder to try to understand the same bug twice...

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