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


Java ViewPortHandler.isInBoundsY方法代码示例

本文整理汇总了Java中com.github.mikephil.charting.utils.ViewPortHandler.isInBoundsY方法的典型用法代码示例。如果您正苦于以下问题:Java ViewPortHandler.isInBoundsY方法的具体用法?Java ViewPortHandler.isInBoundsY怎么用?Java ViewPortHandler.isInBoundsY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.mikephil.charting.utils.ViewPortHandler的用法示例。


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

示例1: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(
        Canvas c, IScatterDataSet dataSet,
        ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;

    mRenderPaint.setStyle(Paint.Style.STROKE);
    mRenderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        mRenderPaint.setColor(dataSet.getColor(i / 2));

        c.drawLine(
                buffer.buffer[i] - shapeHalf,
                buffer.buffer[i + 1] - shapeHalf,
                buffer.buffer[i] + shapeHalf,
                buffer.buffer[i + 1] + shapeHalf,
                mRenderPaint);
        c.drawLine(
                buffer.buffer[i] + shapeHalf,
                buffer.buffer[i + 1] - shapeHalf,
                buffer.buffer[i] - shapeHalf,
                buffer.buffer[i + 1] + shapeHalf,
                mRenderPaint);
    }

}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:37,代码来源:XShapeRenderer.java

示例2: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(
        Canvas c, IScatterDataSet dataSet,
        ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;


    mRenderPaint.setStyle(Paint.Style.STROKE);
    mRenderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        mRenderPaint.setColor(dataSet.getColor(i / 2));

        c.drawLine(
                buffer.buffer[i] - shapeHalf,
                buffer.buffer[i + 1],
                buffer.buffer[i] + shapeHalf,
                buffer.buffer[i + 1],
                mRenderPaint);
        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] - shapeHalf,
                buffer.buffer[i],
                buffer.buffer[i + 1] + shapeHalf,
                mRenderPaint);
    }

}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:38,代码来源:CrossShapeRenderer.java

示例3: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet,
        ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;

    mRenderPaint.setStyle(Paint.Style.STROKE);
    mRenderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        mRenderPaint.setColor(dataSet.getColor(i / 2));

        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] - (2 * shapeHalf),
                buffer.buffer[i] + (2 * shapeHalf),
                buffer.buffer[i + 1],
                mRenderPaint);

        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] - (2 * shapeHalf),
                buffer.buffer[i] - (2 * shapeHalf),
                buffer.buffer[i + 1],
                mRenderPaint);
    }

}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:37,代码来源:ChevronUpShapeRenderer.java

示例4: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(
        Canvas c, IScatterDataSet dataSet,
        ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;

    mRenderPaint.setStyle(Paint.Style.STROKE);
    mRenderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        mRenderPaint.setColor(dataSet.getColor(i / 2));

        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] + (2 * shapeHalf),
                buffer.buffer[i] + (2 * shapeHalf),
                buffer.buffer[i + 1],
                mRenderPaint);

        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] + (2 * shapeHalf),
                buffer.buffer[i] - (2 * shapeHalf),
                buffer.buffer[i + 1],
                mRenderPaint);
    }

}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:38,代码来源:ChevronDownShapeRenderer.java

示例5: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler, ScatterBuffer buffer, Paint
        renderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!viewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!viewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !viewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        renderPaint.setColor(dataSet.getColor(i / 2));

        c.drawLine(
                buffer.buffer[i] - shapeHalf,
                buffer.buffer[i + 1] - shapeHalf,
                buffer.buffer[i] + shapeHalf,
                buffer.buffer[i + 1] + shapeHalf,
                renderPaint);
        c.drawLine(
                buffer.buffer[i] + shapeHalf,
                buffer.buffer[i + 1] - shapeHalf,
                buffer.buffer[i] - shapeHalf,
                buffer.buffer[i + 1] + shapeHalf,
                renderPaint);
    }

}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:36,代码来源:XShapeRenderer.java

示例6: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler, ScatterBuffer buffer, Paint
        renderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;


    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!viewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!viewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !viewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        renderPaint.setColor(dataSet.getColor(i / 2));

        c.drawLine(
                buffer.buffer[i] - shapeHalf,
                buffer.buffer[i + 1],
                buffer.buffer[i] + shapeHalf,
                buffer.buffer[i + 1],
                renderPaint);
        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] - shapeHalf,
                buffer.buffer[i],
                buffer.buffer[i + 1] + shapeHalf,
                renderPaint);
    }

}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:37,代码来源:CrossShapeRenderer.java

示例7: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler, ScatterBuffer buffer, Paint
        renderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!viewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!viewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !viewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        renderPaint.setColor(dataSet.getColor(i / 2));

        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] - (2 * shapeHalf),
                buffer.buffer[i] + (2 * shapeHalf),
                buffer.buffer[i + 1],
                renderPaint);

        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] - (2 * shapeHalf),
                buffer.buffer[i] - (2 * shapeHalf),
                buffer.buffer[i + 1],
                renderPaint);
    }

}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:37,代码来源:ChevronUpShapeRenderer.java

示例8: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler, ScatterBuffer buffer, Paint
        renderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!viewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!viewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !viewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        renderPaint.setColor(dataSet.getColor(i / 2));

        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] + (2 * shapeHalf),
                buffer.buffer[i] + (2 * shapeHalf),
                buffer.buffer[i + 1],
                renderPaint);

        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] + (2 * shapeHalf),
                buffer.buffer[i] - (2 * shapeHalf),
                buffer.buffer[i + 1],
                renderPaint);
    }

}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:37,代码来源:ChevronDownShapeRenderer.java

示例9: drawDataSet

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
protected void drawDataSet(Canvas c, IScatterDataSet dataSet) {

        ViewPortHandler viewPortHandler = mViewPortHandler;

        Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());

        float phaseY = mAnimator.getPhaseY();

        IShapeRenderer renderer = dataSet.getShapeRenderer();
        if (renderer == null) {
            Log.i("MISSING", "There's no IShapeRenderer specified for ScatterDataSet");
            return;
        }

        int max = (int)(Math.min(
                Math.ceil((float)dataSet.getEntryCount() * mAnimator.getPhaseX()),
                (float)dataSet.getEntryCount()));

        for (int i = 0; i < max; i++) {

            Entry e = dataSet.getEntryForIndex(i);

            mPixelBuffer[0] = e.getX();
            mPixelBuffer[1] = e.getY() * phaseY;

            trans.pointValuesToPixel(mPixelBuffer);

            if (!viewPortHandler.isInBoundsRight(mPixelBuffer[0]))
                break;

            if (!viewPortHandler.isInBoundsLeft(mPixelBuffer[0])
                    || !viewPortHandler.isInBoundsY(mPixelBuffer[1]))
                continue;

            mRenderPaint.setColor(dataSet.getColor(i / 2));
            renderer.renderShape(
                    c, dataSet, mViewPortHandler,
                    mPixelBuffer[0], mPixelBuffer[1],
                    mRenderPaint);
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:42,代码来源:ScatterChartRenderer.java

示例10: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(
        Canvas c, IScatterDataSet dataSet,
        ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;
    final float shapeStrokeSizeHalf = shapeStrokeSize / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        mRenderPaint.setColor(dataSet.getColor(i / 2));

        if (shapeSize > 0.0) {
            mRenderPaint.setStyle(Paint.Style.STROKE);
            mRenderPaint.setStrokeWidth(shapeStrokeSize);

            c.drawCircle(
                    buffer.buffer[i],
                    buffer.buffer[i + 1],
                    shapeHoleSizeHalf + shapeStrokeSizeHalf,
                    mRenderPaint);

            if (shapeHoleColor != ColorTemplate.COLOR_NONE) {
                mRenderPaint.setStyle(Paint.Style.FILL);

                mRenderPaint.setColor(shapeHoleColor);
                c.drawCircle(
                        buffer.buffer[i],
                        buffer.buffer[i + 1],
                        shapeHoleSizeHalf,
                        mRenderPaint);
            }
        } else {
            mRenderPaint.setStyle(Paint.Style.FILL);

            c.drawCircle(
                    buffer.buffer[i],
                    buffer.buffer[i + 1],
                    shapeHalf,
                    mRenderPaint);
        }
    }

}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:57,代码来源:CircleShapeRenderer.java

示例11: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(
        Canvas c, IScatterDataSet dataSet,
        ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) {


    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    mRenderPaint.setStyle(Paint.Style.FILL);

    // create a triangle path
    Path tri = new Path();

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        mRenderPaint.setColor(dataSet.getColor(i / 2));

        tri.moveTo(buffer.buffer[i], buffer.buffer[i + 1] - shapeHalf);
        tri.lineTo(buffer.buffer[i] + shapeHalf, buffer.buffer[i + 1] + shapeHalf);
        tri.lineTo(buffer.buffer[i] - shapeHalf, buffer.buffer[i + 1] + shapeHalf);

        if (shapeSize > 0.0) {
            tri.lineTo(buffer.buffer[i], buffer.buffer[i + 1] - shapeHalf);

            tri.moveTo(buffer.buffer[i] - shapeHalf + shapeStrokeSize,
                    buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize);
            tri.lineTo(buffer.buffer[i] + shapeHalf - shapeStrokeSize,
                    buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize);
            tri.lineTo(buffer.buffer[i],
                    buffer.buffer[i + 1] - shapeHalf + shapeStrokeSize);
            tri.lineTo(buffer.buffer[i] - shapeHalf + shapeStrokeSize,
                    buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize);
        }

        tri.close();

        c.drawPath(tri, mRenderPaint);
        tri.reset();

        if (shapeSize > 0.0 &&
                shapeHoleColor != ColorTemplate.COLOR_NONE) {

            mRenderPaint.setColor(shapeHoleColor);

            tri.moveTo(buffer.buffer[i],
                    buffer.buffer[i + 1] - shapeHalf + shapeStrokeSize);
            tri.lineTo(buffer.buffer[i] + shapeHalf - shapeStrokeSize,
                    buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize);
            tri.lineTo(buffer.buffer[i] - shapeHalf + shapeStrokeSize,
                    buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize);
            tri.close();

            c.drawPath(tri, mRenderPaint);
            tri.reset();
        }
    }

}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:71,代码来源:TriangleShapeRenderer.java

示例12: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(
        Canvas c, IScatterDataSet dataSet,
        ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;
    final float shapeStrokeSizeHalf = shapeStrokeSize / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        mRenderPaint.setColor(dataSet.getColor(i / 2));

        if (shapeSize > 0.0) {
            mRenderPaint.setStyle(Paint.Style.STROKE);
            mRenderPaint.setStrokeWidth(shapeStrokeSize);

            c.drawRect(buffer.buffer[i] - shapeHoleSizeHalf - shapeStrokeSizeHalf,
                    buffer.buffer[i + 1] - shapeHoleSizeHalf - shapeStrokeSizeHalf,
                    buffer.buffer[i] + shapeHoleSizeHalf + shapeStrokeSizeHalf,
                    buffer.buffer[i + 1] + shapeHoleSizeHalf + shapeStrokeSizeHalf,
                    mRenderPaint);

            if (shapeHoleColor != ColorTemplate.COLOR_NONE) {
                mRenderPaint.setStyle(Paint.Style.FILL);

                mRenderPaint.setColor(shapeHoleColor);
                c.drawRect(buffer.buffer[i] - shapeHoleSizeHalf,
                        buffer.buffer[i + 1] - shapeHoleSizeHalf,
                        buffer.buffer[i] + shapeHoleSizeHalf,
                        buffer.buffer[i + 1] + shapeHoleSizeHalf,
                        mRenderPaint);
            }

        } else {
            mRenderPaint.setStyle(Paint.Style.FILL);

            c.drawRect(buffer.buffer[i] - shapeHalf,
                    buffer.buffer[i + 1] - shapeHalf,
                    buffer.buffer[i] + shapeHalf,
                    buffer.buffer[i + 1] + shapeHalf,
                    mRenderPaint);
        }
    }
}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:57,代码来源:SquareShapeRenderer.java

示例13: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler, ScatterBuffer buffer, Paint
        renderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;
    final float shapeStrokeSizeHalf = shapeStrokeSize / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!viewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!viewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !viewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        renderPaint.setColor(dataSet.getColor(i / 2));

        if (shapeSize > 0.0) {
            renderPaint.setStyle(Paint.Style.STROKE);
            renderPaint.setStrokeWidth(shapeStrokeSize);

            c.drawCircle(
                    buffer.buffer[i],
                    buffer.buffer[i + 1],
                    shapeHoleSizeHalf + shapeStrokeSizeHalf,
                    renderPaint);

            if (shapeHoleColor != ColorTemplate.COLOR_NONE) {
                renderPaint.setStyle(Paint.Style.FILL);

                renderPaint.setColor(shapeHoleColor);
                c.drawCircle(
                        buffer.buffer[i],
                        buffer.buffer[i + 1],
                        shapeHoleSizeHalf,
                        renderPaint);
            }
        } else {
            renderPaint.setStyle(Paint.Style.FILL);

            c.drawCircle(
                    buffer.buffer[i],
                    buffer.buffer[i + 1],
                    shapeHalf,
                    renderPaint);
        }
    }

}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:56,代码来源:CircleShapeRenderer.java

示例14: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler, ScatterBuffer buffer, Paint
        renderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    renderPaint.setStyle(Paint.Style.FILL);

    // create a triangle path
    Path tri = mTrianglePathBuffer;
    tri.reset();

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!viewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!viewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !viewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        renderPaint.setColor(dataSet.getColor(i / 2));

        tri.moveTo(buffer.buffer[i], buffer.buffer[i + 1] - shapeHalf);
        tri.lineTo(buffer.buffer[i] + shapeHalf, buffer.buffer[i + 1] + shapeHalf);
        tri.lineTo(buffer.buffer[i] - shapeHalf, buffer.buffer[i + 1] + shapeHalf);

        if (shapeSize > 0.0) {
            tri.lineTo(buffer.buffer[i], buffer.buffer[i + 1] - shapeHalf);

            tri.moveTo(buffer.buffer[i] - shapeHalf + shapeStrokeSize,
                    buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize);
            tri.lineTo(buffer.buffer[i] + shapeHalf - shapeStrokeSize,
                    buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize);
            tri.lineTo(buffer.buffer[i],
                    buffer.buffer[i + 1] - shapeHalf + shapeStrokeSize);
            tri.lineTo(buffer.buffer[i] - shapeHalf + shapeStrokeSize,
                    buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize);
        }

        tri.close();

        c.drawPath(tri, renderPaint);
        tri.reset();

        if (shapeSize > 0.0 &&
                shapeHoleColor != ColorTemplate.COLOR_NONE) {

            renderPaint.setColor(shapeHoleColor);

            tri.moveTo(buffer.buffer[i],
                    buffer.buffer[i + 1] - shapeHalf + shapeStrokeSize);
            tri.lineTo(buffer.buffer[i] + shapeHalf - shapeStrokeSize,
                    buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize);
            tri.lineTo(buffer.buffer[i] - shapeHalf + shapeStrokeSize,
                    buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize);
            tri.close();

            c.drawPath(tri, renderPaint);
            tri.reset();
        }
    }

}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:70,代码来源:TriangleShapeRenderer.java

示例15: renderShape

import com.github.mikephil.charting.utils.ViewPortHandler; //导入方法依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler, ScatterBuffer buffer, Paint
        renderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;
    final float shapeStrokeSizeHalf = shapeStrokeSize / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!viewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!viewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !viewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        renderPaint.setColor(dataSet.getColor(i / 2));

        if (shapeSize > 0.0) {
            renderPaint.setStyle(Paint.Style.STROKE);
            renderPaint.setStrokeWidth(shapeStrokeSize);

            c.drawRect(buffer.buffer[i] - shapeHoleSizeHalf - shapeStrokeSizeHalf,
                    buffer.buffer[i + 1] - shapeHoleSizeHalf - shapeStrokeSizeHalf,
                    buffer.buffer[i] + shapeHoleSizeHalf + shapeStrokeSizeHalf,
                    buffer.buffer[i + 1] + shapeHoleSizeHalf + shapeStrokeSizeHalf,
                    renderPaint);

            if (shapeHoleColor != ColorTemplate.COLOR_NONE) {
                renderPaint.setStyle(Paint.Style.FILL);

                renderPaint.setColor(shapeHoleColor);
                c.drawRect(buffer.buffer[i] - shapeHoleSizeHalf,
                        buffer.buffer[i + 1] - shapeHoleSizeHalf,
                        buffer.buffer[i] + shapeHoleSizeHalf,
                        buffer.buffer[i + 1] + shapeHoleSizeHalf,
                        renderPaint);
            }

        } else {
            renderPaint.setStyle(Paint.Style.FILL);

            c.drawRect(buffer.buffer[i] - shapeHalf,
                    buffer.buffer[i + 1] - shapeHalf,
                    buffer.buffer[i] + shapeHalf,
                    buffer.buffer[i + 1] + shapeHalf,
                    renderPaint);
        }
    }
}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:56,代码来源:SquareShapeRenderer.java


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