Minor fixes with zoom methods
This commit is contained in:
parent
2dd9d5aa34
commit
9028b5613b
2 changed files with 15 additions and 12 deletions
|
@ -327,9 +327,9 @@ public class LineChartActivity2 extends DemoBase implements OnSeekBarChangeListe
|
|||
public void onValueSelected(Entry e, int dataSetIndex, Highlight h) {
|
||||
Log.i("Entry selected", e.toString());
|
||||
|
||||
//mChart.centerViewToAnimated(e.getXIndex(), e.getVal(), mChart.getData().getDataSetByIndex(dataSetIndex).getAxisDependency(), 1000);
|
||||
mChart.centerViewToAnimated(e.getXIndex(), e.getVal(), mChart.getData().getDataSetByIndex(dataSetIndex).getAxisDependency(), 500);
|
||||
//mChart.zoomAndCenterAnimated(2.5f, 2.5f, e.getXIndex(), e.getVal(), mChart.getData().getDataSetByIndex(dataSetIndex).getAxisDependency(), 1000);
|
||||
mChart.zoomAndCenterAnimated(1.8f, 1.8f, e.getXIndex(), e.getVal(), mChart.getData().getDataSetByIndex(dataSetIndex).getAxisDependency(), 1000);
|
||||
//mChart.zoomAndCenterAnimated(1.8f, 1.8f, e.getXIndex(), e.getVal(), mChart.getData().getDataSetByIndex(dataSetIndex).getAxisDependency(), 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -658,8 +658,11 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
* Zooms in by 1.4f, into the charts center. center.
|
||||
*/
|
||||
public void zoomIn() {
|
||||
Matrix save = mViewPortHandler.zoomIn(getWidth() / 2f, -(getHeight() / 2f));
|
||||
mViewPortHandler.refresh(save, this, true);
|
||||
|
||||
PointF center = mViewPortHandler.getContentCenter();
|
||||
|
||||
Matrix save = mViewPortHandler.zoomIn(center.x, -center.y);
|
||||
mViewPortHandler.refresh(save, this, false);
|
||||
|
||||
// Range might have changed, which means that Y-axis labels
|
||||
// could have changed in size, affecting Y-axis size.
|
||||
|
@ -672,8 +675,11 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
* Zooms out by 0.7f, from the charts center. center.
|
||||
*/
|
||||
public void zoomOut() {
|
||||
Matrix save = mViewPortHandler.zoomOut(getWidth() / 2f, -(getHeight() / 2f));
|
||||
mViewPortHandler.refresh(save, this, true);
|
||||
|
||||
PointF center = mViewPortHandler.getContentCenter();
|
||||
|
||||
Matrix save = mViewPortHandler.zoomOut(center.x, -center.y);
|
||||
mViewPortHandler.refresh(save, this, false);
|
||||
|
||||
// Range might have changed, which means that Y-axis labels
|
||||
// could have changed in size, affecting Y-axis size.
|
||||
|
@ -693,7 +699,7 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
*/
|
||||
public void zoom(float scaleX, float scaleY, float x, float y) {
|
||||
Matrix save = mViewPortHandler.zoom(scaleX, scaleY, x, -y);
|
||||
mViewPortHandler.refresh(save, this, true);
|
||||
mViewPortHandler.refresh(save, this, false);
|
||||
|
||||
// Range might have changed, which means that Y-axis labels
|
||||
// could have changed in size, affecting Y-axis size.
|
||||
|
@ -704,7 +710,7 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
|
||||
/**
|
||||
* Zooms in or out by the given scale factor.
|
||||
* x and y are the values to or which to zoom from (the values of the zoom center).
|
||||
* x and y are the values (NOT PIXELS) to or which to zoom from (the values of the zoom center).
|
||||
*
|
||||
* @param scaleX
|
||||
* @param scaleY
|
||||
|
@ -742,11 +748,8 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
*/
|
||||
public void fitScreen() {
|
||||
Matrix save = mViewPortHandler.fitScreen();
|
||||
mViewPortHandler.refresh(save, this, true);
|
||||
mViewPortHandler.refresh(save, 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();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue