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


Java BarDataSet.getStackSize方法代码示例

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


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

示例1: initBuffers

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的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

示例2: initBuffers

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的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

示例3: prepareLegend

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
/**
 * Generates an automatically prepared legend depending on the DataSets in
 * the chart and their colors.
 */
public void prepareLegend() {

    ArrayList<String> labels = new ArrayList<String>();
    ArrayList<Integer> colors = new ArrayList<Integer>();

    // loop for building up the colors and labels used in the legend
    for (int i = 0; i < mData.getDataSetCount(); i++) {

        DataSet<? extends Entry> dataSet = mData.getDataSetByIndex(i);

        ArrayList<Integer> clrs = dataSet.getColors();
        int entryCount = dataSet.getEntryCount();

        // if we have a barchart with stacked bars
        if (dataSet instanceof BarDataSet && ((BarDataSet) dataSet).getStackSize() > 1) {

            BarDataSet bds = (BarDataSet) dataSet;
            String[] sLabels = bds.getStackLabels();

            for (int j = 0; j < clrs.size() && j < entryCount && j < bds.getStackSize(); j++) {

                labels.add(sLabels[j % sLabels.length]);
                colors.add(clrs.get(j));
            }

            // add the legend description label
            colors.add(-2);
            labels.add(bds.getLabel());

        } else if (dataSet instanceof PieDataSet) {

            ArrayList<String> xVals = mData.getXVals();
            PieDataSet pds = (PieDataSet) dataSet;

            for (int j = 0; j < clrs.size() && j < entryCount && j < xVals.size(); j++) {

                labels.add(xVals.get(j));
                colors.add(clrs.get(j));
            }

            // add the legend description label
            colors.add(-2);
            labels.add(pds.getLabel());

        } else { // all others

            for (int j = 0; j < clrs.size() && j < entryCount; j++) {

                // if multiple colors are set for a DataSet, group them
                if (j < clrs.size() - 1 && j < entryCount - 1) {

                    labels.add(null);
                } else { // add label to the last entry

                    String label = mData.getDataSetByIndex(i).getLabel();
                    labels.add(label);
                }

                colors.add(clrs.get(j));
            }
        }
    }

    Legend l = new Legend(colors, labels);

    if (mLegend != null) {
        // apply the old legend settings to a potential new legend
        l.apply(mLegend);
    }

    mLegend = l;
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:77,代码来源:Chart.java

示例4: prepareLegend

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
/**
 * Generates an automatically prepared legend depending on the DataSets in
 * the chart and their colors.
 */
public void prepareLegend() {

    ArrayList<String> labels = new ArrayList<String>();
    ArrayList<Integer> colors = new ArrayList<Integer>();

    // loop for building up the colors and labels used in the legend
    for (int i = 0; i < mOriginalData.getDataSetCount(); i++) {

        DataSet<? extends Entry> dataSet = mOriginalData.getDataSetByIndex(i);

        ArrayList<Integer> clrs = dataSet.getColors();
        int entryCount = dataSet.getEntryCount();

        // if we have a barchart with stacked bars
        if (dataSet instanceof BarDataSet && ((BarDataSet) dataSet).getStackSize() > 1) {

            BarDataSet bds = (BarDataSet) dataSet;
            String[] sLabels = bds.getStackLabels();

            for (int j = 0; j < clrs.size() && j < entryCount && j < bds.getStackSize(); j++) {

                labels.add(sLabels[j % sLabels.length]);
                colors.add(clrs.get(j));
            }

            // add the legend description label
            colors.add(-2);
            labels.add(bds.getLabel());

        } else if (dataSet instanceof PieDataSet) {

            ArrayList<String> xVals = mOriginalData.getXVals();
            PieDataSet pds = (PieDataSet) dataSet;

            for (int j = 0; j < clrs.size() && j < entryCount && j < xVals.size(); j++) {

                labels.add(xVals.get(j));
                colors.add(clrs.get(j));
            }

            // add the legend description label
            colors.add(-2);
            labels.add(pds.getLabel());

        } else { // all others

            for (int j = 0; j < clrs.size() && j < entryCount; j++) {

                // if multiple colors are set for a DataSet, group them
                if (j < clrs.size() - 1 && j < entryCount - 1) {

                    labels.add(null);
                } else { // add label to the last entry

                    String label = mOriginalData.getDataSetByIndex(i).getLabel();
                    labels.add(label);
                }

                colors.add(clrs.get(j));
            }
        }
    }

    Legend l = new Legend(colors, labels);

    if (mLegend != null) {
        // apply the old legend settings to a potential new legend
        l.apply(mLegend);
    }

    mLegend = l;
}
 
开发者ID:MPieter,项目名称:Notification-Analyser,代码行数:77,代码来源:Chart.java


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