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

RadarChartView the datas disappear when I enlarge or decrease the window #2207

Open
thierryH91200 opened this issue Feb 28, 2017 · 4 comments

Comments

@thierryH91200
Copy link
Contributor

thierryH91200 commented Feb 28, 2017

In my program inspired by ios demo
This is what happens

https://www.dropbox.com/s/r4bmn262esatiuf/screencast%202017-02-28%2010-31-41.mp4?dl=0

If in my program I put in comment the next line?

 yAxis.axisMaximum = 80.0

the problem is solved

  let yAxis = radarChartView.yAxis
    yAxis.labelFont = NSUIFont(name: "HelveticaNeue-Light", size: CGFloat(9.0))!
    yAxis.labelCount = 5
    yAxis.axisMinimum = 0.0
   //yAxis.axisMaximum = 80.0
    yAxis.drawLabelsEnabled = false

https://www.dropbox.com/s/n1vvg4e37m5psxv/screencast%202017-02-28%2010-33-20.mp4?dl=0

OK but why ??

@liuxuan30
Copy link
Member

liuxuan30 commented Mar 1, 2017

eh... seems a bug.

@liuxuan30 liuxuan30 added the bug label Mar 1, 2017
@liuxuan30
Copy link
Member

liuxuan30 commented Mar 1, 2017

I looked into it:
When setting yAxis.axisMaximum,
in open override func notifyDataSetChanged(), the input is

_yAxisRenderer?.computeAxis(min: _yAxis._axisMinimum, max: _yAxis._axisMaximum, inverted: _yAxis.isInverted)

however inside computeAxis() -> computeAxisValues() in YAxisRendererRadarChart, computeAxisValues() is changing axis.entries and updating _axisMaximum and _axisMinimum after getting new entires:

        axis._axisMinimum = axis.entries[0]
        axis._axisMaximum = axis.entries[n-1]
        axis.axisRange = abs(axis._axisMaximum - axis._axisMinimum)

And here come's the dead loop, axisMaximum is increasing forever if computeAxis() is called, causing the radar area disappearing.

I remember I modified the code here a long time ago in #207,
however, I just add _yAxis.axisMinimum = _yAxis.entries[0], axis._axisMaximum = axis.entries[n-1] is there all the time.
Looks like an old bug, but I'm not sure if Chart 2.x has the same issue or it happen for Chart 3.x

Not having a clean shot for how to fix it.

@thierryH91200
Copy link
Contributor Author

thierryH91200 commented Mar 1, 2017

Thanks for the explanation
I understand better now

        axis._axisMinimum = axis.entries[0]
        axis._axisMaximum = axis.entries[n-1]
        print ("axis._axisMaximum = ", axis._axisMaximum)
        axis.axisRange = abs(axis._axisMaximum - axis._axisMinimum)

Log View :

enlarge the window

axis._axisMaximum = 100.0
axis._axisMaximum = 120.0
axis._axisMaximum = 140.0
axis._axisMaximum = 150.0
axis._axisMaximum = 180.0
axis._axisMaximum = 200.0

decrease the window

axis._axisMaximum = 240.0
axis._axisMaximum = 250.0
axis._axisMaximum = 300.0
axis._axisMaximum = 400.0
axis._axisMaximum = 500.0
axis._axisMaximum = 600.0

@liuxuan30
Copy link
Member

liuxuan30 commented Mar 2, 2017

yep, it just keeps increasing no matter you how you change the window.
However I need @danielgindi to give some thoughts for chart 3.x, is it possible to remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants