当前位置: 首页>>代码示例>>Java>>正文


Java PointD类代码示例

本文整理汇总了Java中com.github.mikephil.charting.utils.PointD的典型用法代码示例。如果您正苦于以下问题:Java PointD类的具体用法?Java PointD怎么用?Java PointD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PointD类属于com.github.mikephil.charting.utils包,在下文中一共展示了PointD类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: moveViewToAnimated

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * 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");
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:28,代码来源:BarLineChartBase.java

示例2: centerViewToAnimated

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * 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");
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:29,代码来源:BarLineChartBase.java

示例3: computeAxis

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * Computes the axis values.
 *
 * @param yMin - the minimum y-value in the data object for this axis
 * @param yMax - the maximum y-value in the data object for this axis
 */
public void computeAxis(float yMin, float yMax) {

    // calculate the starting and entry point of the y-labels (depending on
    // zoom / contentrect bounds)
    if (mViewPortHandler.contentWidth() > 10 && !mViewPortHandler.isFullyZoomedOutY()) {

        PointD p1 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop());
        PointD p2 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentBottom());

        if (!mYAxis.isInverted()) {
            yMin = (float) p2.y;
            yMax = (float) p1.y;
        } else {

            yMin = (float) p1.y;
            yMax = (float) p2.y;
        }
    }

    computeAxisValues(yMin, yMax);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:28,代码来源:YAxisRenderer.java

示例4: computeAxis

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * Computes the axis values.
 *
 * @param yMin - the minimum y-value in the data object for this axis
 * @param yMax - the maximum y-value in the data object for this axis
 */
public void computeAxis(float yMin, float yMax) {

    // calculate the starting and entry point of the y-labels (depending on
    // zoom / contentrect bounds)
    if (mViewPortHandler.contentHeight() > 10 && !mViewPortHandler.isFullyZoomedOutX()) {

        PointD p1 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop());
        PointD p2 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop());

        if (!mYAxis.isInverted()) {
            yMin = (float) p1.x;
            yMax = (float) p2.x;
        } else {
            yMin = (float) p2.x;
            yMax = (float) p1.x;
        }
    }

    computeAxisValues(yMin, yMax);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:29,代码来源:YAxisRendererHorizontalBarChart.java

示例5: computeAxis

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * Computes the axis values.
 * 
 * @param yMin - the minimum y-value in the data object for this axis
 * @param yMax - the maximum y-value in the data object for this axis
 */
public void computeAxis(float yMin, float yMax) {

    // calculate the starting and entry point of the y-labels (depending on
    // zoom / contentrect bounds)
    if (mViewPortHandler.contentHeight() > 10 && !mViewPortHandler.isFullyZoomedOutX()) {

        PointD p1 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop());
        PointD p2 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop());

        if (!mYAxis.isInverted()) {
            yMin = (float) p1.x;
            yMax = (float) p2.x;
        } else {
            yMin = (float) p2.x;
            yMax = (float) p1.x;
        }
    }

    computeAxisValues(yMin, yMax);
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:29,代码来源:YAxisRendererHorizontalBarChart.java

示例6: moveViewToAnimated

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * 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, YAxis.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");
    }
}
 
开发者ID:muyoumumumu,项目名称:QuShuChe,代码行数:28,代码来源:BarLineChartBase.java

示例7: centerViewToAnimated

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * 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, YAxis.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");
    }
}
 
开发者ID:muyoumumumu,项目名称:QuShuChe,代码行数:29,代码来源:BarLineChartBase.java

示例8: getValuesByTouchPoint

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * Returns the x and y values in the chart at the given touch point
 * (encapsulated in a PointD). This method transforms pixel coordinates to
 * coordinates / values in the chart. This is the opposite method to
 * getPixelsForValues(...).
 * 
 * @param x
 * @param y
 * @return
 */
public PointD getValuesByTouchPoint(float x, float y) {

    // create an array of the touch-point
    float[] pts = new float[2];
    pts[0] = x;
    pts[1] = y;

    Matrix tmp = new Matrix();

    // invert all matrixes to convert back to the original value
    mMatrixOffset.invert(tmp);
    tmp.mapPoints(pts);

    mMatrixTouch.invert(tmp);
    tmp.mapPoints(pts);

    mMatrixValueToPx.invert(tmp);
    tmp.mapPoints(pts);

    double xTouchVal = pts[0];
    double yTouchVal = pts[1];

    return new PointD(xTouchVal, yTouchVal);
}
 
开发者ID:MPieter,项目名称:Notification-Analyser,代码行数:35,代码来源:BarLineChartBase.java

示例9: zoomAndCenterAnimated

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * Zooms by the specified scale factor to the specified values on the specified axis.
 *
 * @param scaleX
 * @param scaleY
 * @param xValue
 * @param yValue
 * @param axis
 * @param duration
 */
@TargetApi(11)
public void zoomAndCenterAnimated(float scaleX, float scaleY, float xValue, float yValue, AxisDependency axis, long duration) {

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

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

        Runnable job = new AnimatedZoomJob(mViewPortHandler, this, getTransformer(axis), getAxis(axis), mXAxis.getValues().size(), scaleX, scaleY, mViewPortHandler.getScaleX(), mViewPortHandler.getScaleY(), xValue, yValue, (float) origin.x, (float) origin.y, duration);
        addViewportJob(job);

    } else {
        Log.e(LOG_TAG, "Unable to execute zoomAndCenterAnimated(...) on API level < 11");
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:25,代码来源:BarLineChartBase.java

示例10: getValuesByTouchPoint

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * Returns the x and y values in the chart at the given touch point
 * (encapsulated in a PointD). This method transforms pixel coordinates to
 * coordinates / values in the chart. This is the opposite method to
 * getPixelsForValues(...).
 *
 * @param x
 * @param y
 * @return
 */
public PointD getValuesByTouchPoint(float x, float y, AxisDependency axis) {

    // create an array of the touch-point
    float[] pts = new float[2];
    pts[0] = x;
    pts[1] = y;

    getTransformer(axis).pixelsToValue(pts);

    double xTouchVal = pts[0];
    double yTouchVal = pts[1];

    return new PointD(xTouchVal, yTouchVal);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:25,代码来源:BarLineChartBase.java

示例11: getPixelsForValues

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * Transforms the given chart values into pixels. This is the opposite
 * method to getValuesByTouchPoint(...).
 *
 * @param x
 * @param y
 * @return
 */
public PointD getPixelsForValues(float x, float y, AxisDependency axis) {

    float[] pts = new float[]{
            x, y
    };

    getTransformer(axis).pointValuesToPixel(pts);

    return new PointD(pts[0], pts[1]);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:19,代码来源:BarLineChartBase.java

示例12: getValuesByTouchPoint

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * Returns the x and y values in the chart at the given touch point
 * (encapsulated in a PointD). This method transforms pixel coordinates to
 * coordinates / values in the chart. This is the opposite method to
 * getPixelsForValues(...).
 * 
 * @param x
 * @param y
 * @return
 */
public PointD getValuesByTouchPoint(float x, float y, AxisDependency axis) {

    // create an array of the touch-point
    float[] pts = new float[2];
    pts[0] = x;
    pts[1] = y;

    getTransformer(axis).pixelsToValue(pts);

    double xTouchVal = pts[0];
    double yTouchVal = pts[1];

    return new PointD(xTouchVal, yTouchVal);
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:25,代码来源:BarLineChartBase.java

示例13: getPixelsForValues

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * Transforms the given chart values into pixels. This is the opposite
 * method to getValuesByTouchPoint(...).
 * 
 * @param x
 * @param y
 * @return
 */
public PointD getPixelsForValues(float x, float y, AxisDependency axis) {

    float[] pts = new float[] {
            x, y
    };

    getTransformer(axis).pointValuesToPixel(pts);

    return new PointD(pts[0], pts[1]);
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:19,代码来源:BarLineChartBase.java

示例14: zoomAndCenterAnimated

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * Zooms by the specified scale factor to the specified values on the specified axis.
 *
 * @param scaleX
 * @param scaleY
 * @param xValue
 * @param yValue
 * @param axis
 * @param duration
 */
@TargetApi(11)
public void zoomAndCenterAnimated(float scaleX, float scaleY, float xValue, float yValue, YAxis.AxisDependency axis, long duration) {

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

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

        Runnable job = new AnimatedZoomJob(mViewPortHandler, this, getTransformer(axis), getAxis(axis), mXAxis.getValues().size(), scaleX, scaleY, mViewPortHandler.getScaleX(), mViewPortHandler.getScaleY(), xValue, yValue, (float) origin.x, (float) origin.y, duration);
        addViewportJob(job);

    } else {
        Log.e(LOG_TAG, "Unable to execute zoomAndCenterAnimated(...) on API level < 11");
    }
}
 
开发者ID:muyoumumumu,项目名称:QuShuChe,代码行数:25,代码来源:BarLineChartBase.java

示例15: getValuesByTouchPoint

import com.github.mikephil.charting.utils.PointD; //导入依赖的package包/类
/**
 * Returns the x and y values in the chart at the given touch point
 * (encapsulated in a PointD). This method transforms pixel coordinates to
 * coordinates / values in the chart. This is the opposite method to
 * getPixelsForValues(...).
 *
 * @param x
 * @param y
 * @return
 */
public PointD getValuesByTouchPoint(float x, float y, YAxis.AxisDependency axis) {

    // create an array of the touch-point
    float[] pts = new float[2];
    pts[0] = x;
    pts[1] = y;

    getTransformer(axis).pixelsToValue(pts);

    double xTouchVal = pts[0];
    double yTouchVal = pts[1];

    return new PointD(xTouchVal, yTouchVal);
}
 
开发者ID:muyoumumumu,项目名称:QuShuChe,代码行数:25,代码来源:BarLineChartBase.java


注:本文中的com.github.mikephil.charting.utils.PointD类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。