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


Java ILineDataSet.getCircleHoleRadius方法代码示例

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


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

示例1: drawCircles

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入方法依赖的package包/类
protected void drawCircles(Canvas c) {

        mRenderPaint.setStyle(Paint.Style.FILL);

        float phaseY = mAnimator.getPhaseY();

        mCirclesBuffer[0] = 0;
        mCirclesBuffer[1] = 0;

        List<ILineDataSet> dataSets = mChart.getLineData().getDataSets();

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

            ILineDataSet dataSet = dataSets.get(i);

            if (!dataSet.isVisible() || !dataSet.isDrawCirclesEnabled() ||
                    dataSet.getEntryCount() == 0)
                continue;

            mCirclePaintInner.setColor(dataSet.getCircleHoleColor());

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

            mXBounds.set(mChart, dataSet);

            float circleRadius = dataSet.getCircleRadius();
            float circleHoleRadius = dataSet.getCircleHoleRadius();
            boolean drawCircleHole = dataSet.isDrawCircleHoleEnabled() &&
                    circleHoleRadius < circleRadius &&
                    circleHoleRadius > 0.f;
            boolean drawTransparentCircleHole = drawCircleHole &&
                    dataSet.getCircleHoleColor() == ColorTemplate.COLOR_NONE;

            DataSetImageCache imageCache;

            if (mImageCaches.containsKey(dataSet)) {
                imageCache = mImageCaches.get(dataSet);
            } else {
                imageCache = new DataSetImageCache();
                mImageCaches.put(dataSet, imageCache);
            }

            boolean changeRequired = imageCache.init(dataSet);

            // only fill the cache with new bitmaps if a change is required
            if (changeRequired) {
                imageCache.fill(dataSet, drawCircleHole, drawTransparentCircleHole);
            }

            int boundsRangeCount = mXBounds.range + mXBounds.min;

            for (int j = mXBounds.min; j <= boundsRangeCount; j++) {

                Entry e = dataSet.getEntryForIndex(j);

                if (e == null) break;

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

                trans.pointValuesToPixel(mCirclesBuffer);

                if (!mViewPortHandler.isInBoundsRight(mCirclesBuffer[0]))
                    break;

                if (!mViewPortHandler.isInBoundsLeft(mCirclesBuffer[0]) ||
                        !mViewPortHandler.isInBoundsY(mCirclesBuffer[1]))
                    continue;

                Bitmap circleBitmap = imageCache.getBitmap(j);

                if (circleBitmap != null) {
                    c.drawBitmap(circleBitmap, mCirclesBuffer[0] - circleRadius, mCirclesBuffer[1] - circleRadius, null);
                }
            }
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:78,代码来源:LineChartRenderer.java

示例2: fill

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入方法依赖的package包/类
/**
 * Fills the cache with bitmaps for the given dataset.
 *
 * @param set
 * @param drawCircleHole
 * @param drawTransparentCircleHole
 */
protected void fill(ILineDataSet set, boolean drawCircleHole, boolean drawTransparentCircleHole) {

    int colorCount = set.getCircleColorCount();
    float circleRadius = set.getCircleRadius();
    float circleHoleRadius = set.getCircleHoleRadius();

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

        Bitmap.Config conf = Bitmap.Config.ARGB_4444;
        Bitmap circleBitmap = Bitmap.createBitmap((int) (circleRadius * 2.1), (int) (circleRadius * 2.1), conf);

        Canvas canvas = new Canvas(circleBitmap);
        circleBitmaps[i] = circleBitmap;
        mRenderPaint.setColor(set.getCircleColor(i));

        if (drawTransparentCircleHole) {
            // Begin path for circle with hole
            mCirclePathBuffer.reset();

            mCirclePathBuffer.addCircle(
                    circleRadius,
                    circleRadius,
                    circleRadius,
                    Path.Direction.CW);

            // Cut hole in path
            mCirclePathBuffer.addCircle(
                    circleRadius,
                    circleRadius,
                    circleHoleRadius,
                    Path.Direction.CCW);

            // Fill in-between
            canvas.drawPath(mCirclePathBuffer, mRenderPaint);
        } else {

            canvas.drawCircle(
                    circleRadius,
                    circleRadius,
                    circleRadius,
                    mRenderPaint);

            if (drawCircleHole) {
                canvas.drawCircle(
                        circleRadius,
                        circleRadius,
                        circleHoleRadius,
                        mCirclePaintInner);
            }
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:60,代码来源:LineChartRenderer.java

示例3: drawCircles

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入方法依赖的package包/类
protected void drawCircles(Canvas c) {

        mRenderPaint.setStyle(Paint.Style.FILL);

        float phaseY = mAnimator.getPhaseY();

        mCirclesBuffer[0] = 0;
        mCirclesBuffer[1] = 0;

        List<ILineDataSet> dataSets = mChart.getLineData().getDataSets();

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

            ILineDataSet dataSet = dataSets.get(i);

            if (!dataSet.isVisible() || !dataSet.isDrawCirclesEnabled() ||
                    dataSet.getEntryCount() == 0)
                continue;

            mCirclePaintInner.setColor(dataSet.getCircleHoleColor());

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

            mXBounds.set(mChart, dataSet);

            float circleRadius = dataSet.getCircleRadius();
            float circleHoleRadius = dataSet.getCircleHoleRadius();
            boolean drawCircleHole = dataSet.isDrawCircleHoleEnabled() &&
                    circleHoleRadius < circleRadius &&
                    circleHoleRadius > 0.f;
            boolean drawTransparentCircleHole = drawCircleHole &&
                    dataSet.getCircleHoleColor() == ColorTemplate.COLOR_NONE;

            DataSetImageCache imageCache;

            if (mImageCaches.containsKey(dataSet)) {
                imageCache = mImageCaches.get(dataSet);
            } else {
                imageCache = new DataSetImageCache();
                mImageCaches.put(dataSet, imageCache);
            }

            boolean changeRequired = imageCache.init(dataSet);

            // only fill the cache with new bitmaps if a change is required
            if (changeRequired) {
                imageCache.fill(dataSet, drawCircleHole, drawTransparentCircleHole);
            }

            int boundsRangeCount = mXBounds.range + mXBounds.min;

            for (int j = mXBounds.min; j <= boundsRangeCount; j++) {

                Entry e = dataSet.getEntryForIndex(j);

                if (e == null) break;

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

                trans.pointValuesToPixel(mCirclesBuffer);

                if (!mViewPortHandler.isInBoundsRight(mCirclesBuffer[0]))
                    break;

                if (!mViewPortHandler.isInBoundsLeft(mCirclesBuffer[0]) ||
                        !mViewPortHandler.isInBoundsY(mCirclesBuffer[1]))
                    continue;

                Bitmap circleBitmap = imageCache.getBitmap(j);

                if (circleBitmap != null) {
                    c.drawBitmap(circleBitmap, mCirclesBuffer[0] - circleRadius, mCirclesBuffer[1] - circleRadius, mRenderPaint);
                }
            }
        }
    }
 
开发者ID:xsingHu,项目名称:xs-android-architecture,代码行数:78,代码来源:LineChartRenderer.java


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