TeeCHart Display problem for Xamarin.iOS

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
JAP
Newbie
Newbie
Posts: 30
Joined: Tue Sep 17, 2013 12:00 am

TeeCHart Display problem for Xamarin.iOS

Post by JAP » Wed Apr 09, 2014 9:46 pm

I'm having a problem with the generated chart because it is always misplaced (see attachement). My project is locked at landscape view and still it is not properly displayed. I use a "UIImageView" object to reference as a frame and also the chart is added as a subview (or View in some test).

In the attachement, the chart should be a little underneath and beside the buttons and throughout the remaining spaces. Also, I'm using an iPhone 3gs as a test device.
Attachments
WP_20140410_05_16_05_Pro.jpg
WP_20140410_05_16_05_Pro.jpg (295.02 KiB) Viewed 10332 times

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: TeeCHart Display problem for Xamarin.iOS

Post by Pep » Fri Apr 11, 2014 2:20 pm

Hello,

please take a look at the TeeChartBuilder example (which is included within the installer) code. There you can find a way to fix where the chart is placed, once the device is rotated, basically :

Code: Select all

		public override void ViewDidAppear (bool animated)
		{
			UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications();
			CheckPositions ();
		}

		public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations ()
		{
			return base.GetSupportedInterfaceOrientations ();
		}

		private void DeviceRotated(NSNotification notification)
		{
			CheckPositions();
		}

		public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
		{
			CheckPositions ();
		}

		private void CheckPositions()
		{
			// Refresh Chart rotating the device
			chart.RemoveFromSuperview ();
			RectangleF f = new RectangleF(View.Frame.X,50,View.Frame.Width,View.Frame.Height-BottomBar.Frame.Height-50);

			chart.Frame = f;
			View.AddSubview (chart);			
			chart.DoInvalidate ();		

			BottomBar.Frame  = new RectangleF (0,View.Frame.Height-50,
				this.chart.Frame.Width,50);
		}

JAP
Newbie
Newbie
Posts: 30
Joined: Tue Sep 17, 2013 12:00 am

Re: TeeCHart Display problem for Xamarin.iOS

Post by JAP » Sat Apr 12, 2014 1:03 pm

Actually the supported view of my app is just "Landscape" view as I'm having a hard time dealing with the orientation. Nevertheless even if the app only supports one orientation, the chart generated by TeeChart is still misplaced.

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: TeeCHart Display problem for Xamarin.iOS

Post by Pep » Tue Apr 15, 2014 8:52 am

Hello,

so, if I understand, you need to open a new View, in landscape mode and be able to show the Chart as a client or at specific position, isn't it ?
I'm asking to you in order to prepare a code that does that.

JAP
Newbie
Newbie
Posts: 30
Joined: Tue Sep 17, 2013 12:00 am

Re: TeeCHart Display problem for Xamarin.iOS

Post by JAP » Wed Apr 16, 2014 3:36 am

Hello,

so, if I understand, you need to open a new View, in landscape mode and be able to show the Chart as a client or at specific position, isn't it ?
I'm asking to you in order to prepare a code that does that.
No Sir, I have no problem in the orientation since I set it to only support lanscape mode. The chart is misplaced :)

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: TeeCHart Display problem for Xamarin.iOS

Post by Pep » Wed Apr 16, 2014 8:35 am

Hello,

ok, would you be so kind to post here the lines of code that shows how you're adding the Chart to the View (or into the UIImageView) ? You should take the ImageView Frame as reference to set the TChart frame.

Post Reply