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