• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BubbleDataSet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.github.mikephil.charting.data.BubbleDataSet的典型用法代码示例。如果您正苦于以下问题:Java BubbleDataSet类的具体用法?Java BubbleDataSet怎么用?Java BubbleDataSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BubbleDataSet类属于com.github.mikephil.charting.data包,在下文中一共展示了BubbleDataSet类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: generateBubbleData

import com.github.mikephil.charting.data.BubbleDataSet; //导入依赖的package包/类
protected BubbleData generateBubbleData() {

        BubbleData bd = new BubbleData();

        ArrayList<BubbleEntry> entries = new ArrayList<BubbleEntry>();

        for (int index = 0; index < itemcount; index++) {
            float y = getRandom(10, 105);
            float size = getRandom(100, 105);
            entries.add(new BubbleEntry(index + 0.5f, y, size));
        }

        BubbleDataSet set = new BubbleDataSet(entries, "Bubble DataSet");
        set.setColors(ColorTemplate.VORDIPLOM_COLORS);
        set.setValueTextSize(10f);
        set.setValueTextColor(Color.WHITE);
        set.setHighlightCircleWidth(1.5f);
        set.setDrawValues(true);
        bd.addDataSet(set);

        return bd;
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:CombinedChartActivity.java


示例2: generateBubbleData

import com.github.mikephil.charting.data.BubbleDataSet; //导入依赖的package包/类
protected BubbleData generateBubbleData() {

        BubbleData bd = new BubbleData();

        ArrayList<BubbleEntry> entries = new ArrayList<BubbleEntry>();

        for (int index = 0; index < itemcount; index++) {
            float rnd = getRandom(20, 30);
            entries.add(new BubbleEntry(index, rnd, rnd));
        }

        BubbleDataSet set = new BubbleDataSet(entries, "Bubble DataSet");
        set.setColors(ColorTemplate.VORDIPLOM_COLORS);
        set.setValueTextSize(10f);
        set.setValueTextColor(Color.WHITE);
        set.setHighlightCircleWidth(1.5f);
        set.setDrawValues(true);
        bd.addDataSet(set);

        return bd;
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:22,代码来源:CombinedChartActivity.java


示例3: calcMinMax

import com.github.mikephil.charting.data.BubbleDataSet; //导入依赖的package包/类
@Override
protected void calcMinMax() {
    super.calcMinMax();
    
    if (getBarData() != null || getCandleData() != null || getBubbleData() != null) {
        mXChartMin = -0.5f;
        mXChartMax = mData.getXVals().size() - 0.5f;

        if (getBubbleData() != null) {

            for (BubbleDataSet set : getBubbleData().getDataSets()) {

                final float xmin = set.getXMin();
                final float xmax = set.getXMax();

                if (xmin < mXChartMin)
                    mXChartMin = xmin;

                if (xmax > mXChartMax)
                    mXChartMax = xmax;
            }
        }
    }

    mDeltaX = Math.abs(mXChartMax - mXChartMin);
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:27,代码来源:CombinedChart.java


示例4: calcMinMax

import com.github.mikephil.charting.data.BubbleDataSet; //导入依赖的package包/类
@Override
protected void calcMinMax() {
    super.calcMinMax();

    if (mDeltaX == 0 && mData.getYValCount() > 0)
        mDeltaX = 1;

    mXChartMin = -0.5f;
    mXChartMax = (float) mData.getXValCount() - 0.5f;

    if (mRenderer != null) {
        for (BubbleDataSet set : mData.getDataSets()) {

            final float xmin = set.getXMin();
            final float xmax = set.getXMax();

            if (xmin < mXChartMin)
                mXChartMin = xmin;

            if (xmax > mXChartMax)
                mXChartMax = xmax;
        }
    }

    mDeltaX = Math.abs(mXChartMax - mXChartMin);
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:27,代码来源:BubbleChart.java


示例5: drawData

import com.github.mikephil.charting.data.BubbleDataSet; //导入依赖的package包/类
@Override
public void drawData(Canvas c) {

    BubbleData bubbleData = mChart.getBubbleData();

    for (BubbleDataSet set : bubbleData.getDataSets()) {

        if (set.isVisible() && set.getEntryCount() > 0)
            drawDataSet(c, set);
    }
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:12,代码来源:BubbleChartRenderer.java


示例6: dataSetConfig

import com.github.mikephil.charting.data.BubbleDataSet; //导入依赖的package包/类
@Override
void dataSetConfig(IDataSet<BubbleEntry> dataSet, ReadableMap config) {
    BubbleDataSet bubbleDataSet = (BubbleDataSet) dataSet;

    ChartDataSetConfigUtils.commonConfig(bubbleDataSet, config);
    ChartDataSetConfigUtils.commonBarLineScatterCandleBubbleConfig(bubbleDataSet, config);

    // BubbleDataSet only config
    if (BridgeUtils.validate(config, ReadableType.Number, "highlightCircleWidth")) {
        bubbleDataSet.setHighlightCircleWidth((float) config.getDouble("highlightCircleWidth"));
    }
}
 
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:13,代码来源:BubbleChartManager.java


示例7: drawHighlighted

import com.github.mikephil.charting.data.BubbleDataSet; //导入依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {

    BubbleData bubbleData = mChart.getBubbleData();

    float phaseX = mAnimator.getPhaseX();
    float phaseY = mAnimator.getPhaseY();

    for (Highlight indice : indices) {

        BubbleDataSet dataSet = bubbleData.getDataSetByIndex(indice.getDataSetIndex());

        if (dataSet == null || !dataSet.isHighlightEnabled())
            continue;

        Entry entryFrom = dataSet.getEntryForXIndex(mMinX);
        Entry entryTo = dataSet.getEntryForXIndex(mMaxX);

        int minx = dataSet.getEntryPosition(entryFrom);
        int maxx = Math.min(dataSet.getEntryPosition(entryTo) + 1, dataSet.getEntryCount());

        final BubbleEntry entry = (BubbleEntry) bubbleData.getEntryForHighlight(indice);
        if (entry == null || entry.getXIndex() != indice.getXIndex())
            continue;

        Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());
        
        sizeBuffer[0] = 0f;
        sizeBuffer[2] = 1f;

        trans.pointValuesToPixel(sizeBuffer);
        
        // calcualte the full width of 1 step on the x-axis
        final float maxBubbleWidth = Math.abs(sizeBuffer[2] - sizeBuffer[0]);
        final float maxBubbleHeight = Math.abs(mViewPortHandler.contentBottom() - mViewPortHandler.contentTop());
        final float referenceSize = Math.min(maxBubbleHeight, maxBubbleWidth);

        pointBuffer[0] = (float) (entry.getXIndex() - minx) * phaseX + (float) minx;
        pointBuffer[1] = (float) (entry.getVal()) * phaseY;
        trans.pointValuesToPixel(pointBuffer);

        float shapeHalf = getShapeSize(entry.getSize(), dataSet.getMaxSize(), referenceSize) / 2f;

        if (!mViewPortHandler.isInBoundsTop(pointBuffer[1] + shapeHalf)
                || !mViewPortHandler.isInBoundsBottom(pointBuffer[1] - shapeHalf))
            continue;

        if (!mViewPortHandler.isInBoundsLeft(pointBuffer[0] + shapeHalf))
            continue;

        if (!mViewPortHandler.isInBoundsRight(pointBuffer[0] - shapeHalf))
            break;

        if (indice.getXIndex() < minx || indice.getXIndex() >= maxx)
            continue;

        final int originalColor = dataSet.getColor(entry.getXIndex());

        Color.RGBToHSV(Color.red(originalColor), Color.green(originalColor),
                Color.blue(originalColor), _hsvBuffer);
        _hsvBuffer[2] *= 0.5f;
        final int color = Color.HSVToColor(Color.alpha(originalColor), _hsvBuffer);

        mHighlightPaint.setColor(color);
        mHighlightPaint.setStrokeWidth(dataSet.getHighlightCircleWidth());
        c.drawCircle(pointBuffer[0], pointBuffer[1], shapeHalf, mHighlightPaint);
    }
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:69,代码来源:BubbleChartRenderer.java


示例8: createDataSet

import com.github.mikephil.charting.data.BubbleDataSet; //导入依赖的package包/类
@Override
IDataSet createDataSet(ArrayList<BubbleEntry> entries, String label) {
    return new BubbleDataSet(entries, label);
}
 
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:5,代码来源:BubbleChartManager.java


示例9: drawDataSet

import com.github.mikephil.charting.data.BubbleDataSet; //导入依赖的package包/类
protected void drawDataSet(Canvas c, BubbleDataSet dataSet) {

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

        float phaseX = mAnimator.getPhaseX();
        float phaseY = mAnimator.getPhaseY();

        List<BubbleEntry> entries = dataSet.getYVals();

        Entry entryFrom = dataSet.getEntryForXIndex(mMinX);
        Entry entryTo = dataSet.getEntryForXIndex(mMaxX);

        int minx = Math.max(dataSet.getEntryPosition(entryFrom), 0);
        int maxx = Math.min(dataSet.getEntryPosition(entryTo) + 1, entries.size());

        sizeBuffer[0] = 0f;
        sizeBuffer[2] = 1f;

        trans.pointValuesToPixel(sizeBuffer);

        // calcualte the full width of 1 step on the x-axis
        final float maxBubbleWidth = Math.abs(sizeBuffer[2] - sizeBuffer[0]);
        final float maxBubbleHeight = Math.abs(mViewPortHandler.contentBottom() - mViewPortHandler.contentTop());
        final float referenceSize = Math.min(maxBubbleHeight, maxBubbleWidth);

        for (int j = minx; j < maxx; j++) {

            final BubbleEntry entry = entries.get(j);

            pointBuffer[0] = (float) (entry.getXIndex() - minx) * phaseX + (float) minx;
            pointBuffer[1] = (float) (entry.getVal()) * phaseY;
            trans.pointValuesToPixel(pointBuffer);

            float shapeHalf = getShapeSize(entry.getSize(), dataSet.getMaxSize(), referenceSize) / 2f;

            if (!mViewPortHandler.isInBoundsTop(pointBuffer[1] + shapeHalf)
                    || !mViewPortHandler.isInBoundsBottom(pointBuffer[1] - shapeHalf))
                continue;

            if (!mViewPortHandler.isInBoundsLeft(pointBuffer[0] + shapeHalf))
                continue;

            if (!mViewPortHandler.isInBoundsRight(pointBuffer[0] - shapeHalf))
                break;

            final int color = dataSet.getColor(entry.getXIndex());

            mRenderPaint.setColor(color);
            c.drawCircle(pointBuffer[0], pointBuffer[1], shapeHalf, mRenderPaint);
        }
    }
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:52,代码来源:BubbleChartRenderer.java


示例10: drawValues

import com.github.mikephil.charting.data.BubbleDataSet; //导入依赖的package包/类
@Override
public void drawValues(Canvas c) {

    BubbleData bubbleData = mChart.getBubbleData();

    if (bubbleData == null)
        return;

    // if values are drawn
    if (bubbleData.getYValCount() < (int) (Math.ceil((float) (mChart.getMaxVisibleCount())
            * mViewPortHandler.getScaleX()))) {

        final List<BubbleDataSet> dataSets = bubbleData.getDataSets();

        float lineHeight = Utils.calcTextHeight(mValuePaint, "1");

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

            BubbleDataSet dataSet = dataSets.get(i);

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

            // apply the text-styling defined by the DataSet
            applyValueTextStyle(dataSet);

            final float phaseX = mAnimator.getPhaseX();
            final float phaseY = mAnimator.getPhaseY();

            final float alpha = phaseX == 1 ? phaseY : phaseX;
            int valueTextColor = dataSet.getValueTextColor();
            valueTextColor = Color.argb(Math.round(255.f * alpha), Color.red(valueTextColor),
                    Color.green(valueTextColor), Color.blue(valueTextColor));

            mValuePaint.setColor(valueTextColor);

            final List<BubbleEntry> entries = dataSet.getYVals();

            Entry entryFrom = dataSet.getEntryForXIndex(mMinX);
            Entry entryTo = dataSet.getEntryForXIndex(mMaxX);

            int minx = dataSet.getEntryPosition(entryFrom);
            int maxx = Math.min(dataSet.getEntryPosition(entryTo) + 1, dataSet.getEntryCount());

            final float[] positions = mChart.getTransformer(dataSet.getAxisDependency())
                    .generateTransformedValuesBubble(entries, phaseX, phaseY, minx, maxx);

            for (int j = 0; j < positions.length; j += 2) {

                float x = positions[j];
                float y = positions[j + 1];

                if (!mViewPortHandler.isInBoundsRight(x))
                    break;

                if ((!mViewPortHandler.isInBoundsLeft(x) || !mViewPortHandler.isInBoundsY(y)))
                    continue;

                BubbleEntry entry = entries.get(j / 2 + minx);

                drawValue(c, dataSet.getValueFormatter(), entry.getSize(), entry, i, x,
                        y + (0.5f * lineHeight));
            }
        }
    }

}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:68,代码来源:BubbleChartRenderer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AmazonCloudSearchDomainClient类代码示例发布时间:2022-05-22
下一篇:
Java MapVariableInterpolator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap