Scrolling for Xamarin/iOS

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
theyield
Newbie
Newbie
Posts: 16
Joined: Thu Sep 22, 2016 12:00 am

Scrolling for Xamarin/iOS

Post by theyield » Sun Oct 09, 2016 11:08 pm

Hi All,

I need to control scrolling for my app written in Xamarin/iOS.
Reading other forum entries, I guess, I need to access the TChartScrollBar in order to set min/max.
Based on some examples in the forum, you can access hScrollBar via Xaml. However I don't know how to do that with Xamarin/iOS.

Can someone tell me please how to control scrolling min/max for Xamarin/iOS apps?

Thanks
--maX

theyield
Newbie
Newbie
Posts: 16
Joined: Thu Sep 22, 2016 12:00 am

Re: Scrolling for Xamarin/iOS

Post by theyield » Tue Oct 11, 2016 9:10 pm

HI Steema Support,

Can you tell me how to get hscrollBar in Xamarin/iOS?

In many samples, see below, you mention 'hscrollBar' but could not find anywhere in your documentation where you get this reference initialised.

void tChart1_AfterDraw(object sender, Steema.TeeChart.WPF.Drawing.Graphics3D g)
{
tChart1.Axes.Bottom.SetMinMax(tChart1[0].XValues[0], tChart1[0].XValues[50]);
hscrollBar.Minimum = 0;
hscrollBar.Maximum = 100;
value = tChart1.Axes.Bottom.Minimum + ((tChart1.Axes.Bottom.Maximum - tChart1.Axes.Bottom.Minimum) / 2);

AxisMin = hscrollBar.Minimum;
AxisMax = hscrollBar.Maximum;
}

Thanks
--maX

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Scrolling for Xamarin/iOS

Post by Christopher » Thu Oct 13, 2016 7:25 am

Hello maX,

Many apologies for the delay in response to your questions. Yesterday was a national holiday here, and the developer responsible for Xamarin.iOS is on annual leave this week. We will try and get a response to you as quickly as possible.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

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

Re: Scrolling for Xamarin/iOS

Post by Pep » Thu Oct 13, 2016 9:55 am

Hello maX,

you've two ways to add horizontal scroll to the Chart. You can always set a value to MaxPointsPerPage property, this will automatically separate the number of points by different pages allowing to scroll by panning, or by using specific buttons to call for previous or next page. The code to use it :

Code: Select all

            Chart.Panning.Allow = ScrollModes.Horizontal;
           // Scroll by points per page....
           Chart.Page.MaxPointsPerPage = 10;
The other way would be to use an UISlider control to manage the min and max bottom axis values. You'd have to use code similar to the following one :

Code: Select all

            // Number of points is 100
            // Scroll by using UISlider and SetMinMax
            Chart.Panel.MarginBottom += 10;
            Chart.Axes.Bottom.SetMinMax(0, 10);
            UISlider slider1 = new UISlider(new CoreGraphics.CGRect(0,this.View.Frame.Height - 25,this.View.Frame.Width, 20));
            slider1.MinValue = 5;
            slider1.MaxValue = 95;
            slider1.Value = 5.0f; // the current value
            slider1.ValueChanged += (sender, e) => Chart.Axes.Bottom.SetMinMax(((UISlider)sender).Value - 5, ((UISlider)sender).Value + 5);
            
            // Finally adding the Chart View as SubView to the parent View
            View.AddSubview(Chart);
            View.AddSubview(slider1);

Post Reply