Page 1 of 1

Scrolling for Xamarin/iOS

Posted: Sun Oct 09, 2016 11:08 pm
by 17279216
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

Re: Scrolling for Xamarin/iOS

Posted: Tue Oct 11, 2016 9:10 pm
by 17279216
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

Re: Scrolling for Xamarin/iOS

Posted: Thu Oct 13, 2016 7:25 am
by Christopher
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.

Re: Scrolling for Xamarin/iOS

Posted: Thu Oct 13, 2016 9:55 am
by Pep
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);