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

Cannot align chart description on left instead of right #2956

Closed
dbrisinda opened this issue Nov 6, 2017 · 3 comments
Closed

Cannot align chart description on left instead of right #2956

dbrisinda opened this issue Nov 6, 2017 · 3 comments

Comments

@dbrisinda
Copy link

dbrisinda commented Nov 6, 2017

Trying to align the chart description text to the lower left of the chart instead of the default lower right of the chart, but neither of these work. Text stays on right, and then behaves badly (truncated).

self.chartView.descriptionTextAlign = NSTextAlignmentLeft;

and

self.chartView.chartDescription.textAlign = NSTextAlignmentLeft;
@liuxuan30
Copy link
Member

did you set _chartView.chartDescription.enabled = YES;?

@dbrisinda
Copy link
Author

Yes. For clarification, the description text is showing up, but it's not being aligned to the left when that alignment mode is indicated.

@liuxuan30
Copy link
Member

liuxuan30 commented Nov 15, 2017

please post a screenshot. I suspect your drawing rect is not on left, so it looks like not aligned.
check @objc internal func drawDescription(context: CGContext)

        var position = description.position

        // if no position specified, draw on default position
        if position == nil
        {
            let frame = self.bounds
            position = CGPoint(
                x: frame.width - _viewPortHandler.offsetRight - description.xOffset,
                y: frame.height - _viewPortHandler.offsetBottom - description.yOffset - description.font.lineHeight)
        }

you can stroke the rect or draw the position so you know where it starts. I don't think it's a bug.

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