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

Radar Chart axis maximum #1952

Closed
Tobisaninfo opened this issue Dec 12, 2016 · 10 comments
Closed

Radar Chart axis maximum #1952

Tobisaninfo opened this issue Dec 12, 2016 · 10 comments

Comments

@Tobisaninfo
Copy link

When rotating the device the chart resizes the y-axis and ignore my max value. How can I prevent this behavior?

@liuxuan30
Copy link
Member

Be more specific. If you are asking setting max value, refer to axisMaximum

@Tobisaninfo
Copy link
Author

I already tried this line of code

    chart.yAxis.axisMaximum = 2.0

But this does not help at all.

@liuxuan30
Copy link
Member

liuxuan30 commented Dec 14, 2016

then be more specific. You don't give a screenshot or gif or code to reproduce with ChartsDemo. We can barely understand.

@Tobisaninfo
Copy link
Author

Here is some code snippet from my diagram:

let chartDataSet = RadarChartDataSet(values: dataEntries, label: "Current Test")
let chartData = RadarChartData(dataSet: chartDataSet)
chart.data = chartData

    //Options of radarChart
    chart.sizeToFit()
    chart.chartDescription?.text = ""
    
    chart.xAxis.valueFormatter = self
    
    chart.yAxis.labelCount = 3
    chart.yAxis.axisMinimum = 0.0
    chart.yAxis.axisMaximum = 3.0

I have 3 screenshots for you. The first is the correct one. The second is after the first rotation und the third one it after the second rotation. As you can see my maximum of 3.0 is now 9.0. That is my problem.
Thanks for help.

screen shot 2016-12-14 at 22 04 01
screen shot 2016-12-14 at 22 04 13
screen shot 2016-12-14 at 22 04 19

@liuxuan30
Copy link
Member

liuxuan30 commented Dec 15, 2016

You need to call notiftyDatasetChanged() after you set axisMaximum, or put chart.data = data at last.
Actually, ChartsDemo radar chart already set axis minimum and maximum, it's fine.

@Tobisaninfo
Copy link
Author

I tried both things, but it doesn't change anything. Can I send you something, that helps you by solving this issue?

@liuxuan30
Copy link
Member

Have you checked out ChartsDemo radar chart?
Well you can upload a sample project so we could take a look.

@Tobisaninfo
Copy link
Author

I'm sorry, but your sample chart wasn't helpful for my issue.
I'll copy my code and try to focus on the chart. I hope you have every thing you need.
I'm looking forward to hear from you. Thanks.
sample-chart.txt

@liuxuan30
Copy link
Member

Sorry I don't have a swift project to use your code. Either you upload a full project zip or reproduce it with ChartsDemo.

@liuxuan30
Copy link
Member

I looked at the code, no big issue found.
BTW, use

    open func setLabelCount(_ count: Int, force: Bool)
    {
        self.labelCount = count
        forceLabelsEnabled = force
    }

to set label count

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