Java Code Examples for com.github.mikephil.charting.utils.ViewPortHandler#offsetBottom()

The following examples show how to use com.github.mikephil.charting.utils.ViewPortHandler#offsetBottom() . 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: BarLineChartTouchListener.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
/**
 * Returns a recyclable MPPointF instance.
 * returns the correct translation depending on the provided x and y touch
 * points
 *
 * @param x
 * @param y
 * @return
 */
public MPPointF getTrans(float x, float y) {

    ViewPortHandler vph = mChart.getViewPortHandler();

    float xTrans = x - vph.offsetLeft();
    float yTrans = 0f;

    // check if axis is inverted
    if (inverted()) {
        yTrans = -(y - vph.offsetTop());
    } else {
        yTrans = -(mChart.getMeasuredHeight() - y - vph.offsetBottom());
    }

    return MPPointF.getInstance(xTrans, yTrans);
}
 
Example 2
Source File: BarLineChartTouchListener.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
/**
 * Returns a recyclable MPPointF instance.
 * returns the correct translation depending on the provided x and y touch
 * points
 *
 * @param x
 * @param y
 * @return
 */
public MPPointF getTrans(float x, float y) {

    ViewPortHandler vph = mChart.getViewPortHandler();

    float xTrans = x - vph.offsetLeft();
    float yTrans = 0f;

    // check if axis is inverted
    if (inverted()) {
        yTrans = -(y - vph.offsetTop());
    } else {
        yTrans = -(mChart.getMeasuredHeight() - y - vph.offsetBottom());
    }

    return MPPointF.getInstance(xTrans, yTrans);
}
 
Example 3
Source File: BarLineChartTouchListener.java    From android-kline with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a recyclable MPPointF instance.
 * returns the correct translation depending on the provided x and y touch
 * points
 *
 * @param x
 * @param y
 * @return
 */
public MPPointF getTrans(float x, float y) {

    ViewPortHandler vph = mChart.getViewPortHandler();

    float xTrans = x - vph.offsetLeft();
    float yTrans = 0f;

    // check if axis is inverted
    if (inverted()) {
        yTrans = -(y - vph.offsetTop());
    } else {
        yTrans = -(mChart.getMeasuredHeight() - y - vph.offsetBottom());
    }

    return MPPointF.getInstance(xTrans, yTrans);
}
 
Example 4
Source File: BarLineChartTouchListener.java    From iMoney with Apache License 2.0 6 votes vote down vote up
/**
 * returns the correct translation depending on the provided x and y touch
 * points
 * 
 * @param x
 * @param y
 * @return
 */
public PointF getTrans(float x, float y) {

    ViewPortHandler vph = mChart.getViewPortHandler();

    float xTrans = x - vph.offsetLeft();
    float yTrans = 0f;

    // check if axis is inverted
    if (mChart.isAnyAxisInverted() && mClosestDataSetToTouch != null
            && mChart.isInverted(mClosestDataSetToTouch.getAxisDependency())) {
        yTrans = -(y - vph.offsetTop());
    } else {
        yTrans = -(mChart.getMeasuredHeight() - y - vph.offsetBottom());
    }

    return new PointF(xTrans, yTrans);
}
 
Example 5
Source File: BarLineChartTouchListener.java    From Stayfit with Apache License 2.0 6 votes vote down vote up
/**
 * returns the correct translation depending on the provided x and y touch
 * points
 * 
 * @param x
 * @param y
 * @return
 */
public PointF getTrans(float x, float y) {

    ViewPortHandler vph = mChart.getViewPortHandler();

    float xTrans = x - vph.offsetLeft();
    float yTrans = 0f;

    // check if axis is inverted
    if (mChart.isAnyAxisInverted() && mClosestDataSetToTouch != null
            && mChart.isInverted(mClosestDataSetToTouch.getAxisDependency())) {
        yTrans = -(y - vph.offsetTop());
    } else {
        yTrans = -(mChart.getMeasuredHeight() - y - vph.offsetBottom());
    }

    return new PointF(xTrans, yTrans);
}
 
Example 6
Source File: BarLineChartTouchListener.java    From NetKnight with Apache License 2.0 6 votes vote down vote up
/**
 * returns the correct translation depending on the provided x and y touch
 * points
 *
 * @param x
 * @param y
 * @return
 */
public PointF getTrans(float x, float y) {

    ViewPortHandler vph = mChart.getViewPortHandler();

    float xTrans = x - vph.offsetLeft();
    float yTrans = 0f;

    // check if axis is inverted
    if (mChart.isAnyAxisInverted() && mClosestDataSetToTouch != null
            && mChart.isInverted(mClosestDataSetToTouch.getAxisDependency())) {
        yTrans = -(y - vph.offsetTop());
    } else {
        yTrans = -(mChart.getMeasuredHeight() - y - vph.offsetBottom());
    }

    return new PointF(xTrans, yTrans);
}