/** * Resets all custom offsets set via setViewPortOffsets(...) method. Allows * the chart to again calculate all offsets automatically. */ public void resetViewPortOffsets() { mCustomViewPortEnabled = false; calculateOffsets(); }
@Override public void onAnimationEnd(Animator animation) { ((BarLineChartBase) view).calculateOffsets(); view.postInvalidate(); }
/** * Zooms out to original size. */ public void resetZoom() { mViewPortHandler.resetZoom(mZoomMatrixBuffer); mViewPortHandler.refresh(mZoomMatrixBuffer, this, false); // Range might have changed, which means that Y-axis labels // could have changed in size, affecting Y-axis size. // So we need to recalculate offsets. calculateOffsets(); postInvalidate(); }
/** * Resets all zooming and dragging and makes the chart fit exactly it's * bounds. */ public void fitScreen() { Matrix save = mFitScreenMatrixBuffer; mViewPortHandler.fitScreen(save); mViewPortHandler.refresh(save, this, false); calculateOffsets(); postInvalidate(); }
/** * Zooms in or out by the given scale factor. x and y are the coordinates * (in pixels) of the zoom center. * * @param scaleX if < 1f --> zoom out, if > 1f --> zoom in * @param scaleY if < 1f --> zoom out, if > 1f --> zoom in * @param x * @param y */ public void zoom(float scaleX, float scaleY, float x, float y) { mViewPortHandler.zoom(scaleX, scaleY, x, -y, mZoomMatrixBuffer); mViewPortHandler.refresh(mZoomMatrixBuffer, this, false); // Range might have changed, which means that Y-axis labels // could have changed in size, affecting Y-axis size. // So we need to recalculate offsets. calculateOffsets(); postInvalidate(); }
/** * Zooms out by 0.7f, from the charts center. */ public void zoomOut() { MPPointF center = mViewPortHandler.getContentCenter(); mViewPortHandler.zoomOut(center.x, -center.y, mZoomMatrixBuffer); mViewPortHandler.refresh(mZoomMatrixBuffer, this, false); MPPointF.recycleInstance(center); // Range might have changed, which means that Y-axis labels // could have changed in size, affecting Y-axis size. // So we need to recalculate offsets. calculateOffsets(); postInvalidate(); }
/** * Zooms in by 1.4f, into the charts center. */ public void zoomIn() { MPPointF center = mViewPortHandler.getContentCenter(); mViewPortHandler.zoomIn(center.x, -center.y, mZoomMatrixBuffer); mViewPortHandler.refresh(mZoomMatrixBuffer, this, false); MPPointF.recycleInstance(center); // Range might have changed, which means that Y-axis labels // could have changed in size, affecting Y-axis size. // So we need to recalculate offsets. calculateOffsets(); postInvalidate(); }
@Override public void notifyDataSetChanged() { if (mData == null) { if (mLogEnabled) Log.i(LOG_TAG, "Preparing... DATA NOT SET."); return; } else { if (mLogEnabled) Log.i(LOG_TAG, "Preparing..."); } if (mRenderer != null) mRenderer.initBuffers(); calcMinMax(); mAxisRendererLeft.computeAxis(mAxisLeft.mAxisMinimum, mAxisLeft.mAxisMaximum, mAxisLeft.isInverted()); mAxisRendererRight.computeAxis(mAxisRight.mAxisMinimum, mAxisRight.mAxisMaximum, mAxisRight.isInverted()); mXAxisRenderer.computeAxis(mXAxis.mAxisMinimum, mXAxis.mAxisMaximum, false); if (mLegend != null) mLegendRenderer.computeLegend(mData); calculateOffsets(); }
mChart.calculateOffsets(); mChart.postInvalidate();
mChart.calculateOffsets(); mChart.postInvalidate();
@Override public void run() { Matrix save = mRunMatrixBuffer; mViewPortHandler.zoom(scaleX, scaleY, save); mViewPortHandler.refresh(save, view, false); float yValsInView = ((BarLineChartBase) view).getAxis(axisDependency).mAxisRange / mViewPortHandler.getScaleY(); float xValsInView = ((BarLineChartBase) view).getXAxis().mAxisRange / mViewPortHandler.getScaleX(); pts[0] = xValue - xValsInView / 2f; pts[1] = yValue + yValsInView / 2f; mTrans.pointValuesToPixel(pts); mViewPortHandler.translate(pts, save); mViewPortHandler.refresh(save, view, false); ((BarLineChartBase) view).calculateOffsets(); view.postInvalidate(); recycleInstance(this); }
/** * Performs auto scaling of the axis by recalculating the minimum and maximum y-values based on the entries currently in view. */ protected void autoScale() { final float fromX = getLowestVisibleX(); final float toX = getHighestVisibleX(); mData.calcMinMaxY(fromX, toX); mXAxis.calculate(mData.getXMin(), mData.getXMax()); // calculate axis range (min / max) according to provided data if (mAxisLeft.isEnabled()) mAxisLeft.calculate(mData.getYMin(AxisDependency.LEFT), mData.getYMax(AxisDependency.LEFT)); if (mAxisRight.isEnabled()) mAxisRight.calculate(mData.getYMin(AxisDependency.RIGHT), mData.getYMax(AxisDependency.RIGHT)); calculateOffsets(); }
/** * Resets all custom offsets set via setViewPortOffsets(...) method. Allows * the chart to again calculate all offsets automatically. */ public void resetViewPortOffsets() { mCustomViewPortEnabled = false; calculateOffsets(); }
@Override public void onAnimationEnd(Animator animation) { ((BarLineChartBase) view).calculateOffsets(); view.postInvalidate(); }
@Override public void onAnimationEnd(Animator animation) { ((BarLineChartBase) view).calculateOffsets(); view.postInvalidate(); }
/** * Resets all zooming and dragging and makes the chart fit exactly it's * bounds. */ public void fitScreen() { Matrix save = mFitScreenMatrixBuffer; mViewPortHandler.fitScreen(save); mViewPortHandler.refresh(save, this, false); calculateOffsets(); postInvalidate(); }
/** * Zooms out to original size. */ public void resetZoom() { mViewPortHandler.resetZoom(mZoomMatrixBuffer); mViewPortHandler.refresh(mZoomMatrixBuffer, this, false); // Range might have changed, which means that Y-axis labels // could have changed in size, affecting Y-axis size. // So we need to recalculate offsets. calculateOffsets(); postInvalidate(); }
/** * Zooms out to original size. */ public void resetZoom() { mViewPortHandler.resetZoom(mZoomMatrixBuffer); mViewPortHandler.refresh(mZoomMatrixBuffer, this, false); // Range might have changed, which means that Y-axis labels // could have changed in size, affecting Y-axis size. // So we need to recalculate offsets. calculateOffsets(); postInvalidate(); }
/** * Resets all zooming and dragging and makes the chart fit exactly it's * bounds. */ public void fitScreen() { Matrix save = mFitScreenMatrixBuffer; mViewPortHandler.fitScreen(save); mViewPortHandler.refresh(save, this, false); calculateOffsets(); postInvalidate(); }
/** * Resets all zooming and dragging and makes the chart fit exactly it's * bounds. */ public void fitScreen() { Matrix save = mFitScreenMatrixBuffer; mViewPortHandler.fitScreen(save); mViewPortHandler.refresh(save, this, false); calculateOffsets(); postInvalidate(); }