There might be a bug in plotAreaRect. It seems that this value isn't updated until sometime after viewDidLayoutSubviews. When the chart's frame changes, I have to performSelector in the future in order to get the new plotAreaRect. Can you look into if this is the case? If you find something, can you suggest a workaround to get this measurement correctly inside viewDidLayoutSubviews?
You can see it here:
-(void)viewDidLayoutSubviews
{
NSLog(@"%s - here", __PRETTY_FUNCTION__);
[self updateStackedImage];
[self performSelector:@selector(updateStackedImage) withObject:nil afterDelay:0];
}
-(void)updateStackedImage
CGRect chartRect = self.chartView.plotAreaRect;
NSLog(@"%s - chartRect:%@", __PRETTY_FUNCTION__, NSStringFromCGRect(chartRect));
self.stackedRangeImageView.frame = chartRect;
self.stackedRangeImageView.image = [self.stackedRangeWidgetController imageOfRangesOfSize:chartRect.size];
and...
viewDidLayoutSubviews] - here
updateStackedImage] - chartRect:{{25, 7}, {225, 98.875641}}
updateStackedImage] - chartRect:{{25, 7}, {510, 289.87564}}
Hi Caylan,
That's an odd problem and so far I'm having trouble reproducing it. PlotAreaRect property simply returns the chart's viewport, which has been extremely reliable, since it lies at the core of the chart. If you visually see changes in the chart's size, it couldn't have happened without the viewport also changing.
I'm attaching a small sample that I used to test this out. You should be able to see that -didLayoutSubviews gives updated bounds right after the chart's frame changes.One thing I haven't tried yet is to use auto layout, so maybe that's the culprit. It would be great if you could modify the sample to reproduce the issue, while I try some other things.
I'm a auto layout user, so that could be the problem. Right now the chart is inside a flow view cell. So, it's when the flow view cell changes size via user interaction, the chart changes size, and the plotAreaRect is temporarily the old size. Auto layout is used to constrain the chart to the superview's bounds.
Hello,
I am just checking about the progress of this issue. Let me know If you need any further assistance on this issue?
Thank you for using Infragistics Components.