Android 如何提高实时绘图的电池消耗?

Android 如何提高实时绘图的电池消耗?,android,plot,battery,Android,Plot,Battery,我正在构建一个android应用程序,它在一个线条图上绘制一个信号,用于实时数据输出,显示过去的10秒。在onDraw()中调用drawSeries(),并将所有系列打印到画布上。有没有办法提高电池寿命,这样每次重画时就不必绘制所有数据点 private void drawSeries(Canvas canvas) { float x1Plot = getPxForDP(30); float y1Plot = getPxForDP(9); float x2Plot = g

我正在构建一个android应用程序,它在一个线条图上绘制一个信号,用于实时数据输出,显示过去的10秒。在onDraw()中调用drawSeries(),并将所有系列打印到画布上。有没有办法提高电池寿命,这样每次重画时就不必绘制所有数据点

private void drawSeries(Canvas canvas) {
    float x1Plot = getPxForDP(30);
    float y1Plot = getPxForDP(9);
    float x2Plot = getWidth() - getPxForDP(5);
    float y2Plot = getHeight() - getPxForDP(24);

    long now = System.currentTimeMillis();
    float dx = x2Plot - x1Plot;
    float dy = y2Plot - y1Plot;

    for (GraphSeries gs : series) {
        GraphPoint gpPrev = null;
        if (gs.dataList.size() > 0) {
            for (int i = gs.dataList.size() - 1; i > -1; i--) {
                GraphPoint gp = gs.dataList.get(i);
                if (gpPrev != null) {
                    if ((gpPrev.timestamp - now) / 1000 >= xMin) {
                        float x1 = x2Plot + (gpPrev.timestamp - now) / 1000F / (xMax - xMin) * dx;
                        float x2 = x2Plot + (gp.timestamp - now) / 1000F / (xMax - xMin) * dx;
                        float y1 = Math.min(Math.max(yMax - gpPrev.value, yMin), yMax) / (yMax - yMin) * dy + y1Plot;
                        float y2 = Math.min(Math.max(yMax - gp.value, yMin), yMax) / (yMax - yMin) * dy + y1Plot;
                        canvas.drawLine(x1, y1, x2, y2, gs.paint);
                    }
                }
                gpPrev = gp;
            }
        }
    }
}
我正在考虑缓存一个线条位图并对其进行翻译,但我真的不知道该怎么做

谢谢你的时间