我在尝试使用 Xamarin.iOS 在 Shinobi for iOS 上创建圆环图时遇到了麻烦。
我用来设置图表的代码如下:
private void SetupSChart(){
float margin = 0;
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) {
margin = 10;
} else {
margin = 50;
}
var frame = UIScreen.MainScreen.Bounds;//new RectangleF (margin, margin, View.Bounds.Width - 2 * margin, View.Bounds.Height - 2 * margin);
m_schart = new ShinobiChart (frame){
Title = "Poll replies / answer",
AutoresizingMask = UIViewAutoresizing.None
};
View.AddSubview (m_schart);
m_schart.DataSource = new ChartDataSource(this.Poll);
m_schart.Legend.Hidden = false;
}
然后,我得到以下异常:
CALayerInvalidGeometry
Objective-C exception thrown. Name: CALayerInvalidGeometry Reason: CALayer position contains NaN: [nan nan]
CALayer position contains NaN: [nan nan]
我究竟做错了什么?
谢谢