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


Java BarData.setDrawValues方法代码示例

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


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

示例1: generateBarData

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private BarData generateBarData(List<Integer> progressSoFar) {

        ArrayList<BarEntry> barEntries = new ArrayList<>(progressSoFar.size());

        DateTime dateTime = new DateTime();
        referenceTime = dateTime.minusDays(7).getMillis();
        int totalSeconds = 0;
        for (int i = 0; i < progressSoFar.size(); i++) {
            int progress = progressSoFar.get(i);
            barEntries.add(new BarEntry(i, progress));
            totalSeconds += progress;
        }

        activityTotal.setText(context.getString(R.string.total_project_time,
                FormatUtils.getFormattedTime(context, totalSeconds)));

        BarDataSet barDataSet = new BarDataSet(barEntries, "");

        barDataSet.setColors(blue400);

        BarData barData = new BarData(barDataSet);
        barData.setBarWidth(0.85f);
        barData.setDrawValues(false);
        return barData;
    }
 
开发者ID:Protino,项目名称:CodeWatch,代码行数:26,代码来源:ProjectDetailsFragment.java

示例2: generateBarData

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private BarData generateBarData(int dailyGoal, List<Integer> progressSoFar) {


        ArrayList<BarEntry> barEntries = new ArrayList<>(progressSoFar.size());

        DateTime dateTime = new DateTime();
        referenceTime = dateTime.minusDays(7).getMillis();
        for (int i = 0; i < progressSoFar.size(); i++) {
            barEntries.add(new BarEntry(i, progressSoFar.get(i)));
        }

        BarDataSet barDataSet = new BarDataSet(barEntries, "");

        int colors[] = new int[progressSoFar.size()];
        for (int i = 0; i < progressSoFar.size(); i++) {
            colors[i] = (progressSoFar.get(i) >= dailyGoal * 60 * 60) ? green400 : red400;
        }
        barDataSet.setColors(colors);

        BarData barData = new BarData(barDataSet);
        barData.setBarWidth(0.85f);
        barData.setDrawValues(false);
        return barData;
    }
 
开发者ID:Protino,项目名称:CodeWatch,代码行数:25,代码来源:GoalsDetailFragment.java

示例3: setData

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private void setData(List<Integer> valueList, String format) {

        mChart.setVisibility(View.VISIBLE);

        ArrayList<String> xVals = new ArrayList<String>();
        ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();

        for (int i = 0; i < valueList.size(); i++) {
            xVals.add(i + "s");
            yVals1.add(new BarEntry(valueList.get(i), i));
        }

        String legend = "reception rate per second";

        if (!format.equals("%"))
            legend = "packet count per second";

        BarDataSet set1 = new BarDataSet(yVals1, legend);
        set1.setBarSpacePercent(35f);
        set1.setColor(Color.parseColor("#0288D1"));

        ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
        dataSets.add(set1);

        BarData data = new BarData(xVals, dataSets);
        data.setValueTextSize(10f);

        data.setDrawValues(false);

        YAxisValueFormatter custom = new DataAxisFormatter(format);
        YAxis leftAxis = mChart.getAxisLeft();
        YAxis rightAxis = mChart.getAxisRight();

        leftAxis.setValueFormatter(custom);
        rightAxis.setValueFormatter(custom);

        mChart.setData(data);
    }
 
开发者ID:bertrandmartel,项目名称:rfdroid-scanparam,代码行数:39,代码来源:BtDevicesActivity.java

示例4: setData

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private void setData(int count) {

        ArrayList<String> xVals = new ArrayList<String>();
        
        ArrayList<BarEntry> entries = new ArrayList<BarEntry>();
        
        for (int i = 0; i < count; i++) {
            xVals.add(i+"");
            entries.add(mSinusData.get(i));
        }
        
        BarDataSet set = new BarDataSet(entries, "Sinus Function");
        set.setBarSpacePercent(40f);
        set.setColor(Color.rgb(240, 120, 124));

        BarData data = new BarData(xVals, set);
        data.setValueTextSize(10f);
        data.setValueTypeface(mTf);
        data.setDrawValues(false);

        mChart.setData(data);
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:23,代码来源:BarChartActivitySinus.java

示例5: generateBarData

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private BarData generateBarData(float index, float dis) {

        ArrayList<BarEntry> entries = new ArrayList<>();


        for (int i = 0; i < count; i++) {
            float a = new Random().nextInt(40) / 100f + 0.1f;
            float b = new Random().nextInt(40) / 100f + 0.1f;
            entries.add(new BarEntry(index, new float[]{a, b, 1 - a - b}));
            index += dis;
        }

        BarDataSet set = new BarDataSet(entries, "hello");
        set.setStackLabels(new String[]{"1", "2"});
        set.setColors(new int[]{Color.rgb(154, 209, 253), Color.rgb(254, 206, 121), Color.rgb(253, 136, 95)});
        set.setValueTextColor(Color.rgb(61, 165, 255));
        set.setValueTextSize(10f);
        set.setAxisDependency(YAxis.AxisDependency.LEFT);


        ArrayList<IBarDataSet> threebardata = new ArrayList<>();

        BarData d = new BarData(threebardata);
        d.setBarWidth(0.4f);
        d.setDrawValues(true);

        d.addDataSet(set);

        d.setValueFormatter(new IValueFormatter() {
            @Override
            public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
                return toPercentDecimalStr(value);
            }
        });
        return d;
    }
 
开发者ID:xsingHu,项目名称:xs-android-architecture,代码行数:37,代码来源:MainActivity.java

示例6: setData

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private void setData(List<Integer> valueList, String format) {

        mChart.setVisibility(View.VISIBLE);

        ArrayList<String> xVals = new ArrayList<String>();
        ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();

        if (valueList != null) {
            for (int i = 0; i < valueList.size(); i++) {
                xVals.add(i + "s");
                yVals1.add(new BarEntry(valueList.get(i), i));
            }
        }

        String legend = getResources().getString(R.string.caption_receptin_rate);

        if (!format.equals("%"))
            legend = getResources().getString(R.string.caption_packet_count);

        BarDataSet set1 = new BarDataSet(yVals1, legend);
        set1.setBarSpacePercent(35f);
        set1.setColor(Color.parseColor("#0288D1"));

        ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
        dataSets.add(set1);

        BarData data = new BarData(xVals, dataSets);
        data.setValueTextSize(10f);

        data.setDrawValues(false);

        YAxisValueFormatter custom = new DataAxisFormatter(format);
        YAxis leftAxis = mChart.getAxisLeft();
        YAxis rightAxis = mChart.getAxisRight();

        leftAxis.setValueFormatter(custom);
        rightAxis.setValueFormatter(custom);

        mChart.setData(data);
    }
 
开发者ID:bertrandmartel,项目名称:bluetooth-le-analyzer,代码行数:41,代码来源:RFdroidActivity.java

示例7: setData

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
/**
 * update data for visualization chart
 *
 * @param valueList list of values for the chart
 * @param unit      data unit
 */
private void setData(List<Integer> valueList, String unit) {

    mChart.setVisibility(View.VISIBLE);

    ArrayList<String> xVals = new ArrayList<String>();
    ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();

    for (int i = 0; i < valueList.size(); i++) {
        xVals.add(i + "s");
        yVals1.add(new BarEntry(valueList.get(i), i));
    }

    String legend = getResources().getString(R.string.caption_receptin_rate);

    if (!unit.equals("%"))
        legend = getResources().getString(R.string.caption_packet_count);

    BarDataSet set1 = new BarDataSet(yVals1, legend);
    set1.setBarSpacePercent(35f);
    set1.setColor(Color.parseColor("#0288D1"));

    ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
    dataSets.add(set1);

    BarData data = new BarData(xVals, dataSets);
    data.setValueTextSize(10f);

    data.setDrawValues(false);

    YAxisValueFormatter custom = new DataAxisFormatter(unit);
    YAxis leftAxis = mChart.getAxisLeft();
    YAxis rightAxis = mChart.getAxisRight();

    leftAxis.setValueFormatter(custom);
    rightAxis.setValueFormatter(custom);

    mChart.setData(data);
}
 
开发者ID:bertrandmartel,项目名称:bluetooth-le-analyzer,代码行数:45,代码来源:AnalyzerActivity.java


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