Page 1 of 1

Horizontal Scrolling and Overflow

Posted: Thu Sep 01, 2016 11:46 am
by 17879005
Hi I'm hoping anyone can help me.

I have created a chart with three bars and I'm displaying a number of grouped data into the three bars. Right now I'm able to show this graph:

Image

Based on the documentations, scrolling in both directions is there by default however I am unable to scroll the data both vertically and horizontally. The chart is trying to fit everything on the frame.

Is there away to not let the chart fit all the data in the frame and just let it overflow horizontally and most importantly allow the user to scroll horizontally?

Please see my code:

Code: Select all

private void SetupChart ()
{
	_chart = new TChart();
	_chart.Header.Visible = false;
	_chart.Frame = new CGRect(0, 0,
	                          GraphContainer.Frame.Size.Width, 
	                          GraphContainer.Frame.Size.Height);
	GraphContainer.AddSubview(_chart);


	bar1 = new Bar();
	bar1.Title = "Oranges";
	bar1.Marks.Visible = false;

	bar2 = new Bar();
	bar2.Title = "Apples";
	bar2.Marks.Visible = false;

	bar3 = new Bar();
	bar3.Title = "Grand Total";
	bar3.Marks.Visible = false;

	_chart.Series.Add(bar1);
	_chart.Series.Add(bar2);
	_chart.Series.Add(bar3);

	_chart.Legend.CheckBoxes = true;
	_chart.Axes.Left.Grid.Visible = false;
	_chart.Legend.Alignment = LegendAlignments.Bottom;
	_chart.Legend.MaxNumRows = 3;
	_chart.Zoom.Active = true;
	_chart.Panning.Allow = ScrollModes.None;
	_chart.Zoom.Direction = ZoomDirections.Horizontal;

	/ Add data
	foreach(Data d in _datas)
	{
		_bar1.Add(d.Orange, d.VendorName);
		_bar2.Add(d.Apple, d.VendorName);
		_bar3.Add(d.Orange + d.Apple, d.VendorName);
	}
}
I tried looking over the samples inside the source codes, however the samples there are too simple and too few.

Hope somebody can help or just point me to the right direction

Thanks! :D

Re: Horizontal Scrolling and Overflow

Posted: Thu Sep 01, 2016 12:39 pm
by Pep
Hello,

sure, notice that in the code you've set :

Code: Select all

   _chart.Panning.Allow = ScrollModes.None;
   _chart.Zoom.Direction = ZoomDirections.Horizontal;
In order to allow the user just to scroll horizontally you should do :

Code: Select all

            tChart1.Panning.Active = true;
            tChart1.Panning.Allow = ScrollModes.Horizontal;
In the case you want to show just some part of data in the frame you can set a specific points per page number, or set the desired min and max by using the following code :

Code: Select all

           tChart1.Page.MaxPointsPerPage = 10;
           // or
           tChart1.Axes.Bottom.SetMinMax(10, 20);

Re: Horizontal Scrolling and Overflow

Posted: Fri Sep 02, 2016 2:35 am
by 17879005
Hi was able to limit data by applying the code you gave:

Code: Select all

           
tChart1.Page.MaxPointsPerPage = 10;
// or
tChart1.Axes.Bottom.SetMinMax(10, 20);
and also applied:

Code: Select all

tChart1.Panning.Active = true;
tChart1.Panning.Allow = ScrollModes.Horizontal;
Although it is correctly showing me the correct number of data in 1 page.. I'm still unable to scroll horizontally to the next page.

Do I need to handle scrolling to the next and previous pages manually?

Re: Horizontal Scrolling and Overflow

Posted: Fri Sep 02, 2016 6:17 am
by Pep
Which TeeChart version are you using, TeeChart for Xamarin.Forms or TeeChart for Xamarin.iOS?
Does this happens with the latest version available on our website?

Re: Horizontal Scrolling and Overflow

Posted: Fri Sep 02, 2016 7:40 am
by 17879005
I am using the latest version of Xamarin.iOS

Re: Horizontal Scrolling and Overflow

Posted: Fri Sep 02, 2016 8:47 am
by Pep
Hello,

it's strange. I've just test it here and all seems to work fine.
Could you please check if the attached example is working fine for you ? It's a simple example which uses horizontal panning with points per page.

Re: Horizontal Scrolling and Overflow

Posted: Sat Sep 03, 2016 4:02 am
by 17879005
HI I run the project you gave me both on iPhone 6s Simulator 9.3 and actual iPhone 6s device with iOS 9.3

Both are not panning horizontally (left or right).

Please see screen recording https://www.dropbox.com/s/bs1p1mfsydi07 ... g.mov?dl=0

My version of TeeChart as written in the release notes:

Release Notes 20th Jun 2016
TeeChart.NET for iOS version 2016
Build 4.16.06.20

Re: Horizontal Scrolling and Overflow

Posted: Mon Sep 05, 2016 10:24 am
by Pep
Hi,

ok, I'm going to prepare a new dll compiled and send it directly to you so you can check if the problem persists with that one. I'll send it directly to your email account.

Re: Horizontal Scrolling and Overflow

Posted: Tue Sep 06, 2016 5:44 am
by 17879005
Hi,

I have compiled the project that you gave me with the dll you sent and is now working fine. My original project is also now running ok with the new dll.

Thank you so much for your help. I'm not sure why the version I downloaded from your is not working as expected. Maybe I'll try out other versions later.

Again, thank you!

Cheers!