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

Show the last x axis label on bar chart #3324

Closed
HsiaoAi opened this issue Mar 9, 2018 · 1 comment
Closed

Show the last x axis label on bar chart #3324

HsiaoAi opened this issue Mar 9, 2018 · 1 comment

Comments

@HsiaoAi
Copy link

HsiaoAi commented Mar 9, 2018

Hi I would like to show the last x axis label on bar chart
as this issue #2006 but it didnt work for me
img_5932
how could I modify the chart as the upper one?
Thanks in advance!

@kvnbra
Copy link

kvnbra commented Mar 12, 2018

You can try barChartView.xAxis.avoidFirstLastClippingEnabled = true and barChartView.xAxis.forceLabelsEnabled = true that's made the trick for me.

However, you lose dynamic label count when zooming (and so lose precision).
To fix that, I added a delegate to the chart view with the chartScaled method like this :

extension ChartViewController: ChartViewDelegate {
    func chartScaled(_ chartView: ChartViewBase, scaleX: CGFloat, scaleY: CGFloat) {
            // Only enable fixed label count when fully zoomed out
            chartView.xAxis.forceLabelsEnabled = self.barChartView.isFullyZoomedOut
    }
}

@jjatie jjatie closed this as completed Apr 15, 2018
@ChartsOrg ChartsOrg locked as resolved and limited conversation to collaborators Apr 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants