Gem
Gem

Reputation: 1606

Performance issue after disable panning in AchartEngine

I have a simple non scrollable xy line chart. I am showing a timer on the top of graph which updates after every millisecond.

I have disabled graph scrolling and click events by using following functions:

renderer.setClickEnabled(false);
renderer.setPanEnabled(false, false);

Every thing works fine but it look like the graph still consuming touch events. When user touch or try to scroll the graph the timer running on the top flickers. This gives an impression that the app is hanging a bit. The timer lost its smoothness when we touch the graph. In untouched position it runs very smoothly. Here is my renderer settings.

renderer.setXLabels(0);
renderer.setYLabels(0);
renderer.setRange(new double[]{5,10,15,20,25,30});
renderer.setShowGrid(false);
renderer.setXLabelsAlign(Align.RIGHT);
renderer.setYLabelsAlign(Align.RIGHT);
renderer.setZoomButtonsVisible(false);
renderer.setClickEnabled(false);
renderer.setPanEnabled(false, false);
renderer.setBackgroundColor(Color.argb(0, 0, 0, 0));
renderer.setMarginsColor(Color.argb(0, 0, 0, 0));
renderer.setYTitle(yTitle);
renderer.setTextTypeface(null, Typeface.BOLD);
renderer.setXAxisMin(xMin);
renderer.setXAxisMax(xMax);
renderer.setYAxisMin(yMin);
renderer.setYAxisMax(yMax);
renderer.setTextTypeFace(FontManager.getInstance(context).getTypeface("HelveticaLTStd-BoldCond.otf"));
renderer.setAxesColor(Color.parseColor(context.getString(R.color.gray_for_axis_color)));
renderer.setLabelsColor(Color.parseColor(context.getString(R.color.yellow)));
renderer.setAntialiasing(true);
renderer.setShowGridY(true);
renderer.setShowLegend(false);
renderer.setMargins(new int[]{0,30,0,12});
renderer.setXLabelsColor(Color.parseColor(context.getString(R.color.yellow)));
renderer.addTextLabel(1, "");
renderer.addTextLabel(2, "10 \nMin");
renderer.addTextLabel(3, "");
renderer.addTextLabel(4, "20 \nMin");
renderer.addTextLabel(5, "");
renderer.addTextLabel(6, "30 \nMin");
renderer.addTextLabel(7, "");
renderer.addTextLabel(8, "40 \nMin");
renderer.addTextLabel(9, "");
renderer.addTextLabel(10, "50 \nMin");
renderer.addTextLabel(11, "");
renderer.addTextLabel(12, "60 \nMin");

Upvotes: 2

Views: 1018

Answers (1)

Dan D.
Dan D.

Reputation: 32391

You may want to disable pinch zoom as well:

renderer.setZoomEnabled(false, false);

Upvotes: 1

Related Questions