31

I want to disable pinch zoom at barchart in MPAndroidChart library how i can do that.

library.barchart.setpinzoomenable(false); 

also not working.

Jaydip
  • 592
  • 5
  • 27
Hari
  • 490
  • 1
  • 4
  • 12

5 Answers5

86

Try this,

Disable all zooming:

chart.setScaleEnabled(false);

More info refer here

Sathish Kumar J
  • 4,280
  • 1
  • 20
  • 48
3

Marker will continue to work but zoom will be disable

chart.setTouchEnabled(true)
chart.setPinchZoom(false)
chart.isDoubleTapToZoomEnabled = false
Crebain
  • 180
  • 1
  • 8
1

Try below:

  library.barchart.setPinchZoom(false);
Dhruvi
  • 1,971
  • 2
  • 10
  • 18
1
    fragmentHomeBinding.lineChart.setTouchEnabled(true);
    fragmentHomeBinding.lineChart.setDragEnabled(true);
    fragmentHomeBinding.lineChart.setScaleXEnabled(true);
    fragmentHomeBinding.lineChart.setScaleYEnabled(false);
    fragmentHomeBinding.lineChart.setPinchZoom(false);
    fragmentHomeBinding.lineChart.setDoubleTapToZoomEnabled(false);

In above code, I have enabled scaling in X-axis and disabled in Y-axis.

Khyati Vara
  • 1,042
  • 13
  • 22
0

Since no one has included anything about axis wise scaling after turning off zooming (as per the latest library), the following lines will disable pinch to zoom as well as x,y-scaling whatsoever:

barChart.setPinchZoom(false)
barChart.setScaleEnabled(false)
Yash Joshi
  • 557
  • 7
  • 25