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


Java BarData.getGroupSpace方法代码示例

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


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

示例1: 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

示例2: 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:rahulmaddineni,项目名称:Stayfit,代码行数:31,代码来源:XAxisRendererHorizontalBarChart.java

示例3: 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();
    int step = bd.getDataSetCount();

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

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

        mTrans.pointValuesToPixel(position);

        if (mViewPortHandler.isInBoundsX(position[0])) {

            c.drawLine(position[0], mViewPortHandler.offsetTop(), position[0],
                    mViewPortHandler.contentBottom(), mGridPaint);
        }
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:30,代码来源:XAxisRendererBarChart.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.getGroupSpace(),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:14,代码来源:HorizontalBarChartRenderer.java

示例5: 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

示例6: generateTransformedValuesHorizontalBarChart

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 dataSet the dataset index
 * @return
 */
public float[] generateTransformedValuesHorizontalBarChart(IBarDataSet data,
                                                           int dataSet, 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 = i + i * (setCount - 1) + dataSet + space * i
                + space / 2f;
        float y = e.getVal();

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

    getValueToPixelMatrix().mapPoints(valuePoints);

    return valuePoints;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:35,代码来源:Transformer.java

示例7: 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:pencil-box,项目名称:NetKnight,代码行数:14,代码来源:BarChartRenderer.java

示例8: 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) {

    // 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] + mXAxis.mLabelHeight / 2f);
        }
    }
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:36,代码来源:XAxisRendererHorizontalBarChart.java

示例9: generateTransformedValuesHorizontalBarChart

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[] generateTransformedValuesHorizontalBarChart(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 = i + i * (setCount - 1) + dataSet + space * i
                + space / 2f ;
        float y = e.getVal();

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

    getValueToPixelMatrix().mapPoints(valuePoints);

    return valuePoints;
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:35,代码来源:Transformer.java

示例10: 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++) {
        BarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new HorizontalBarBuffer(set.getValueCount() * 4 * set.getStackSize(),
                barData.getGroupSpace(),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:14,代码来源:HorizontalBarChartRenderer.java


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