I've implemented a line chart from mp chart android but the thing is there are two buttons full view and a yearly view, in full view, I'm setting zoom to x 0,y 0. but in yearly view, I am zooming in the graph. this is working fine but the problem is when I scroll the graph and press the button full view while the graph is scrolling zooming out does not work. but when the graph scrolls idle both yearly and full-view functionalities are working fine.
private void changeSelectionOfView(int i) {
switch (i) {
case 1:
txvFullView.setTextColor(ContextCompat.getColor(requireContext(), R.color.Pennyworthgray1));
txvYearly.setTextColor(ContextCompat.getColor(requireContext(), R.color.white));
lineChart.zoom(10f, 1, hightligh.getX(), hightligh.getY(), YAxis.AxisDependency.LEFT);
llYearly.setBackground(ContextCompat.getDrawable(requireContext(), R.drawable.primary_btnn_shape_app_generic_selected));
llFullView.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.white));
if (popupWindow != null && popupWindow.isShowing()) {
popupWindow.dismiss();
}
break;
case 2:
txvFullView.setTextColor(ContextCompat.getColor(requireContext(), R.color.white));
txvYearly.setTextColor(ContextCompat.getColor(requireContext(), R.color.Pennyworthgray1));
llFullView.setBackground(ContextCompat.getDrawable(requireContext(), R.drawable.primary_btnn_shape_app_generic_selected));
llYearly.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.white));
lineChart.fitScreen();
// lineChart.zoomToCenter(0, 0);
if (popupWindow != null && popupWindow.isShowing()) {
popupWindow.dismiss();
}
break;
}
lineChart.invalidate();
}
this is the code i'm using case 1 is for yearly view and case 2 is for full view. i've tried fit screen but it does not work either.