Desactivar panding en achart engine android

I'm using the achartengine to draw chart on Adnroid application, so when i call the method "getBarChartView" to create a view and add it to a RelativeLayout.

In settings i added this

public GraphicalView createChartView() {

    XYMultipleSeriesRenderer renderer = buildBarRenderer(mColorBar);
        renderer.setOrientation(mOrientation);

        // settings the chart
        setChartSetting(renderer, mChartTitle, mXAxisTitle, mYAxisTitle,
                mXmin, mXmax, mYmin, mYmax, mAxesColor, mLabelColor,
                mGridColor, IChartInterface.ALIGN_CENTER,
                IChartInterface.ALIGN_RIGHT, mTopMargin, mLeftMargin,
                mBottomMargin, mRightMargin);

   // disable the pan
        renderer.setPanEnabled(false, false);
        renderer.setZoomEnabled(false);

        renderer.setShowGridX(isShowGridX);
        renderer.setShowGridY(isShowGridY);

        renderer.setZoomRate(mZoomRate);
        renderer.setBarSpacing(mBarSpacing);
    }

    return ChartFactory.getBarChartView(mContext,
                buildBarDataset(convertToString(mTitles), mValues),
                renderer, Type.STACKED);

}

But it doesn't work, i still can use two finger to pan it. so the chart's shape go to unexpectedness shape. Could anyone tell me why and how can i disable pan on the view?

Thanks for any helps Clark

preguntado el 28 de agosto de 12 a las 10:08

1 Respuestas

Asegúrese de que está utilizando el setZoomEnabled método. Para el XYChart charts like BarChart, LineChart,... it is:

renderer.setZoomEnabled(false, false);

Respondido 28 ago 12, 11:08

Thank you very much, Dan. It works like a charm. I thought setZoomEnabled(true) is enough to disable panding. - user1597721

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.