Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable click on chart

I am using multiple mpandroidchart in a scrollview with a linearlayout.

The thing is is i want to disable any kind of horizontal/verical scrolling in the charts because that causes problem when i'm scrolling down to next chart. I've tried setting the clickable attribute to false but that doesn't help. Is there any method in the library to disable any kind of touch event on chart? I would like it to be fully static.

like image 930
div Avatar asked Mar 15 '16 05:03

div


1 Answers

Use the OnChartGestureListener from library : OnChartGestureListener.

Enabling / disabling interaction

  • setTouchEnabled(boolean enabled): Allows to enable/disable all possible touch-interactions with the chart.
  • setDragEnabled(boolean enabled): Enables/disables dragging (panning) for the chart.
  • setScaleEnabled(boolean enabled): Enables/disables scaling for the chart on both axes.
  • setScaleXEnabled(boolean enabled): Enables/disables scaling on the x-axis.
  • setScaleYEnabled(boolean enabled): Enables/disables scaling on the y-axis.
  • setPinchZoom(boolean enabled): If set to true, pinch-zooming is enabled. If disabled, x- and y-axis can be zoomed separately.

and many more...

Please check this answer Disable OnClickListener while scaling or dragging a View.

like image 156
Amit Vaghela Avatar answered Nov 05 '22 06:11

Amit Vaghela