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

Simple Radar Chart causing hang / cpu 99% #2121

Closed
royherma opened this issue Jan 29, 2017 · 9 comments
Closed

Simple Radar Chart causing hang / cpu 99% #2121

royherma opened this issue Jan 29, 2017 · 9 comments

Comments

@royherma
Copy link

Trying to create and load a simple RadarChartView, however when assigning data to it, it causes the app to freeze / cpu goes to 99%.

@IBOutlet var radarChart : RadarChartView!

let entries = [
                ChartDataEntry(value: 0.8, xIndex: 0),
                ChartDataEntry(value: 1.8, xIndex: 1),
                ChartDataEntry(value: 2.8, xIndex: 2),
                ChartDataEntry(value: 3.8, xIndex: 3),
                ChartDataEntry(value: 4.8, xIndex: 4),
                ChartDataEntry(value: 5.8, xIndex: 5)
                ]
            
let dataSet : RadarChartDataSet = RadarChartDataSet(yVals: entries, label: nil)
dataSet.drawFilledEnabled = true
dataSet.drawValuesEnabled = false
let data = RadarChartData(xVals: ["1","2","3","4","5","6"], dataSets: [dataSet])
            
self.radarChart.data = data

When no data is assigned, the chart loads and display the valid "no data text", however as mentioned assigning data to it (i've tried multiple forms) causes the problem.

Would love some help, thanks!

@thierryH91200
Copy link
Contributor

try that

   let entries = [
        RadarChartDataEntry(value: 0.8),
        RadarChartDataEntry(value: 1.8),
        RadarChartDataEntry(value: 2.8),
        RadarChartDataEntry(value: 3.8),
        RadarChartDataEntry(value: 4.8),
        RadarChartDataEntry(value: 5.8)
   ]
    
    let data = RadarChartData()
    let dataSet = RadarChartDataSet(values: entries, label: nil)
    dataSet.drawFilledEnabled = true
    dataSet.drawValuesEnabled = false
    
    data.addDataSet(dataSet)
    
    self.radarChart.data = data

@royherma
Copy link
Author

Don't have RadarChartDataEntry, so did this:

let entries = [
                ChartDataEntry(value: 0.8, xIndex: 0),
                ChartDataEntry(value: 1.8, xIndex: 1),
                ChartDataEntry(value: 2.8, xIndex: 2),
                ChartDataEntry(value: 3.8, xIndex: 3),
                ChartDataEntry(value: 4.8, xIndex: 4),
                ChartDataEntry(value: 5.8, xIndex: 5)
            ]
            
            
            let data = RadarChartData()
            let dataSet = RadarChartDataSet(yVals: entries, label: nil)
            
            data.addDataSet(dataSet)
            
            self.radarChart.data = data

Got this (it's the cell with the corresponding values):

image

@thierryH91200
Copy link
Contributor

You have a version that is obsolete
update to chart 3.0

@royherma
Copy link
Author

royherma commented Jan 29, 2017

wanted to update but can't due to conflicts with swift 3.0 and older versions in my project @thierryH91200

I believe it should still work on older versions...

@pmairoldi
Copy link
Collaborator

Interesting. What version are you using 2.3? I can try it out.

@royherma
Copy link
Author

@petester42 using 2.3.1

@royherma
Copy link
Author

royherma commented Feb 1, 2017

any luck @petester42 ?

@pmairoldi
Copy link
Collaborator

Im just trying it now. And I don't see this problem. Im using an iPhone 6 to test and its never goes over 2. Maybe you're doing too much stuff on the main thread in your app?

@pmairoldi
Copy link
Collaborator

I suggest you update to 3.0 soon since swift 2.3 is deprecated and will be removed in Xcode 8.3

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