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
Make sure you are using the correct
setZoomEnabledmethod. For theXYChartcharts likeBarChart,LineChart,… it is: