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

noDataText for PieChartView isn't working. #2901

Closed
SatishBirajdar007 opened this issue Oct 20, 2017 · 2 comments
Closed

noDataText for PieChartView isn't working. #2901

SatishBirajdar007 opened this issue Oct 20, 2017 · 2 comments

Comments

@SatishBirajdar007
Copy link

Hello,

I want noDataText label shown when there is no element to be shown, so I added

pieChartView.noDataText = "No data available"

in ViewDidLoad and also in ViewWillAppear

But it isn't working, any help?

@liuxuan30
Copy link
Member

make sure you meet:

        if _data === nil && noDataText.characters.count > 0
        {
            context.saveGState()
            defer { context.restoreGState() }
            
            ChartUtils.drawMultilineText(
                context: context,
                text: noDataText,
                point: CGPoint(x: frame.width / 2.0, y: frame.height / 2.0),
                attributes:
                [NSAttributedStringKey.font: noDataFont,
                 NSAttributedStringKey.foregroundColor: noDataTextColor],
                constrainedToSize: self.bounds.size,
                anchor: CGPoint(x: 0.5, y: 0.5),
                angleRadians: 0.0)
            
            return
        }

@SatishBirajdar007
Copy link
Author

Okay thanks.

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