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

Label drawing glitch when changing data #1347

Closed
mecid opened this issue Aug 23, 2016 · 3 comments
Closed

Label drawing glitch when changing data #1347

mecid opened this issue Aug 23, 2016 · 3 comments
Labels

Comments

@mecid
Copy link

mecid commented Aug 23, 2016

I have chart label glitches when changing chart data via calendar in the top.

`
self.summaryChart.data = BarChartData(xVals: xVals, dataSet: dataset)

self.summaryChartHeight.constant = CGFloat(xVals.count * 40)

self.delay(300) { self.summaryChart.notifyDataSetChanged() }
`

img_0525

@liuxuan30
Copy link
Member

hmm, there are labels overlap. Is this stacked bar or anything? Need step to reproduce, using ChartsDemo is even better.

@liuxuan30 liuxuan30 added the bug label Aug 24, 2016
@mecid
Copy link
Author

mecid commented Aug 24, 2016

@liuxuan30 This is not stacked bar. This is chart configuration code.
`
summaryChart.userInteractionEnabled = false
summaryChart.legend.enabled = false
summaryChart.descriptionText = ""

        summaryChart.xAxis.labelFont = UIFont.preferredFontForTextStyle(UIFontTextStyleBody)
        summaryChart.xAxis.labelTextColor = UIColor.flatWhiteColor()
        summaryChart.xAxis.labelPosition = .Bottom

        summaryChart.leftAxis.enabled = false
        summaryChart.rightAxis.enabled = false

        summaryChart.xAxis.drawAxisLineEnabled = false
        summaryChart.xAxis.drawGridLinesEnabled = false

        summaryChart.leftAxis.spaceTop = CGFloat(0.3)

`

And this is dataset creating code:

`
let dataset = BarChartDataSet()
dataset.valueFont = UIFont.preferredFontForTextStyle(UIFontTextStyleCaption1)
dataset.valueTextColor = UIColor.flatWhiteColor()
dataset.resetColors()

        let percentNumberFormatter = NSNumberFormatter()
        percentNumberFormatter.numberStyle = NSNumberFormatterStyle.PercentStyle
        dataset.valueFormatter = percentNumberFormatter

        let sum = samples.count
        var xVals: [String] = []
        var index = 0

        for (status, count) in self.groupHeartRateSamples(samples, activity: .Regular) {
            let value = Double(count) / Double(sum)
            dataset.addEntry(BarChartDataEntry(value: value, xIndex: index))
            dataset.addColor(status.color())
            xVals.append(status.description)
            index = index + 1
        }

`

@mecid
Copy link
Author

mecid commented Aug 24, 2016

Problem appear only with clear color background for chart.

@mecid mecid closed this as completed Aug 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants