Hi Carmen,
Thank you for your question.
The Chart has a ChartPanZoomBehaviorwhich allows you to zoom and or pan across the chart data if it is too big to fit. Additionally the chart has a setZoom method which allows you to programmatically zoom to a certain level. Here's an example:
Here the horizontal zoom is set to 5, since given that you want to display 20 out of 100 points. Depending on you requirements, you can set the zoom mode to none, if you don't want to allow users' zoom by gestures. Additionally to pan to the end on the initial load, you can use setPanOffset:
I hope this information helps.
Regards,
Todor
Telerik
Thank you for your question.
The Chart has a ChartPanZoomBehaviorwhich allows you to zoom and or pan across the chart data if it is too big to fit. Additionally the chart has a setZoom method which allows you to programmatically zoom to a certain level. Here's an example:
ChartPanAndZoomBehavior panAndZoomBehavior =
new
ChartPanAndZoomBehavior();
panAndZoomBehavior.setZoomMode(ChartPanZoomMode.HORIZONTAL);
panAndZoomBehavior.setPanMode(ChartPanZoomMode.HORIZONTAL);
chart.getBehaviors().add(panAndZoomBehavior);
chart.setZoom(5,1);
Here the horizontal zoom is set to 5, since given that you want to display 20 out of 100 points. Depending on you requirements, you can set the zoom mode to none, if you don't want to allow users' zoom by gestures. Additionally to pan to the end on the initial load, you can use setPanOffset:
chart.addOnLayoutChangeListener(
new
View.OnLayoutChangeListener() {
@Override
public
void
onLayoutChange(View v,
int
left,
int
top,
int
right,
int
bottom,
int
oldLeft,
int
oldTop,
int
oldRight,
int
oldBottom) {
chart.setPanOffset(-chart.getZoomWidth() * chart.getWidth(), 0);
}
});
I hope this information helps.
Regards,
Todor
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items