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


Java PieChart.setDrawEntryLabels方法代码示例

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


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

示例1: formatPieChart

import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
private void formatPieChart(PieChart pieChart) {
    pieChart.setUsePercentValues(true);
    pieChart.getDescription().setEnabled(false);
    pieChart.setDrawHoleEnabled(true);
    pieChart.setHoleColor(context.getResources().getColor(R.color.colorPrimaryDark));
    pieChart.setTransparentCircleColor(Color.GRAY);
    pieChart.setTransparentCircleAlpha(110);

    pieChart.setRotationAngle(0);
    pieChart.setRotationEnabled(true);
    pieChart.setHighlightPerTapEnabled(true);

    pieChart.setEntryLabelColor(Color.WHITE);
    pieChart.setDrawEntryLabels(false);
    pieChart.setBackground(context.getResources().getDrawable(R.color.colorPrimaryDark));
}
 
开发者ID:Protino,项目名称:CodeWatch,代码行数:17,代码来源:ChartFragment.java

示例2: preparePieChart

import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
public PieChart preparePieChart(PieChart pieChart) {
    pieChart.setUsePercentValues(true);
    pieChart.getDescription().setEnabled(false);
    pieChart.setExtraOffsets(5, 10, 5, 5);
    pieChart.setDragDecelerationFrictionCoef(0.96f);

    pieChart.setDrawHoleEnabled(true);
    pieChart.setHoleColor(android.R.color.transparent);

    pieChart.setTransparentCircleColor(utilsUI.getColor(android.R.color.white));
    pieChart.setTransparentCircleAlpha(50);

    pieChart.setHoleRadius(40f);
    pieChart.setTransparentCircleRadius(45f);

    pieChart.setDrawCenterText(true);
    pieChart.setCenterText("Balance");

    pieChart.setRotationAngle(0);
    // enable rotation of the chart by touch
    pieChart.setRotationEnabled(false);
    pieChart.setHighlightPerTapEnabled(true);
    pieChart.setDrawEntryLabels(true);
    pieChart.setEntryLabelColor(utilsUI.getColor(android.R.color.white));
    pieChart.setEntryLabelTextSize(15f);

    Legend l = pieChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
    l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
    l.setDrawInside(false);

    return pieChart;
}
 
开发者ID:MLSDev,项目名称:RecipeFinderJavaVersion,代码行数:35,代码来源:DiagramUtils.java

示例3: getFormattedPieChart

import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
/**
 * Formats a pie chart in a standardized way
 * @param c Context
 * @param p Pie chart
 * @param shouldShowLegend
 * @return the PieChart, whose data must be set and invalidated
 */
public static PieChart getFormattedPieChart(Context c, PieChart p, boolean shouldShowLegend) {
    Legend cLegend = p.getLegend();
    if (shouldShowLegend) {
        cLegend.setEnabled(true);
        cLegend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
        cLegend.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
        cLegend.setOrientation(Legend.LegendOrientation.HORIZONTAL);
        cLegend.setDrawInside(false);
        cLegend.setForm(Legend.LegendForm.CIRCLE);
        cLegend.setTextSize(15);
        cLegend.setWordWrapEnabled(true);
    } else {
        cLegend.setEnabled(false);
    }

    p.setDrawEntryLabels(false);
    p.setDescription(EMPTY_CHART_DESCRIPTION);
    p.setHoleRadius(60f);
    p.setTransparentCircleRadius(65f);
    p.setCenterTextSize(20);

    if (SettingsActivity.getTheme(c) == SettingsActivity.THEME_NOIR) {
        int colorPrimaryNoir = ContextCompat.getColor(c, R.color.colorPrimaryNoir);
        int colorPrimaryTextNoir = ContextCompat.getColor(c, R.color.colorPrimaryTextNoir);

        p.setHoleColor(colorPrimaryNoir);
        p.setTransparentCircleColor(colorPrimaryNoir);
        p.setCenterTextColor(colorPrimaryTextNoir);
        cLegend.setTextColor(colorPrimaryTextNoir);
    }

    p.setRotationEnabled(false);

    p.setOnChartValueSelectedListener(new PieChartListener(p));
    return p;
}
 
开发者ID:lloydtorres,项目名称:stately,代码行数:44,代码来源:RaraHelper.java

示例4: onPostExecute

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

示例5: onCreate

import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_graphic);

    pieChart = (PieChart) findViewById(R.id.idPieChart);
    pieChart.setRotationEnabled(true);
    pieChart.setHoleRadius(25f);
    pieChart.setTransparentCircleAlpha(0);
    pieChart.setCenterText("Төлөвлөгөө");
    pieChart.setCenterTextSize(10);
    pieChart.setDrawEntryLabels(true);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    addDataSet();

    pieChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
        @Override
        public void onValueSelected(Entry e, Highlight h) {
            Log.d(TAG, "onValueSelected: Value select from chart.");
            Log.d(TAG, "onValueSelected: " + e.toString());
            Log.d(TAG, "onValueSelected: " + h.toString());

            int pos1 = e.toString().indexOf("(sum): ");
            String sales = e.toString().substring(pos1 + 7);

            for(int i = 0; i < yData.length; i++){
                if(yData[i] == Float.parseFloat(sales)){
                    pos1 = i;
                    break;
                }
            }
            String employee = xData[pos1 + 1];
            Toast.makeText(GraphicActivity.this, "Employee " + employee + "\n" + "Sales: $" + sales + "K", Toast.LENGTH_LONG).show();
        }

        @Override
        public void onNothingSelected() {

        }
    });

 }
 
开发者ID:tortuvshin,项目名称:yield,代码行数:46,代码来源:GraphicActivity.java


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