9

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.

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
div
  • 1,475
  • 3
  • 22
  • 32

1 Answers1

44

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.

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142