Graph visible outside X and Y axis
I am using achartengine for data that my application is continuously
receiving over a socket connection. The point are plotted against time
which is my x axis. Once the graph is in place a user can pan and zoom on
the graph. Everything is buttery smooth. The only problem is that when the
user zooms the graph, portions of the graph is also visible on the other
side of x and y axis.
How do i restrict the graph from being visible outside the X and Y axis?
Here is a portion of my code.
XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
renderer.setChartTitleTextSize(12);
renderer.setLabelsTextSize(15);
renderer.setMarginsColor(Color.argb(0x00, 0x01, 0x01, 0x01));
renderer.setApplyBackgroundColor(true);
renderer.setBackgroundColor(Color.TRANSPARENT);
renderer.setZoomEnabled(true, true);
renderer.setPointSize(5f);
renderer.setShowGrid(true);
renderer.setXTitle(xTitle);
renderer.setYTitle(yTitle);
renderer.setLabelsColor(getResources().getColor(R.color.black));
renderer.setXLabelsColor(getResources().getColor(R.color.black));
renderer.setYLabelsColor(0, getResources().getColor(R.color.black));
renderer.setDisplayValues(true);
renderer.setSelectableBuffer(20);
renderer.setShowLegend(false);
renderer.setRange(new double[] { timeSeriesChart.getMinX(),
timeSeriesChart.getMaxX(), 0/* minY */, maxY });
renderer.setPanLimits(getChartLimit(
isTimeChart, timeSeriesChart.getMinX(), timeSeriesChart.getMaxX(),
(maxY*-1)+timeSeriesChart.getMinY(),
maxY));
No comments:
Post a Comment