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


Java PieData.setValueTextSize方法代码示例

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


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

示例1: setData

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

        RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();

        RealmPieDataSet<RealmDemoData> set = new RealmPieDataSet<RealmDemoData>(result, "yValue", "label");
        set.setColors(ColorTemplate.VORDIPLOM_COLORS);
        set.setLabel("Example market share");
        set.setSliceSpace(2);

        // create a data object with the dataset list
        PieData data = new PieData(set);
        styleData(data);
        data.setValueTextColor(Color.WHITE);
        data.setValueTextSize(12f);

        // set data
        mChart.setData(data);
        mChart.animateY(1400);
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:RealmDatabaseActivityPie.java

示例2: setData

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

        ArrayList<PieEntry> values = new ArrayList<PieEntry>();

        for (int i = 0; i < count; i++) {
            values.add(new PieEntry((float) ((Math.random() * range) + range / 5), mParties[i % mParties.length]));
        }

        PieDataSet dataSet = new PieDataSet(values, "Election Results");
        dataSet.setSliceSpace(3f);
        dataSet.setSelectionShift(5f);

        dataSet.setColors(ColorTemplate.MATERIAL_COLORS);
        //dataSet.setSelectionShift(0f);

        PieData data = new PieData(dataSet);
        data.setValueFormatter(new PercentFormatter());
        data.setValueTextSize(11f);
        data.setValueTextColor(Color.WHITE);
        data.setValueTypeface(mTfLight);
        mChart.setData(data);

        mChart.invalidate();
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:HalfPieChartActivity.java

示例3: setPieChartData

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
private void setPieChartData(int count, float range) {

        ArrayList<PieEntry> entries = ChartData.getPieData(count, range);
        PieDataSet dataSet = new PieDataSet(entries, "Weekly spend distribution");

        dataSet.setDrawIcons(false);
        dataSet.setSliceSpace(3f);
        dataSet.setIconsOffset(new MPPointF(0, 40));
        dataSet.setSelectionShift(5f);

        ArrayList<Integer> colors = new ArrayList<>();
        for (int c : ColorTemplate.LIBERTY_COLORS)
            colors.add(c);
        dataSet.setColors(colors);

        PieData data = new PieData(dataSet);
        data.setValueFormatter(new PercentFormatter());
        data.setValueTextSize(11f);
        data.setValueTextColor(Color.GRAY);
        pieChart.setData(data);
        pieChart.highlightValues(null);
        pieChart.invalidate();
    }
 
开发者ID:VidyaSastry,项目名称:Opal-Chat-AnalyticsDashboard,代码行数:24,代码来源:DashboardFragment.java

示例4: setData

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
private void setData(long tips, long transactionsToRequest) {

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

        entries.add(new PieEntry(tips, getString(R.string.tips) + " " + "(" + tips + ")"));
        entries.add(new PieEntry(transactionsToRequest, getString(R.string.transactions_to_request) + " " + "(" + transactionsToRequest + ")"));

        PieDataSet dataSet = new PieDataSet(entries, getString(R.string.transactions) + "\n(" + (tips + transactionsToRequest) + ")");

        dataSet.setSliceSpace(3f);
        dataSet.setSelectionShift(5f);

        // add a lot of colors

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

        for (int c : ColorTemplate.LIBERTY_COLORS)
            colors.add(c);

        dataSet.setColors(colors);

        dataSet.setValueLinePart1OffsetPercentage(80.f);
        dataSet.setValueLinePart1Length(0.2f);
        dataSet.setValueLinePart2Length(0.4f);
        dataSet.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
        dataSet.setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
        dataSet.setValueTextColor(ContextCompat.getColor(getActivity(), R.color.colorPrimary));

        PieData data = new PieData(dataSet);
        data.setValueFormatter(new PercentFormatter());
        data.setValueTextSize(12f);
        data.setValueTextColor(ContextCompat.getColor(getActivity(), R.color.colorPrimary));
        chart.setData(data);

        // undo all highlights
        chart.highlightValues(null);
        chart.invalidate();
    }
 
开发者ID:iotaledger,项目名称:android-wallet-app,代码行数:39,代码来源:NodeInfoFragment.java

示例5: getData

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
@NonNull
private PieData getData(Leader leader) {
    RealmList<Language> languages = leader.getRunningTotal().getLanguages();
    List<PieEntry> entries = new ArrayList<>(languages.size());
    List<Integer> colors = new ArrayList<>(languages.size());
    for (Language language : languages) {
        entries.add(new PieEntry(language.getTotalSeconds(), language.getName()));
        colors.add(linguist.decode(language.getName()));
    }
    PieDataSet pieDataSet = new PieDataSet(entries, getString(R.string.languages));

    pieDataSet.setColors(colors);
    pieDataSet.setSliceSpace(3f);
    pieDataSet.setSelectionShift(5f);
    PieData pieData = new PieData(pieDataSet);
    pieData.setValueFormatter((value, entry, dataSetIndex, viewPortHandler) -> String.valueOf(toMinutes((long) value)));
    pieData.setValueTextSize(16f);
    pieData.setValueTextColor(Color.WHITE);
    return pieData;
}
 
开发者ID:omgitsjoao,项目名称:wakatime-android-client,代码行数:21,代码来源:LeaderProfileFragment.java

示例6: addPieChartData

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
private void addPieChartData(int correctAnswer, int noOfQuestion) {
    float[] yData;
    String[] xData = {getString(R.string.correct_quantity), getString(R.string.incorrect_quantity)};

    ArrayList<Integer> colors = new ArrayList<>();
    colors.add(ContextCompat.getColor(getContext(), R.color.colorDarkBlue));
    colors.add(ContextCompat.getColor(getContext(), R.color.colorRaspberry));

    if (correctAnswer == noOfQuestion) {
        yData = new float[]{100};
    } else if (correctAnswer == 0) {
        yData = new float[]{100};
        colors.remove(0);
    } else {
        float good = (float) correctAnswer * 100 / noOfQuestion;
        yData = new float[]{good, 100 - good};
    }

    ArrayList<Entry> yValues = new ArrayList<>();
    for (int i = 0; i < yData.length; i++)
        yValues.add(new Entry(yData[i], i));

    ArrayList<String> xValues = new ArrayList<>();
    Collections.addAll(xValues, xData);

    PieDataSet dataSet = new PieDataSet(yValues, getString(R.string.your_score));
    dataSet.setColors(colors);
    dataSet.setSliceSpace(5);
    dataSet.setSelectionShift(10);

    PieData data = new PieData(xValues, dataSet);
    data.setValueFormatter(new PercentFormatter());
    data.setValueTextColor(ContextCompat.getColor(getContext(), R.color.colorGrey));
    data.setValueTextSize(20);

    pieChart.setData(data);
    pieChart.highlightValues(null);
    pieChart.invalidate();
}
 
开发者ID:blstream,项目名称:StudyBox_Android,代码行数:40,代码来源:ResultDialogFragment.java

示例7: setChartData

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
private void setChartData(PieChart chart, List<Integer> yData) {
    ArrayList<Entry> yVals = new ArrayList<>();

    for (int i = 0; i < yData.size(); ++i) {
        yVals.add(new Entry(yData.get(i), i));
    }

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

    for (int i = 0; i < xData.length; ++i) {
        xVals.add(xData[i]);
    }

    PieDataSet dataSet = new PieDataSet(yVals, "");
    dataSet.setSliceSpace(3);
    dataSet.setSelectionShift(5);

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

    colors.add(0xFFDD2C00);
    colors.add(0xFFFF6D00);
    colors.add(0xFFFFAB00);
    colors.add(0xFFAEEA00);
    colors.add(0xFF64DD17);

    dataSet.setColors(colors);

    PieData data = new PieData(xVals, dataSet);
    data.setValueFormatter(new PercentFormatter());
    data.setValueTextSize(15f);
    data.setValueTextColor(Color.BLACK);
    chart.setData(data);
    chart.highlightValues(null);
    chart.invalidate();
}
 
开发者ID:kaiomax,项目名称:RUSpotlight,代码行数:36,代码来源:StatisticsFragment.java

示例8: setData

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
private void setData(PieChart colorPie, float value) {

        ArrayList<PieEntry> entries = new ArrayList<PieEntry>();
        float result = value / 5f;
        Log.d(TAG + " result ", result + "");
        entries.add(new PieEntry(result, 0));
        entries.add(new PieEntry(1 - result, 1));
        // NOTE: The order of the entries when being added to the entries array determines their position around the center of
        // the chart.

//        colorPie.setCenterTextTypeface(mTfLight);
        int centerTextColor = android.graphics.Color.argb(255, 57, 197, 193);
        colorPie.setCenterTextColor(centerTextColor);

        PieDataSet dataSet = new PieDataSet(entries, "");
        dataSet.setSliceSpace(3f);
        dataSet.setSelectionShift(3f);

        // add a lot of colors
        ArrayList<Integer> colors = new ArrayList<Integer>();
        colors.add(Color.argb(120, 57, 197, 193));
        colorPie.setCenterText(value + "");
        colorPie.setCenterTextSize(30);

        colors.add(Color.argb(100, 214, 214, 214));
        dataSet.setColors(colors);

        PieData data = new PieData(dataSet);
        data.setValueFormatter(new PercentFormatter());
        data.setValueTextSize(0f);
        data.setValueTextColor(Color.WHITE);
        colorPie.setData(data);

        // undo all highlights
        colorPie.highlightValues(null);

        colorPie.invalidate();
    }
 
开发者ID:clementf2b,项目名称:FaceT,代码行数:39,代码来源:ProductDetailActivity.java

示例9: createPieData

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
public PieData createPieData(PieDataSet pieDataSet) {
    PieData pieData = new PieData(pieDataSet);
    pieData.setValueFormatter(new PercentFormatter());
    pieData.setValueTextSize(15f);
    pieData.setValueTextColor(utilsUI.getColor(android.R.color.white));
    return pieData;
}
 
开发者ID:MLSDev,项目名称:RecipeFinderJavaVersion,代码行数:8,代码来源:DiagramUtils.java

示例10: updateChartData

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
private void updateChartData(PieChart chart) {
    ArrayList<PieEntry> entries = new ArrayList<>();
    ArrayList<Integer> colors = new ArrayList<>();

    double sum = 0;
    for (int i = 0; i < categorizedExpenses.getCategories().size(); i++) {
        Category c = categorizedExpenses.getCategory(i);
        Report r = categorizedExpenses.getReport(c);
        sum += r.getTotalAmount().doubleValue();
        entries.add(new PieEntry((int) (r.getTotalAmount().doubleValue() * 1000), c.getTitle()));
        colors.add(c.getColor());
    }

    PieDataSet dataSet = new PieDataSet(entries, "Outlay");
    dataSet.setSliceSpace(2f);
    dataSet.setSelectionShift(10f);
    dataSet.setColors(colors);

    PieData data = new PieData(dataSet);
    data.setValueFormatter((value, entry, dataSetIndex, viewPortHandler) -> NumberUtils.formatAmount((double) value / 1000));
    data.setValueTextSize(11f);
    data.setValueTextColor(Color.WHITE);
    chart.setData(data);
    chart.setCenterText(NumberUtils.formatAmount(sum));
    chart.highlightValues(null);
    chart.invalidate();
}
 
开发者ID:bmelnychuk,项目名称:outlay,代码行数:28,代码来源:ReportAdapter.java

示例11: setupSleepStagesChart

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
private void setupSleepStagesChart(int sleep, int awake) {

        PieChart pieChart = (PieChart) findViewById(R.id.sleepstages);

        ArrayList<Entry> pieComp1 = new ArrayList<Entry>();
        Entry c1e1 = new Entry(sleep, 0);
        pieComp1.add(c1e1);
        Entry c1e2 = new Entry(awake, 1);
        pieComp1.add(c1e2);

        PieDataSet pieDataSet = new PieDataSet(pieComp1, "Sleep stages");
        pieDataSet.setColors(ColorTemplate.PASTEL_COLORS);

        ArrayList<String> xPieVals = new ArrayList<String>();
        xPieVals.add("Deep");
        xPieVals.add("Light");

        PieData pieData = new PieData(xPieVals,pieDataSet);
        pieData.setValueTextSize(14);
        pieData.setValueTextColor(Color.WHITE);
        pieChart.setData(pieData);

        Legend pieLegend = pieChart.getLegend();
        pieLegend.setEnabled(false);

        pieChart.setUsePercentValues(true);
        pieChart.setDescription("Sleep stages");
        pieChart.setHardwareAccelerationEnabled(true);
        pieChart.setBackgroundColor(Color.parseColor("#52B19D"));

        pieChart.setHoleColor(Color.parseColor("#52B09C"));

        pieChart.invalidate();
    }
 
开发者ID:Sopamo,项目名称:sleepminder,代码行数:35,代码来源:SingleNight.java

示例12: setupLightChart

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
private void setupLightChart(int night, int dawn, int day) {

        PieChart pieChart = (PieChart) findViewById(R.id.lightquality);

        ArrayList<Entry> pieComp1 = new ArrayList<Entry>();
        Entry c1e1 = new Entry(night, 0);
        pieComp1.add(c1e1);
        Entry c1e2 = new Entry(dawn, 1);
        pieComp1.add(c1e2);
        Entry c1e3 = new Entry(day, 2);
        pieComp1.add(c1e3);

        PieDataSet pieDataSet = new PieDataSet(pieComp1, "Light quality");
        pieDataSet.setColors(ColorTemplate.PASTEL_COLORS);

        ArrayList<String> xPieVals = new ArrayList<String>();
        xPieVals.add("Night");
        xPieVals.add("Dawn");
        xPieVals.add("Day");

        PieData pieData = new PieData(xPieVals,pieDataSet);
        pieData.setValueTextSize(14);
        pieData.setValueTextColor(Color.WHITE);
        pieChart.setData(pieData);

        Legend pieLegend = pieChart.getLegend();
        pieLegend.setEnabled(false);

        pieChart.setUsePercentValues(true);
        pieChart.setDescription("Light quality");
        pieChart.setHardwareAccelerationEnabled(true);

        pieChart.setHoleColor(Color.parseColor("#52B09C"));

        pieChart.invalidate();
    }
 
开发者ID:Sopamo,项目名称:sleepminder,代码行数:37,代码来源:SingleNight.java

示例13: setRNEData

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
private void setRNEData(List<Double> classRangeValue) {
    ArrayList<Entry> yVals1 = new ArrayList<Entry>();

    // IMPORTANT: In a PieChart, no values (Entry) should have the same
    // xIndex (even if from different DataSets), since no values can be
    // drawn above each other.
    catNE= getResources().getStringArray(R.array.catNE_list_array);
    ArrayList<String> xVals = new ArrayList<String>();
    double maxValue = 0;
    int maxClassId = 0;
    for (int idEntry = 0; idEntry < classRangeValue.size(); idEntry++) {
        float value = classRangeValue.get(classRangeValue.size() - 1 - idEntry).floatValue();
        // Fix background color issue if the pie is too thin
        if(value < 0.01) {
            value = 0;
        }
        yVals1.add(new Entry(value, idEntry));
        xVals.add(catNE[idEntry]);
        if (value > maxValue) {
            maxClassId = idEntry;
            maxValue = value;
        }
    }

    PieDataSet dataSet = new PieDataSet(yVals1,Results.this.getString(R.string.caption_SL));
    dataSet.setSliceSpace(3f);
    dataSet.setColors(NE_COLORS);

    PieData data = new PieData(xVals, dataSet);
    data.setValueFormatter(new CustomPercentFormatter());
    data.setValueTextSize(8f);
    data.setValueTextColor(Color.BLACK);
    rneChart.setData(data);

    // highlight the maximum value of the RNE
    // Find the maximum of the array, in order to be highlighted
    Highlight h = new Highlight(maxClassId, 0);
    rneChart.highlightValues(new Highlight[] { h });
    rneChart.invalidate();
}
 
开发者ID:Ifsttar,项目名称:NoiseCapture,代码行数:41,代码来源:Results.java

示例14: setNEIData

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

        ArrayList<Entry> yVals1 = new ArrayList<Entry>();

        // IMPORTANT: In a PieChart, no values (Entry) should have the same
        // xIndex (even if from different DataSets), since no values can be
        // drawn above each other.
        yVals1.add(new Entry( record.getLeqMean(), 0));

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

        xVals.add(catNE[0 % catNE.length]);

        PieDataSet dataSet = new PieDataSet(yVals1, "NEI");
        dataSet.setSliceSpace(3f);
        int nc=getNEcatColors(record.getLeqMean());    // Choose the color category in function of the sound level
        dataSet.setColor(NE_COLORS[nc]);   // Apply color category for the corresponding sound level

        PieData data = new PieData(xVals, dataSet);
        data.setValueFormatter(new PercentFormatter());
        data.setValueTextSize(11f);
        data.setValueTextColor(Color.BLACK);
        data.setDrawValues(false);

        neiChart.setData(data);
        neiChart.setCenterText(String.format(Locale.getDefault(), "%.1f", record.getLeqMean())
                .concat(" dB(A)" + ""));
        neiChart.invalidate();
    }
 
开发者ID:Ifsttar,项目名称:NoiseCapture,代码行数:30,代码来源:Results.java

示例15: setCategoriesPieChart

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

        List<String> categoriesNames = new ArrayList<>();
        List<Entry> categoryPercentagesEntries = new ArrayList<>();

        for (int i=0; i < mCategoryList.size(); i++) {
            float percentage = Expense.getExpensesCategoryPercentage(DateManager.getInstance().getDateFrom(), DateManager.getInstance().getDateTo(), mCategoryList.get(i));
            if( percentage > 0) {
                categoriesNames.add(mCategoryList.get(i).getName());
                Entry pieEntry = new Entry(percentage, categoriesNames.size()-1);
                categoryPercentagesEntries.add(pieEntry);
            }
        }
        if (categoriesNames.isEmpty()) {
            tvPcCategoriesEmpty.setVisibility(View.VISIBLE);
            bcCategories.setVisibility(View.GONE);
        } else {
            tvPcCategoriesEmpty.setVisibility(View.GONE);
            bcCategories.setVisibility(View.VISIBLE);
        }

        PieDataSet dataSet = new PieDataSet(categoryPercentagesEntries, "Categories");
        dataSet.setSliceSpace(1f);
        dataSet.setSelectionShift(5f);

        dataSet.setColors(Util.getListColors());

        PieData data = new PieData(categoriesNames, dataSet);
        data.setValueFormatter(new PercentFormatter());
        data.setValueTextSize(11f);
        data.setValueTextColor(getResources().getColor(R.color.primary_dark));
        pcCategories.setData(data);
        pcCategories.invalidate();

    }
 
开发者ID:PedroCarrillo,项目名称:Expense-Tracker-App,代码行数:36,代码来源:StatisticsFragment.java


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