From Steema Software Reference Wiki
Jump to: navigation, search

Net android.png

TeeChart for Xamarin.Android basic design aspects.

Why TeeChart for Xamarin.Android is the way it is?
People looking at TeeChart for Xamarin.Android may wonder why the basic TeeChart.Android object (Steema.TeeChart.TChart) is a FrameLayout. This is a simple decision, Android.View, the simplest UI Android object that allows deriving a custom object where you can paint on it, doesn't allow child views. The simplest object to allow them is Androiw.View.ViewGroup, The ViewGroup subclass is the base class for layouts, which are invisible containers that hold other Views (or other ViewGroups) and define their layout properties. FrameLayout is a particular ViewGroup instance which supports using multiple child views in it being set at custom positions. Hence the decision to use FrameLayout against ViewGroup, which works better for ZoomStyles.FullChart and ZoomStyles.InChart options for TChart.Zoom.Style property.

An attempt was made to change from FrameLayout to ViewGroup but it broke mentioned ZoomStyles. An alternative implementation could also include deriving TeeBase from View. So it could be a View (TeeBase class) or ImageView (with zoom & scroll support) inside a ViewGroup (TChart class).

Finally, a ViewGroup derived object is also necessary to implement the real-time performance designed ZoomStyles.None option, which internally uses an Android SurfaceView object to repaint the chart as demoed in the Real-time Charting example included with the TeeChart for Xamarin.Android version.

Why are multiple child views necessary, you may wonder? Ok, the reason behind using multiple child views is to offer a multi-touch zooming and panning chart interactivity that not only scales and translates the entire chart but also does it with the different chart regions, something similar to what TeeChart does in desktop applications. That is, when you zoom a chart series, only the area in the chart where series are being rendered will be zoomed and panned, not the entire chart (axes, legend, title, etc.). That is using ZoomStyles.InChart. With ZoomStyles.FullChart, the entire chart is being scaled or translated.

Also, with the release of version on 26th July 2014, a new Zoom.Style option has been completed: ZoomStyles.Classic. It had been available for a while but its intended functionality hadn't been fully implemented. Until previous builds it allowed disabling touch zoom and scroll. Now it performs closer to TeeChart desktop versions, zooming and scrolling the chart rectangle area without scaling or translating an image but directly repainting the chart canvas accordingly and also doing the same for the axes. With a single touch and movement it will scroll the chart. With multi-touch and pinch gesture it will zoom the chart. And last but not the least, programmers can set whether they want to allow their charts to be zoomed, scrolled and in which directions (horizontal, vertical, both or none) they are interested in.