Java Code Examples for com.github.mikephil.charting.data.BubbleData#getDataSets()

The following examples show how to use com.github.mikephil.charting.data.BubbleData#getDataSets() . 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: BubbleChartRenderer.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    BubbleData bubbleData = mChart.getBubbleData();

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

        if (set.isVisible()) {
            drawDataSet(c, set);
        }
    }
}
 
Example 2
Source File: BubbleChartRenderer.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    BubbleData bubbleData = mChart.getBubbleData();

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

        if (set.isVisible())
            drawDataSet(c, set);
    }
}
 
Example 3
Source File: BubbleChartRenderer.java    From android-kline with Apache License 2.0 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    BubbleData bubbleData = mChart.getBubbleData();

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

        if (set.isVisible())
            drawDataSet(c, set);
    }
}
 
Example 4
Source File: BubbleChartRenderer.java    From android-kline with Apache License 2.0 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    BubbleData bubbleData = mChart.getBubbleData();

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

        if (set.isVisible())
            drawDataSet(c, set);
    }
}
 
Example 5
Source File: BubbleChartRenderer.java    From iMoney with Apache License 2.0 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    BubbleData bubbleData = mChart.getBubbleData();

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

        if (set.isVisible() && set.getEntryCount() > 0)
            drawDataSet(c, set);
    }
}
 
Example 6
Source File: BubbleChartRenderer.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    BubbleData bubbleData = mChart.getBubbleData();

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

        if (set.isVisible() && set.getEntryCount() > 0)
            drawDataSet(c, set);
    }
}
 
Example 7
Source File: BubbleChartRenderer.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    BubbleData bubbleData = mChart.getBubbleData();

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

        if (set.isVisible() && set.getEntryCount() > 0)
            drawDataSet(c, set);
    }
}
 
Example 8
Source File: BubbleChartRenderer.java    From iMoney with Apache License 2.0 2 votes vote down vote up
@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));
            }
        }
    }

}
 
Example 9
Source File: BubbleChartRenderer.java    From Stayfit with Apache License 2.0 2 votes vote down vote up
@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<IBubbleDataSet> dataSets = bubbleData.getDataSets();

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

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

            IBubbleDataSet 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();

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

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

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

            final float alpha = phaseX == 1 ? phaseY : phaseX;

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

                int valueTextColor = dataSet.getValueTextColor(j / 2 + minx);
                valueTextColor = Color.argb(Math.round(255.f * alpha), Color.red(valueTextColor),
                        Color.green(valueTextColor), Color.blue(valueTextColor));

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

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

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

                BubbleEntry entry = dataSet.getEntryForIndex(j / 2 + minx);

                drawValue(c, dataSet.getValueFormatter(), entry.getSize(), entry, i, x,
                        y + (0.5f * lineHeight), valueTextColor);
            }
        }
    }
}
 
Example 10
Source File: BubbleChartRenderer.java    From NetKnight with Apache License 2.0 2 votes vote down vote up
@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<IBubbleDataSet> dataSets = bubbleData.getDataSets();

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

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

            IBubbleDataSet dataSet = dataSets.get(i);

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

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

            final float phaseX = Math.max(0.f, Math.min(1.f, mAnimator.getPhaseX()));
            final float phaseY = mAnimator.getPhaseY();

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

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

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

            final float alpha = phaseX == 1 ? phaseY : phaseX;

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

                int valueTextColor = dataSet.getValueTextColor(j / 2 + minx);
                valueTextColor = Color.argb(Math.round(255.f * alpha), Color.red(valueTextColor),
                        Color.green(valueTextColor), Color.blue(valueTextColor));

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

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

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

                BubbleEntry entry = dataSet.getEntryForIndex(j / 2 + minx);

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