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


Java BarDataSet.getYVals方法代码示例

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


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

示例1: insertChartSample

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
/**
 * Procedure to add last DetailsData sample to chart.
 * @param data
 * @param chart
 */
private void insertChartSample(DetailsData data, BarChart chart, @Nullable Beacon beacon) {
    data.insertAndUpdate(beacon);
    BarData barData = chart.getData();
    BarDataSet set = barData.getDataSetByIndex(0);
    if(set.getEntryCount() == mPresenter.getSamplesCount()) {
        barData.removeXValue(0);
        set.removeEntry(0);
        for (Entry entry : set.getYVals()) {
            entry.setXIndex(entry.getXIndex() - 1);
        }
    }
    barData.addXValue(" ");
    BarEntry newEntry = new BarEntry(
            data.getCurrentValue(mPresenter.getMode()),
            set.getEntryCount());
    barData.addEntry(newEntry, 0);
    setChartRange(chart, data, mPresenter.getAutoscale());
    setChartAverage(chart, data, mPresenter.getAverage());

    chart.notifyDataSetChanged();
    chart.invalidate();
}
 
开发者ID:stanleyguevara,项目名称:beaconradar,代码行数:28,代码来源:DetailsActivity.java

示例2: drawDataSet

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

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

        mShadowPaint.setColor(dataSet.getBarShadowColor());

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

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

        // initialize the buffer
        BarBuffer buffer = mBarBuffers[index];
        buffer.setPhases(phaseX, phaseY);
        buffer.setBarSpace(dataSet.getBarSpace());
        buffer.setDataSet(index);
        buffer.setInverted(mChart.isInverted(dataSet.getAxisDependency()));

        buffer.feed(entries);

        trans.pointValuesToPixel(buffer.buffer);

        // if multiple colors
        if (dataSet.getColors().size() > 1) {

            for (int j = 0; j < buffer.size(); j += 4) {

                if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[j + 2]))
                    continue;

                if (!mViewPortHandler.isInBoundsRight(buffer.buffer[j]))
                    break;

                if (mChart.isDrawBarShadowEnabled()) {
                    c.drawRect(buffer.buffer[j], mViewPortHandler.contentTop(),
                            buffer.buffer[j + 2],
                            mViewPortHandler.contentBottom(), mShadowPaint);
                }

                // Set the color for the currently drawn value. If the index
                // is
                // out of bounds, reuse colors.
                mRenderPaint.setColor(dataSet.getColor(j / 4));
                c.drawRect(buffer.buffer[j], buffer.buffer[j + 1], buffer.buffer[j + 2],
                        buffer.buffer[j + 3], mRenderPaint);
            }
        } else {

            mRenderPaint.setColor(dataSet.getColor());

            for (int j = 0; j < buffer.size(); j += 4) {

                if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[j + 2]))
                    continue;

                if (!mViewPortHandler.isInBoundsRight(buffer.buffer[j]))
                    break;

                if (mChart.isDrawBarShadowEnabled()) {
                    c.drawRect(buffer.buffer[j], mViewPortHandler.contentTop(),
                            buffer.buffer[j + 2],
                            mViewPortHandler.contentBottom(), mShadowPaint);
                }

                c.drawRect(buffer.buffer[j], buffer.buffer[j + 1], buffer.buffer[j + 2],
                        buffer.buffer[j + 3], mRenderPaint);
            }
        }
    }
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:70,代码来源:BarChartRenderer.java

示例3: drawDataSet

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

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

        mShadowPaint.setColor(dataSet.getBarShadowColor());

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

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

        // initialize the buffer
        BarBuffer buffer = mBarBuffers[index];
        buffer.setPhases(phaseX, phaseY);
        buffer.setBarSpace(dataSet.getBarSpace());
        buffer.setDataSet(index);
        buffer.setInverted(mChart.isInverted(dataSet.getAxisDependency()));

        buffer.feed(entries);

        trans.pointValuesToPixel(buffer.buffer);

        for (int j = 0; j < buffer.size(); j += 4) {

            if (!mViewPortHandler.isInBoundsTop(buffer.buffer[j + 3]))
                break;

            if (!mViewPortHandler.isInBoundsBottom(buffer.buffer[j + 1]))
                continue;

            if (mChart.isDrawBarShadowEnabled()) {
                c.drawRect(mViewPortHandler.contentLeft(), buffer.buffer[j + 1],
                        mViewPortHandler.contentRight(),
                        buffer.buffer[j + 3], mShadowPaint);
            }

            // Set the color for the currently drawn value. If the index
            // is
            // out of bounds, reuse colors.
            mRenderPaint.setColor(dataSet.getColor(j / 4));
            c.drawRect(buffer.buffer[j], buffer.buffer[j + 1], buffer.buffer[j + 2],
                    buffer.buffer[j + 3], mRenderPaint);
        }
    }
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:45,代码来源:HorizontalBarChartRenderer.java


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