com.github.mikephil.charting.jobs.AnimatedMoveViewJob Java Examples

The following examples show how to use com.github.mikephil.charting.jobs.AnimatedMoveViewJob. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BarLineChartBase.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
/**
 * This will move the center of the current viewport to the specified
 * x and y value animated.
 *
 * @param xValue
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void centerViewToAnimated(float xValue, float yValue, AxisDependency axis, long duration) {

    MPPointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

    float yInView = getAxisRange(axis) / mViewPortHandler.getScaleY();
    float xInView = getXAxis().mAxisRange / mViewPortHandler.getScaleX();

    Runnable job = AnimatedMoveViewJob.getInstance(mViewPortHandler,
            xValue - xInView / 2f, yValue + yInView / 2f,
            getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

    addViewportJob(job);

    MPPointD.recycleInstance(bounds);
}
 
Example #2
Source File: BarLineChartBase.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
/**
 * This will move the left side of the current viewport to the specified x-value
 * and center the viewport to the y value animated.
 * This also refreshes the chart by calling invalidate().
 *
 * @param xValue
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void moveViewToAnimated(float xValue, float yValue, AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        MPPointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float yInView = getAxisRange(axis) / mViewPortHandler.getScaleY();

        Runnable job = AnimatedMoveViewJob.getInstance(mViewPortHandler, xValue, yValue + yInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);

        MPPointD.recycleInstance(bounds);
    } else {
        Log.e(LOG_TAG, "Unable to execute moveViewToAnimated(...) on API level < 11");
    }
}
 
Example #3
Source File: BarLineChartBase.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
/**
 * This will move the center of the current viewport to the specified
 * x and y value animated.
 *
 * @param xValue
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void centerViewToAnimated(float xValue, float yValue, AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        MPPointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float yInView = getAxisRange(axis) / mViewPortHandler.getScaleY();
        float xInView = getXAxis().mAxisRange / mViewPortHandler.getScaleX();

        Runnable job = AnimatedMoveViewJob.getInstance(mViewPortHandler,
                xValue - xInView / 2f, yValue + yInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);

        MPPointD.recycleInstance(bounds);
    } else {
        Log.e(LOG_TAG, "Unable to execute centerViewToAnimated(...) on API level < 11");
    }
}
 
Example #4
Source File: BarLineChartBase.java    From android-kline with Apache License 2.0 6 votes vote down vote up
/**
 * This will move the left side of the current viewport to the specified x-value
 * and center the viewport to the y value animated.
 * This also refreshes the chart by calling invalidate().
 *
 * @param xValue
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void moveViewToAnimated(float xValue, float yValue, AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        MPPointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float yInView = getAxisRange(axis) / mViewPortHandler.getScaleY();

        Runnable job = AnimatedMoveViewJob.getInstance(mViewPortHandler, xValue, yValue + yInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);

        MPPointD.recycleInstance(bounds);
    } else {
        Log.e(LOG_TAG, "Unable to execute moveViewToAnimated(...) on API level < 11");
    }
}
 
Example #5
Source File: BarLineChartBase.java    From android-kline with Apache License 2.0 6 votes vote down vote up
/**
 * This will move the center of the current viewport to the specified
 * x and y value animated.
 *
 * @param xValue
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void centerViewToAnimated(float xValue, float yValue, AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        MPPointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float yInView = getAxisRange(axis) / mViewPortHandler.getScaleY();
        float xInView = getXAxis().mAxisRange / mViewPortHandler.getScaleX();

        Runnable job = AnimatedMoveViewJob.getInstance(mViewPortHandler,
                xValue - xInView / 2f, yValue + yInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);

        MPPointD.recycleInstance(bounds);
    } else {
        Log.e(LOG_TAG, "Unable to execute centerViewToAnimated(...) on API level < 11");
    }
}
 
Example #6
Source File: BarLineChartBase.java    From Stayfit with Apache License 2.0 6 votes vote down vote up
/**
 * This will move the left side of the current viewport to the specified x-position
 * and center the viewport to the specified y-position animated.
 * This also refreshes the chart by calling invalidate().
 *
 * @param xIndex
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void moveViewToAnimated(float xIndex, float yValue, AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        PointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float valsInView = getDeltaY(axis) / mViewPortHandler.getScaleY();

        Runnable job = new AnimatedMoveViewJob(mViewPortHandler, xIndex, yValue + valsInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);
    } else {
        Log.e(LOG_TAG, "Unable to execute moveViewToAnimated(...) on API level < 11");
    }
}
 
Example #7
Source File: BarLineChartBase.java    From Stayfit with Apache License 2.0 6 votes vote down vote up
/**
 * This will move the center of the current viewport to the specified
 * x-value and y-value animated.
 *
 * @param xIndex
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void centerViewToAnimated(float xIndex, float yValue, AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        PointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float valsInView = getDeltaY(axis) / mViewPortHandler.getScaleY();
        float xsInView = getXAxis().getValues().size() / mViewPortHandler.getScaleX();

        Runnable job = new AnimatedMoveViewJob(mViewPortHandler,
                xIndex - xsInView / 2f, yValue + valsInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);
    } else {
        Log.e(LOG_TAG, "Unable to execute centerViewToAnimated(...) on API level < 11");
    }
}
 
Example #8
Source File: BarLineChartBase.java    From NetKnight with Apache License 2.0 6 votes vote down vote up
/**
 * This will move the left side of the current viewport to the specified x-position
 * and center the viewport to the specified y-position animated.
 * This also refreshes the chart by calling invalidate().
 *
 * @param xIndex
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void moveViewToAnimated(float xIndex, float yValue, AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        PointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float valsInView = getDeltaY(axis) / mViewPortHandler.getScaleY();

        Runnable job = new AnimatedMoveViewJob(mViewPortHandler, xIndex, yValue + valsInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);
    } else {
        Log.e(LOG_TAG, "Unable to execute moveViewToAnimated(...) on API level < 11");
    }
}
 
Example #9
Source File: BarLineChartBase.java    From NetKnight with Apache License 2.0 6 votes vote down vote up
/**
 * This will move the center of the current viewport to the specified
 * x-value and y-value animated.
 *
 * @param xIndex
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void centerViewToAnimated(float xIndex, float yValue, AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        PointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float valsInView = getDeltaY(axis) / mViewPortHandler.getScaleY();
        float xsInView = getXAxis().getValues().size() / mViewPortHandler.getScaleX();

        Runnable job = new AnimatedMoveViewJob(mViewPortHandler,
                xIndex - xsInView / 2f, yValue + valsInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);
    } else {
        Log.e(LOG_TAG, "Unable to execute centerViewToAnimated(...) on API level < 11");
    }
}
 
Example #10
Source File: BarLineChartBase.java    From StockChart-MPAndroidChart with MIT License 3 votes vote down vote up
/**
 * This will move the left side of the current viewport to the specified x-value
 * and center the viewport to the y value animated.
 * This also refreshes the chart by calling invalidate().
 *
 * @param xValue
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void moveViewToAnimated(float xValue, float yValue, AxisDependency axis, long duration) {

    MPPointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

    float yInView = getAxisRange(axis) / mViewPortHandler.getScaleY();

    Runnable job = AnimatedMoveViewJob.getInstance(mViewPortHandler, xValue, yValue + yInView / 2f,
            getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

    addViewportJob(job);

    MPPointD.recycleInstance(bounds);
}