當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。