1

我想在更新图表期间取消自动缩放并获得“移动”图表(当我添加新数据时)而不缩放它的效果。我希望你知道我想要达到的目标。

这是我声明图表的一段代码:

    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");
4

1 回答 1

0

您可以通过手动设置轴上的可见范围来控制缩放:

mRenderer.setXAxisMin(xMinValue);
mRenderer.setXAxisMax(xMaxValue);
mRenderer.setYAxisMin(yMinValue);
mRenderer.setYAxisMax(yMaxValue);
于 2012-11-04T16:18:44.303 回答