-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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 radius is still affected by label size when label drawing is disabled #153
Comments
More frame info: my chart bound is (0,0,157,40) but after calculateOffsets(), the left radar contentRect is the right one is: |
Does this happen on Android version too? On Tue, Jun 16, 2015 at 11:56 AM, Xuan notifications@github.com wrote:
|
I am not android developer, thus I am no sure... |
@danielgindi could you elaberate what's the viewport purpose for radar chart? also, I am struggling with public var factor: CGFloat
{
var content = _viewPortHandler.contentRect;
return min(content.width / 2.0, content.height / 2.0)
/ CGFloat(_yAxis.axisRange);
} It reads the _yAxis.axisRange, however, this could vary from 120 to 14000000. This can cause factor to be a large number, if the _yAxis.axisRange is small and factor could be also very small. Is this a bug or by design? |
@danielgindi With further investigation, I think a very small view frame can easily be impacted. for exmaple, what I am doing is create a thumb view, the height is only 40. and ios-charts is doing calculations, leads to the viewPortHandler.contentRect has a very small height or even negative height. even I manually set the offset like this: self.thumbView.data = radarData;
[self.thumbView.viewPortHandler restrainViewPortWithOffsetLeft:0 offsetTop:0 offsetRight:0 offsetBottom:0]; However, in ChartViewBase: drawRect, if (!_offsetsCalculated)
{
calculateOffsets();
_offsetsCalculated = true;
} This overwrite my changes again while drawing. I think this part should be enhanced to be able to fit in small view frame? What do you think? |
besides,
this will make the radar chart not center aligned vertically. I don't understand why offsetTop is set to either minOffset or legendTop. There should be a standalone yRequiredBaseOffset and xRequiredBaseOffset. using single RequiredBaseOffset and set it to xAxis.labelWidth is not good |
I'm seeing the same bug. Did you find a workaround? |
@davecom I don't have the issue recently, and I forget what I changed... But based on the comments, I guess it's about to change: if (!_offsetsCalculated)
{
calculateOffsets();
_offsetsCalculated = true;
} I add a Bool property, if it's a thumb view, don't caculate: if (!_offsetsCalculated)
{
if (!isSmallView)
{
calculateOffsets()
}
_offsetsCalculated = true
} |
I actually think this issue may be the same as #205 |
@davecom I guess not, because I have disabled draw labels for small size charts. Unless it indeed has bug even I disabled it it still count it. |
I have setup two radar chart as shown in the screen shot. I am confused why the left one is smaller than right one. I just feed the same frame for both of them, only data is different. What I want is the same size for radar chart.
I found that
_viewPortHandler.contentRect
is giving different rect at diffrent phase. In init function,_viewPortHandler.contentRect
is giving the right size.I disabled the legend like this:
and checking stack trace, it shows the stack is notifyDataSetChanged() -> calculateOffsets(),
in calculateOffsets(),
the minOffset depends on the xAxis label width, the left radar is 11.56 whilte the right radar is 40. then it leads to diffrent size and even the factor is somewhat weird.
The factor depends on the axisRange as well, and my left radar range is 120.0 while the left one is 140000000.0.
I am not sure if this a bug. but if false, how can I fix it? I need the left one and right one is equal radius.
The text was updated successfully, but these errors were encountered: