我想在更新图表时取消自动调整,并获得“移动”图表的效果(当我添加新数据时),而不进行缩放。我希望你知道我想要达到的目标。
这是我的代码片段,我在其中声明了我的图表:
mDataset = new XYMultipleSeriesDataset();
mRenderer = new XYMultipleSeriesRenderer();
mRenderer.setAxesColor(Color.BLUE);
mRenderer.setAxisTitleTextSize(16);
mRenderer.setChartTitle("Accelerometer monitor");
mRenderer.setChartTitleTextSize(15);
mRenderer.setFitLegend(true);
mRenderer.setGridColor(Color.LTGRAY);
mRenderer.setPanEnabled(true, false);
mRenderer.setZoomEnabled(false, true);
mRenderer.setPointSize(1);
mRenderer.setXTitle("Time");
mRenderer.setYTitle("Value");
mRenderer.setMargins(new int []{20, 30, 15, 0});
mRenderer.setZoomButtonsVisible(true);
mRenderer.setBarSpacing(10);
mRenderer.setShowGrid(true);
mSeriesRendererX = new XYSeriesRenderer();
mSeriesRendererX.setColor(Color.RED);
mSeriesRendererY = new XYSeriesRenderer();
mSeriesRendererY.setColor(Color.GREEN);
mSeriesRendererZ = new XYSeriesRenderer();
mSeriesRendererZ.setColor(Color.BLUE);
mRenderer.addSeriesRenderer(mSeriesRendererX);
mRenderer.addSeriesRenderer(mSeriesRendererY);
mRenderer.addSeriesRenderer(mSeriesRendererZ);
mSeriesRendererX.setFillPoints(true);
mSeriesRendererX.setPointStyle(PointStyle.CIRCLE);
mSeriesRendererY.setFillPoints(true);
mSeriesRendererY.setPointStyle(PointStyle.CIRCLE);
mSeriesRendererZ.setFillPoints(true);
mSeriesRendererZ.setPointStyle(PointStyle.CIRCLE);
mTimeSeriesX = new TimeSeries("x");
mTimeSeriesY = new TimeSeries("y");
mTimeSeriesZ = new TimeSeries("z");
答案 0 :(得分:0)
您可以通过手动设置轴上的可见范围来控制缩放:
mRenderer.setXAxisMin(xMinValue);
mRenderer.setXAxisMax(xMaxValue);
mRenderer.setYAxisMin(yMinValue);
mRenderer.setYAxisMax(yMaxValue);