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


Java PieData.setDrawValues方法代码示例

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


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

示例1: refreshDaySteps

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
private DaySteps refreshDaySteps(DBHandler db, Calendar day, GBDevice device) {
    ActivityAnalysis analysis = new ActivityAnalysis();

    int totalSteps = analysis.calculateTotalSteps(getSamplesOfDay(db, day, device));

    PieData data = new PieData();
    List<Entry> entries = new ArrayList<>();
    List<Integer> colors = new ArrayList<>();

    entries.add(new Entry(totalSteps, 0));
    colors.add(akActivity.color);
    //we don't want labels on the pie chart
    data.addXValue("");

    if (totalSteps < mTargetSteps) {
        entries.add(new Entry((mTargetSteps - totalSteps), 1));
        colors.add(Color.GRAY);
        //we don't want labels on the pie chart
        data.addXValue("");
    }

    PieDataSet set = new PieDataSet(entries, "");
    set.setColors(colors);
    data.setDataSet(set);
    //this hides the values (numeric) added to the set. These would be shown aside the strings set with addXValue above
    data.setDrawValues(false);

    return new DaySteps(data, totalSteps);
}
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:30,代码来源:WeekStepsChartFragment.java

示例2: 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

示例3: onPostExecute

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
@Override
protected void onPostExecute(String result) {
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setVisibility(View.VISIBLE);
    ProgressBar prg = (ProgressBar) findViewById(R.id.progressBar1);
    prg.setVisibility(View.INVISIBLE);
    //TextView rtv = (TextView) findViewById(R.id.result_text);
    PieChart mChart = (PieChart) findViewById(R.id.result_text);
    mChart.setVisibility(View.VISIBLE);

    add_log("Generating report...");
    String report= String.format("Report \n\n Single beads: %, 5d \n Dimers: %, 17d \n \n Percentage of dimer: %2.2f %%",total_single_count,total_double_count,(double)total_double_count*100.0/((double)total_double_count+(double)total_single_count)+Math.ulp(1.0));
    //rtv.setText(report);
    add_log(report);



    List<PieEntry> entries_double = new ArrayList<>();
    entries_double.add(new PieEntry(total_single_count,"Single beads"));
    entries_double.add(new PieEntry(total_double_count,"Dimers"));
    PieDataSet dataset_double = new PieDataSet(entries_double, "");

    dataset_double.setColors(ColorTemplate.MATERIAL_COLORS);
    PieData pieData = new PieData(dataset_double);

    pieData.setDrawValues(true);
    pieData.setValueTextColor(Color.BLUE);
    pieData.setValueTextSize(20f);

    pieData.setValueFormatter(new PercentFormatter());

    mChart.setEntryLabelColor(Color.BLACK);
    mChart.setEntryLabelTextSize(22f);

    mChart.setDrawHoleEnabled(true);
    mChart.setHoleRadius(40f);
    mChart.setTransparentCircleRadius(48f);
    mChart.setTransparentCircleColor(Color.BLACK);
    mChart.setTransparentCircleAlpha(50);
    mChart.setHoleColor(Color.WHITE);
    mChart.setDrawCenterText(true);

    mChart.setCenterText("Detection result");
    mChart.setCenterTextSize(17f);
    mChart.setCenterTextColor(Color.BLACK);

    mChart.setUsePercentValues(true);
    mChart.setDrawEntryLabels(true);

    Legend l = mChart.getLegend();
    l.setEnabled(true);
    l.setTextSize(17f);

    mChart.getDescription().setEnabled(false);
    mChart.setData(pieData);
    mChart.invalidate();
    Snackbar.make(findViewById(android.R.id.content), "Detection finished. ", Snackbar.LENGTH_LONG)
            .setAction("Action", null).show();
}
 
开发者ID:linzuzeng,项目名称:Microsphere,代码行数:60,代码来源:MainActivity.java

示例4: applyDataSettings

import com.github.mikephil.charting.data.PieData; //导入方法依赖的package包/类
/**
 * Applies the specified format to the PieData Object.
 *
 * @param data the data which will be formatted
 */
public void applyDataSettings(PieData data) {
    data.setDrawValues(true);
}
 
开发者ID:Kamshak,项目名称:BrainPhaser,代码行数:9,代码来源:ChartSettings.java


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