Hello.
Tell me how to get the items that are currently displayed on the chart after zooming and scrolling?
I use custom renderer to get native control and handle pan and zoom events using PanZoomListener, but in the handler I can only get relative offset.
here is my renderer
class ChartPointRenderer : CartesianChartRenderer
{
public ChartPointRenderer(Context context) :base(context)
{
}
protected override RadCartesianChartView CreateNativeControl()
{
Control = base.CreateNativeControl();
return Control;
}
protected override void OnAttachedToWindow()
{
base.OnAttachedToWindow();
var beh = Control.Behaviors.ToArray();
for (int j = 0; j < beh.Length; j++)
{
if (beh[j].GetType() == typeof(Telerik.XamarinForms.ChartRenderer.Android.AndroidChartPanAndZoomBehavior))
{
var zoomBehavior = (Telerik.XamarinForms.ChartRenderer.Android.AndroidChartPanAndZoomBehavior)beh[j];
zoomBehavior.AddPanZoomListener(new Listeners.ChartPanZoomListener());
}
}
}
}
and listener
public class ChartPanZoomListener :Java.Lang.Object, IPanZoomListener
{
public IntPtr Handle => throw new NotImplementedException();
public void OnPan(double p0, double p1)
{
//do something
}
public void OnZoom(double p0, double p1)
{
//do something
}
}
Tell me how to get the items that are currently displayed on the chart after zooming and scrolling?
I use custom renderer to get native control and handle pan and zoom events using PanZoomListener, but in the handler I can only get relative offset.
here is my renderer
class ChartPointRenderer : CartesianChartRenderer
{
public ChartPointRenderer(Context context) :base(context)
{
}
protected override RadCartesianChartView CreateNativeControl()
{
Control = base.CreateNativeControl();
return Control;
}
protected override void OnAttachedToWindow()
{
base.OnAttachedToWindow();
var beh = Control.Behaviors.ToArray();
for (int j = 0; j < beh.Length; j++)
{
if (beh[j].GetType() == typeof(Telerik.XamarinForms.ChartRenderer.Android.AndroidChartPanAndZoomBehavior))
{
var zoomBehavior = (Telerik.XamarinForms.ChartRenderer.Android.AndroidChartPanAndZoomBehavior)beh[j];
zoomBehavior.AddPanZoomListener(new Listeners.ChartPanZoomListener());
}
}
}
}
and listener
public class ChartPanZoomListener :Java.Lang.Object, IPanZoomListener
{
public IntPtr Handle => throw new NotImplementedException();
public void OnPan(double p0, double p1)
{
//do something
}
public void OnZoom(double p0, double p1)
{
//do something
}
}