Java Code Examples for com.github.mikephil.charting.components.XAxis.XAxisPosition#TOP_INSIDE

The following examples show how to use com.github.mikephil.charting.components.XAxis.XAxisPosition#TOP_INSIDE . 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: XAxisRendererHorizontalBarChart.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled()) {
        return;
    }

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 2
Source File: XAxisRenderer.java    From Stayfit with Apache License 2.0 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
        return;

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 3
Source File: XAxisRenderer.java    From NetKnight with Apache License 2.0 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
        return;

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 4
Source File: XAxisRendererHorizontalBarChart.java    From Stayfit with Apache License 2.0 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
        return;

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 5
Source File: XAxisRenderer.java    From iMoney with Apache License 2.0 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
        return;

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 6
Source File: XAxisRendererHorizontalBarChart.java    From iMoney with Apache License 2.0 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
        return;

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 7
Source File: XAxisRenderer.java    From android-kline with Apache License 2.0 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
        return;

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());
    mAxisLinePaint.setPathEffect(mXAxis.getAxisLineDashPathEffect());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 8
Source File: XAxisRendererHorizontalBarChart.java    From android-kline with Apache License 2.0 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
        return;

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 9
Source File: XAxisRenderer.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
        return;

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());
    mAxisLinePaint.setPathEffect(mXAxis.getAxisLineDashPathEffect());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 10
Source File: XAxisRendererHorizontalBarChart.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
        return;

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 11
Source File: XAxisRenderer.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
        return;

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());
    mAxisLinePaint.setPathEffect(mXAxis.getAxisLineDashPathEffect());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 12
Source File: XAxisRendererHorizontalBarChart.java    From NetKnight with Apache License 2.0 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
        return;

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 13
Source File: XAxisRendererHorizontalBarChart.java    From android-kline with Apache License 2.0 4 votes vote down vote up
@Override
public void renderAxisLabels(Canvas c) {

    if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
        return;

    float xoffset = mXAxis.getXOffset();

    mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
    mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
    mAxisLabelPaint.setColor(mXAxis.getTextColor());

    MPPointF pointF = MPPointF.getInstance(0,0);

    if (mXAxis.getPosition() == XAxisPosition.TOP) {
        pointF.x = 0.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentRight() + xoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentRight() - xoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentLeft() - xoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentLeft() + xoffset, pointF);

    } else { // BOTH SIDED
        pointF.x = 0.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentRight() + xoffset, pointF);
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentLeft() - xoffset, pointF);
    }

    MPPointF.recycleInstance(pointF);
}
 
Example 14
Source File: XAxisRenderer.java    From android-kline with Apache License 2.0 4 votes vote down vote up
@Override
public void renderAxisLabels(Canvas c) {

    if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
        return;

    float yoffset = mXAxis.getYOffset();

    mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
    mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
    mAxisLabelPaint.setColor(mXAxis.getTextColor());

    MPPointF pointF = MPPointF.getInstance(0, 0);
    if (mXAxis.getPosition() == XAxisPosition.TOP) {
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() - yoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() + yoffset + mXAxis.mLabelRotatedHeight, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() + yoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() - yoffset - mXAxis.mLabelRotatedHeight, pointF);

    } else { // BOTH SIDED
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() - yoffset, pointF);
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() + yoffset, pointF);
    }
    MPPointF.recycleInstance(pointF);
}
 
Example 15
Source File: XAxisRenderer.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
@Override
public void renderAxisLabels(Canvas c) {

    if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
        return;

    float yoffset = mXAxis.getYOffset();

    mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
    mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
    mAxisLabelPaint.setColor(mXAxis.getTextColor());

    MPPointF pointF = MPPointF.getInstance(0,0);
    if (mXAxis.getPosition() == XAxisPosition.TOP) {
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() - yoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() + yoffset + mXAxis.mLabelRotatedHeight, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() + yoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() - yoffset - mXAxis.mLabelRotatedHeight, pointF);

    } else { // BOTH SIDED
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() - yoffset, pointF);
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() + yoffset, pointF);
    }
    MPPointF.recycleInstance(pointF);
}
 
Example 16
Source File: XAxisRendererHorizontalBarChart.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
@Override
public void renderAxisLabels(Canvas c) {

    if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
        return;

    float xoffset = mXAxis.getXOffset();

    mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
    mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
    mAxisLabelPaint.setColor(mXAxis.getTextColor());

    MPPointF pointF = MPPointF.getInstance(0,0);

    if (mXAxis.getPosition() == XAxisPosition.TOP) {
        pointF.x = 0.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentRight() + xoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentRight() - xoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentLeft() - xoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentLeft() + xoffset, pointF);

    } else { // BOTH SIDED
        pointF.x = 0.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentRight() + xoffset, pointF);
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentLeft() - xoffset, pointF);
    }

    MPPointF.recycleInstance(pointF);
}
 
Example 17
Source File: XAxisRenderer.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
@Override
public void renderAxisLabels(Canvas c) {

    if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
        return;

    float yoffset = mXAxis.getYOffset();

    mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
    mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
    mAxisLabelPaint.setColor(mXAxis.getTextColor());

    MPPointF pointF = MPPointF.getInstance(0, 0);
    if (mXAxis.getPosition() == XAxisPosition.TOP) {
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() - yoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() + yoffset + mXAxis.mLabelRotatedHeight, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() + yoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() - yoffset - mXAxis.mLabelRotatedHeight, pointF);

    } else { // BOTH SIDED
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() - yoffset, pointF);
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() + yoffset, pointF);
    }
    MPPointF.recycleInstance(pointF);
}
 
Example 18
Source File: XAxisRendererHorizontalBarChart.java    From iMoney with Apache License 2.0 3 votes vote down vote up
@Override
public void renderAxisLabels(Canvas c) {

    if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
        return;

    float xoffset = mXAxis.getXOffset();

    mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
    mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
    mAxisLabelPaint.setColor(mXAxis.getTextColor());

    if (mXAxis.getPosition() == XAxisPosition.TOP) {

        mAxisLabelPaint.setTextAlign(Align.LEFT);
        drawLabels(c, mViewPortHandler.contentRight() + xoffset);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {

        mAxisLabelPaint.setTextAlign(Align.RIGHT);
        drawLabels(c, mViewPortHandler.contentLeft() - xoffset);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {

        mAxisLabelPaint.setTextAlign(Align.LEFT);
        drawLabels(c, mViewPortHandler.contentLeft() + xoffset);

    } else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {

        mAxisLabelPaint.setTextAlign(Align.RIGHT);
        drawLabels(c, mViewPortHandler.contentRight() - xoffset);

    } else { // BOTH SIDED

        mAxisLabelPaint.setTextAlign(Align.RIGHT);
        drawLabels(c, mViewPortHandler.contentLeft() - xoffset);
        mAxisLabelPaint.setTextAlign(Align.LEFT);
        drawLabels(c, mViewPortHandler.contentRight() + xoffset);
    }
}
 
Example 19
Source File: XAxisRenderer.java    From iMoney with Apache License 2.0 3 votes vote down vote up
@Override
public void renderAxisLabels(Canvas c) {

    if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
        return;

    float yoffset = Utils.convertDpToPixel(4f);

    mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
    mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
    mAxisLabelPaint.setColor(mXAxis.getTextColor());

    if (mXAxis.getPosition() == XAxisPosition.TOP) {

        drawLabels(c, mViewPortHandler.offsetTop() - yoffset);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {

        drawLabels(c, mViewPortHandler.contentBottom() + mXAxis.mLabelHeight + yoffset * 1.5f);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {

        drawLabels(c, mViewPortHandler.contentBottom() - yoffset);

    } else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {

        drawLabels(c, mViewPortHandler.offsetTop() + yoffset + mXAxis.mLabelHeight);

    } else { // BOTH SIDED

        drawLabels(c, mViewPortHandler.offsetTop() - yoffset);
        drawLabels(c, mViewPortHandler.contentBottom() + mXAxis.mLabelHeight + yoffset * 1.6f);
    }
}
 
Example 20
Source File: XAxisRendererHorizontalBarChart.java    From NetKnight with Apache License 2.0 3 votes vote down vote up
@Override
public void renderAxisLabels(Canvas c) {

    if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
        return;

    float xoffset = mXAxis.getXOffset();

    mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
    mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
    mAxisLabelPaint.setColor(mXAxis.getTextColor());

    if (mXAxis.getPosition() == XAxisPosition.TOP) {

        drawLabels(c, mViewPortHandler.contentRight() + xoffset,
                new PointF(0.0f, 0.5f));

    } else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {

        drawLabels(c, mViewPortHandler.contentRight() - xoffset,
                new PointF(1.0f, 0.5f));

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {

        drawLabels(c, mViewPortHandler.contentLeft() - xoffset,
                new PointF(1.0f, 0.5f));

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {

        drawLabels(c, mViewPortHandler.contentLeft() + xoffset,
                new PointF(0.0f, 0.5f));

    } else { // BOTH SIDED

        drawLabels(c, mViewPortHandler.contentRight() + xoffset,
                new PointF(0.0f, 0.5f));
        drawLabels(c, mViewPortHandler.contentLeft() - xoffset,
                new PointF(1.0f, 0.5f));
    }
}