Java Code Examples for com.github.mikephil.charting.charts.Chart#getWidth()

The following examples show how to use com.github.mikephil.charting.charts.Chart#getWidth() . 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: MyMarkerView.java    From shinny-futures-android with GNU General Public License v3.0 6 votes vote down vote up
@Override
public MPPointF getOffsetForDrawingAtPoint(float posX, float posY) {

    MPPointF offset = getOffset();
    mOffset2.x = offset.x;
    mOffset2.y = offset.y;

    Chart chart = getChartView();

    float width = getWidth();
    float height = getHeight();

    if (posX + mOffset2.x < 0) {
        mOffset2.x = -posX;
    } else if (chart != null && posX + width + mOffset2.x > chart.getWidth()) {
        mOffset2.x = chart.getWidth() - posX - width;
    }

    if (posY + mOffset2.y < 0) {
        mOffset2.y = -posY;
    } else if (chart != null && posY + height + mOffset2.y > chart.getHeight()) {
        mOffset2.y = chart.getHeight() - posY - height;
    }

    return mOffset2;
}
 
Example 2
Source File: MarkerView.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
@Override
public MPPointF getOffsetForDrawingAtPoint(float posX, float posY) {

    MPPointF offset = getOffset();
    mOffset2.x = offset.x;
    mOffset2.y = offset.y;

    Chart chart = getChartView();

    float width = getWidth();
    float height = getHeight();

    if (posX + mOffset2.x < 0) {
        mOffset2.x = -posX;
    } else if (chart != null && posX + width + mOffset2.x > chart.getWidth()) {
        mOffset2.x = chart.getWidth() - posX - width;
    }

    if (posY + mOffset2.y < 0) {
        mOffset2.y = -posY;
    } else if (chart != null && posY + height + mOffset2.y > chart.getHeight()) {
        mOffset2.y = chart.getHeight() - posY - height;
    }

    return mOffset2;
}
 
Example 3
Source File: MarkerView.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
@Override
public MPPointF getOffsetForDrawingAtPoint(float posX, float posY) {

    MPPointF offset = getOffset();
    mOffset2.x = offset.x;
    mOffset2.y = offset.y;

    Chart chart = getChartView();

    float width = getWidth();
    float height = getHeight();

    if (posX + mOffset2.x < 0) {
        mOffset2.x = - posX;
    } else if (chart != null && posX + width + mOffset2.x > chart.getWidth()) {
        mOffset2.x = chart.getWidth() - posX - width;
    }

    if (posY + mOffset2.y < 0) {
        mOffset2.y = - posY;
    } else if (chart != null && posY + height + mOffset2.y > chart.getHeight()) {
        mOffset2.y = chart.getHeight() - posY - height;
    }

    return mOffset2;
}
 
Example 4
Source File: MarkerView.java    From android-kline with Apache License 2.0 6 votes vote down vote up
@Override
public MPPointF getOffsetForDrawingAtPoint(float posX, float posY) {

    MPPointF offset = getOffset();
    mOffset2.x = offset.x;
    mOffset2.y = offset.y;

    Chart chart = getChartView();

    float width = getWidth();
    float height = getHeight();

    if (posX + mOffset2.x < 0) {
        mOffset2.x = - posX;
    } else if (chart != null && posX + width + mOffset2.x > chart.getWidth()) {
        mOffset2.x = chart.getWidth() - posX - width;
    }

    if (posY + mOffset2.y < 0) {
        mOffset2.y = - posY;
    } else if (chart != null && posY + height + mOffset2.y > chart.getHeight()) {
        mOffset2.y = chart.getHeight() - posY - height;
    }

    return mOffset2;
}
 
Example 5
Source File: MarkerImage.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
public MPPointF getOffsetForDrawingAtPoint(float posX, float posY) {

    MPPointF offset = getOffset();
    mOffset2.x = offset.x;
    mOffset2.y = offset.y;

    Chart chart = getChartView();

    float width = mSize.width;
    float height = mSize.height;

    if (width == 0.f && mDrawable != null) {
        width = mDrawable.getIntrinsicWidth();
    }
    if (height == 0.f && mDrawable != null) {
        height = mDrawable.getIntrinsicHeight();
    }

    if (posX + mOffset2.x < 0) {
        mOffset2.x = -posX;
    } else if (chart != null && posX + width + mOffset2.x > chart.getWidth()) {
        mOffset2.x = chart.getWidth() - posX - width;
    }

    if (posY + mOffset2.y < 0) {
        mOffset2.y = -posY;
    } else if (chart != null && posY + height + mOffset2.y > chart.getHeight()) {
        mOffset2.y = chart.getHeight() - posY - height;
    }

    return mOffset2;
}
 
Example 6
Source File: MarkerImage.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
@Override
public MPPointF getOffsetForDrawingAtPoint(float posX, float posY) {

    MPPointF offset = getOffset();
    mOffset2.x = offset.x;
    mOffset2.y = offset.y;

    Chart chart = getChartView();

    float width = mSize.width;
    float height = mSize.height;

    if (width == 0.f && mDrawable != null) {
        width = mDrawable.getIntrinsicWidth();
    }
    if (height == 0.f && mDrawable != null) {
        height = mDrawable.getIntrinsicHeight();
    }

    if (posX + mOffset2.x < 0) {
        mOffset2.x = - posX;
    } else if (chart != null && posX + width + mOffset2.x > chart.getWidth()) {
        mOffset2.x = chart.getWidth() - posX - width;
    }

    if (posY + mOffset2.y < 0) {
        mOffset2.y = - posY;
    } else if (chart != null && posY + height + mOffset2.y > chart.getHeight()) {
        mOffset2.y = chart.getHeight() - posY - height;
    }

    return mOffset2;
}
 
Example 7
Source File: MarkerImage.java    From android-kline with Apache License 2.0 5 votes vote down vote up
@Override
public MPPointF getOffsetForDrawingAtPoint(float posX, float posY) {

    MPPointF offset = getOffset();
    mOffset2.x = offset.x;
    mOffset2.y = offset.y;

    Chart chart = getChartView();

    float width = mSize.width;
    float height = mSize.height;

    if (width == 0.f && mDrawable != null) {
        width = mDrawable.getIntrinsicWidth();
    }
    if (height == 0.f && mDrawable != null) {
        height = mDrawable.getIntrinsicHeight();
    }

    if (posX + mOffset2.x < 0) {
        mOffset2.x = - posX;
    } else if (chart != null && posX + width + mOffset2.x > chart.getWidth()) {
        mOffset2.x = chart.getWidth() - posX - width;
    }

    if (posY + mOffset2.y < 0) {
        mOffset2.y = - posY;
    } else if (chart != null && posY + height + mOffset2.y > chart.getHeight()) {
        mOffset2.y = chart.getHeight() - posY - height;
    }

    return mOffset2;
}