當前位置: 首頁>>代碼示例>>Java>>正文


Java BarData.getDataSetCount方法代碼示例

本文整理匯總了Java中com.github.mikephil.charting.data.BarData.getDataSetCount方法的典型用法代碼示例。如果您正苦於以下問題:Java BarData.getDataSetCount方法的具體用法?Java BarData.getDataSetCount怎麽用?Java BarData.getDataSetCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.github.mikephil.charting.data.BarData的用法示例。


在下文中一共展示了BarData.getDataSetCount方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: recalculateDataSet

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
void recalculateDataSet(final BarData barData) {
    minBin = Math.floor(min / binWidth) * binWidth;
    maxBin = Math.floor(max / binWidth) * binWidth;

    int[][] bins = new int[rawData.size()][getNumBins()];

    for (int setNum = 0; setNum < rawData.size(); setNum++) {
        for (Double d : rawData.get(setNum)) {
            ++bins[setNum][(int) (Math.floor((d - minBin) / binWidth))];
        }
    }

    for (int setNum = 0; setNum < barData.getDataSetCount(); setNum++) {
        final IBarDataSet dataSet = barData.getDataSetByIndex(setNum);
        dataSet.clear();
        for (int i = 0; i < bins[setNum].length; i++) {
            dataSet.addEntry(new BarEntry(i, bins[setNum][i]));
        }
    }
    groupBars(barData);
    barData.notifyDataChanged();
}
 
開發者ID:google,項目名稱:walt,代碼行數:23,代碼來源:HistogramChart.java

示例2: initBuffers

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new BarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new BarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:BarChartRenderer.java

示例3: drawData

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
@Override
public void drawData(Canvas c) {

    BarData barData = mChart.getBarData();

    for (int i = 0; i < barData.getDataSetCount(); i++) {

        IBarDataSet set = barData.getDataSetByIndex(i);

        if (set.isVisible()) {
            drawDataSet(c, set, i);
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:BarChartRenderer.java

示例4: initBuffers

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new HorizontalBarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new HorizontalBarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:HorizontalBarChartRenderer.java

示例5: drawLabels

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
/**
 * draws the x-labels on the specified y-position
 * 
 * @param pos
 */
@Override
protected void drawLabels(Canvas c, float pos, PointF anchor) {

    final float labelRotationAngleDegrees = mXAxis.getLabelRotationAngle();

    // pre allocate to save performance (dont allocate in loop)
    float[] position = new float[] {
            0f, 0f
    };

    BarData bd = mChart.getData();
    int step = bd.getDataSetCount();

    for (int i = mMinX; i <= mMaxX; i += mXAxis.mAxisLabelModulus) {

        position[1] = i * step + i * bd.getGroupSpace()
                + bd.getGroupSpace() / 2f;
        
        // consider groups (center label for each group)
        if (step > 1) {
            position[1] += ((float) step - 1f) / 2f;
        }

        mTrans.pointValuesToPixel(position);

        if (mViewPortHandler.isInBoundsY(position[1])) {

            String label = mXAxis.getValues().get(i);
            drawLabel(c, label, i, pos, position[1], anchor, labelRotationAngleDegrees);
        }
    }
}
 
開發者ID:rahulmaddineni,項目名稱:Stayfit,代碼行數:38,代碼來源:XAxisRendererHorizontalBarChart.java

示例6: drawData

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
@Override
public void drawData(Canvas c) {

    BarData barData = mChart.getBarData();

    for (int i = 0; i < barData.getDataSetCount(); i++) {

        IBarDataSet set = barData.getDataSetByIndex(i);

        if (set.isVisible() && set.getEntryCount() > 0) {
            drawDataSet(c, set, i);
        }
    }
}
 
開發者ID:muyoumumumu,項目名稱:QuShuChe,代碼行數:15,代碼來源:BarChartRenderer.java

示例7: renderGridLines

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
@Override
public void renderGridLines(Canvas c) {

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

    float[] position = new float[] {
            0f, 0f
    };
    
    mGridPaint.setColor(mXAxis.getGridColor());
    mGridPaint.setStrokeWidth(mXAxis.getGridLineWidth());

    BarData bd = mChart.getData();
    // take into consideration that multiple DataSets increase mDeltaX
    int step = bd.getDataSetCount();

    for (int i = mMinX; i <= mMaxX; i += mXAxis.mAxisLabelModulus) {

        position[1] = i * step + i * bd.getGroupSpace() - 0.5f;

        mTrans.pointValuesToPixel(position);

        if (mViewPortHandler.isInBoundsY(position[1])) {

            c.drawLine(mViewPortHandler.contentLeft(), position[1],
                    mViewPortHandler.contentRight(), position[1], mGridPaint);
        }
    }
}
 
開發者ID:xinpengfei520,項目名稱:P2P,代碼行數:31,代碼來源:XAxisRendererHorizontalBarChart.java

示例8: initBuffers

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new BarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new BarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getGroupSpace(),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
開發者ID:rahulmaddineni,項目名稱:Stayfit,代碼行數:14,代碼來源:BarChartRenderer.java

示例9: generateTransformedValuesBarChart

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
/**
 * Transforms an List of Entry into a float array containing the x and
 * y values transformed with all matrices for the BARCHART.
 * 
 * @param entries
 * @param dataSet the dataset index
 * @return
 */
public float[] generateTransformedValuesBarChart(List<? extends Entry> entries,
        int dataSet, BarData bd, float phaseY) {

    float[] valuePoints = new float[entries.size() * 2];

    int setCount = bd.getDataSetCount();
    float space = bd.getGroupSpace();

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

        Entry e = entries.get(j / 2);
        int i = e.getXIndex();

        // calculate the x-position, depending on datasetcount
        float x = e.getXIndex() + i * (setCount - 1) + dataSet + space * i
                + space / 2f;
        float y = e.getVal();

        valuePoints[j] = x;
        valuePoints[j + 1] = y * phaseY;
    }

    getValueToPixelMatrix().mapPoints(valuePoints);

    return valuePoints;
}
 
開發者ID:xinpengfei520,項目名稱:P2P,代碼行數:35,代碼來源:Transformer.java

示例10: generateTransformedValuesBarChart

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
/**
 * Transforms an List of Entry into a float array containing the x and
 * y values transformed with all matrices for the BARCHART.
 *
 * @param data
 * @param dataSetIndex the dataset index
 * @param bd
 * @param phaseY
 * @return
 */
public float[] generateTransformedValuesBarChart(IBarDataSet data,
                                                 int dataSetIndex, BarData bd, float phaseY) {

    float[] valuePoints = new float[data.getEntryCount() * 2];

    int setCount = bd.getDataSetCount();
    float space = bd.getGroupSpace();

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

        Entry e = data.getEntryForIndex(j / 2);
        int i = e.getXIndex();

        // calculate the x-position, depending on datasetcount
        float x = e.getXIndex() + i * (setCount - 1) + dataSetIndex + space * i
                + space / 2f;
        float y = e.getVal();

        valuePoints[j] = x;
        valuePoints[j + 1] = y * phaseY;
    }

    getValueToPixelMatrix().mapPoints(valuePoints);

    return valuePoints;
}
 
開發者ID:rahulmaddineni,項目名稱:Stayfit,代碼行數:37,代碼來源:Transformer.java

示例11: initBuffers

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new BarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        BarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new BarBuffer(set.getValueCount() * 4 * set.getStackSize(),
                barData.getGroupSpace(),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
開發者ID:xinpengfei520,項目名稱:P2P,代碼行數:14,代碼來源:BarChartRenderer.java

示例12: initBuffers

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new HorizontalBarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new HorizontalBarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getGroupSpace(),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
開發者ID:muyoumumumu,項目名稱:QuShuChe,代碼行數:14,代碼來源:HorizontalBarChartRenderer.java

示例13: drawData

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
@Override
public void drawData(Canvas c) {

    BarData barData = mChart.getBarData();

    for (int i = 0; i < barData.getDataSetCount(); i++) {

        BarDataSet set = barData.getDataSetByIndex(i);

        if (set.isVisible() && set.getEntryCount() > 0) {
            drawDataSet(c, set, i);
        }
    }
}
 
開發者ID:xinpengfei520,項目名稱:P2P,代碼行數:15,代碼來源:BarChartRenderer.java

示例14: onProgressUpdate

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
@Override
protected void onProgressUpdate(TestCase.Metrics... values) {
    super.onProgressUpdate(values);
    mDataSetIndex = mChart.getData().getIndexOfDataSet(mDataSet);
    if (mDataSetIndex < 0) {
        mChart.getData().addDataSet(mDataSet);
        mDataSetIndex = mChart.getData().getIndexOfDataSet(mDataSet);
    }

    BarData data = mChart.getData();
    for (TestCase.Metrics m : values) {
        data.addEntry(new BarEntry(m.getVariable(), (float) m.getElapsedTime()), mDataSetIndex);
    }
    if (data.getDataSetCount() > 1) {
        int count = data.getDataSetCount();
        float groupSpace = 0.06f;
        float barSpace = 0.02f;
        float numBars = count;
        float barWidth = (1.0f - ((count - 1) * barSpace) - groupSpace) / numBars;

        Collections.sort(
                data.getDataSets(),
                new Comparator<IBarDataSet>() {
                    @Override
                    public int compare(IBarDataSet o1, IBarDataSet o2) {
                        float[] hsl1 = new float[3];
                        float[] hsl2 = new float[3];
                        ColorUtils.colorToHSL(o1.getColor(), hsl1);
                        ColorUtils.colorToHSL(o2.getColor(), hsl2);

                        if (Math.abs(hsl1[0] - hsl2[0]) > 10) {
                            return Float.compare(hsl1[0], hsl2[0]);
                        }

                        if (Math.abs(hsl1[2] - hsl2[2]) > 0.1) {
                            return Float.compare(hsl1[2], hsl2[2]);
                        }

                        return Float.compare(hsl1[1], hsl2[1]);
                    }
                }
        );

        data.setBarWidth(barWidth);
        data.groupBars(2, groupSpace, barSpace);
    }
    mChart.setFitBars(true);
    data.notifyDataChanged();
    mChart.notifyDataSetChanged();
    mChart.invalidate();
}
 
開發者ID:jasonwyatt,項目名稱:SQLite-Performance,代碼行數:52,代碼來源:TestCaseRunner.java

示例15: getHighlight

import com.github.mikephil.charting.data.BarData; //導入方法依賴的package包/類
@Override
public Highlight getHighlight(float x, float y) {

	BarData barData = mChart.getBarData();

	final int xIndex = getXIndex(x);
	final float baseNoSpace = getBase(x);
	final int setCount = barData.getDataSetCount();
	int dataSetIndex = ((int)baseNoSpace) % setCount;

	if (dataSetIndex < 0) {
		dataSetIndex = 0;
	} else if (dataSetIndex >= setCount) {
		dataSetIndex = setCount - 1;
	}

	SelectionDetail selectionDetail = getSelectionDetail(xIndex, y, dataSetIndex);
	if (selectionDetail == null)
		return null;

	IBarDataSet set = barData.getDataSetByIndex(dataSetIndex);
	if (set.isStacked()) {

		float[] pts = new float[2];
		pts[1] = y;

		// take any transformer to determine the x-axis value
		mChart.getTransformer(set.getAxisDependency()).pixelsToValue(pts);

		return getStackedHighlight(selectionDetail,
				set,
				xIndex,
				pts[1]);
	}

	return new Highlight(
			xIndex,
			selectionDetail.value,
			selectionDetail.dataIndex,
			selectionDetail.dataSetIndex,
			-1);
}
 
開發者ID:pencil-box,項目名稱:NetKnight,代碼行數:43,代碼來源:BarHighlighter.java


注:本文中的com.github.mikephil.charting.data.BarData.getDataSetCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。