Java Code Examples for com.github.mikephil.charting.charts.PieChart#setDescription()

The following examples show how to use com.github.mikephil.charting.charts.PieChart#setDescription() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PieChartFrag.java    From Stayfit with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_pie, container, false);
    
    mChart = (PieChart) v.findViewById(R.id.pieChart1);
    mChart.setDescription("");
    
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "OpenSans-Light.ttf");
    
    mChart.setCenterTextTypeface(tf);
    mChart.setCenterText(generateCenterText());
    mChart.setCenterTextSize(10f);
    mChart.setCenterTextTypeface(tf);
     
    // radius of the center hole in percent of maximum radius
    mChart.setHoleRadius(45f);
    mChart.setTransparentCircleRadius(50f);
    
    Legend l = mChart.getLegend();
    l.setPosition(LegendPosition.RIGHT_OF_CHART);
    
    mChart.setData(generatePieData());
    
    return v;
}
 
Example 2
Source File: PieChartCard.java    From ResearchStack with Apache License 2.0 6 votes vote down vote up
private void initializeViews() {
    titleTextView = (TextView) findViewById(R.id.view_chart_pie_title);
    titleTextView.setText(titleText);
    titleTextView.setTextColor(titleTextColor);
    titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize);
    titleTextView.setTypeface(Typeface.create(titleTextTypeface, Typeface.NORMAL));

    chart = (PieChart) findViewById(R.id.view_chart_pie);
    chart.setDrawSliceText(false);
    chart.setTouchEnabled(false);
    chart.setHoleRadius(0);
    chart.setTransparentCircleRadius(0);
    chart.getLegend().setEnabled(false);
    chart.setDescription("");
    chart.setDrawCenterText(false);

    rowContainer = (LinearLayout) findViewById(R.id.view_chart_pie_rows);
}
 
Example 3
Source File: ProgressChartCard.java    From ResearchStack with Apache License 2.0 6 votes vote down vote up
private void initializeViews() {
    titleTextView = (TextView) findViewById(R.id.view_chart_progress_title);
    titleTextView.setText(titleText);
    titleTextView.setTextColor(titleTextColor);
    titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize);
    titleTextView.setTypeface(Typeface.create(titleTextTypeface, Typeface.NORMAL));

    finishView = (TextView) findViewById(R.id.view_chart_progress_finish);
    finishView.setText(finishText);
    finishView.setTextColor(finishTextColor);

    tabLayout = (TabLayout) findViewById(R.id.view_chart_progress_tabs);
    tabLayout.setSelectedTabIndicatorColor(tabIndicatorColor);
    tabLayout.setTabTextColors(tabTextColor, tabSelectedTextColor);

    chart = (PieChart) findViewById(R.id.view_chart_progress_chart);
    chart.setDrawSliceText(false);
    chart.setTouchEnabled(false);
    chart.setHoleColor(Color.TRANSPARENT);
    chart.setHoleRadius(95f);
    chart.getLegend().setEnabled(false);
    chart.setDescription("");
    chart.setCenterTextColor(centerTextColor);
    chart.setCenterTextSize(centerTextSize);
    chart.setCenterTextTypeface(Typeface.create(centerTextTypeface, Typeface.NORMAL));
}
 
Example 4
Source File: PieChartActivity.java    From Stayfit with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_piechart);

    tvX = (TextView) findViewById(R.id.tvXMax);
    tvY = (TextView) findViewById(R.id.tvYMax);

    mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);

    mSeekBarY.setProgress(10);

    mSeekBarX.setOnSeekBarChangeListener(this);
    mSeekBarY.setOnSeekBarChangeListener(this);

    mChart = (PieChart) findViewById(R.id.chart1);
    mChart.setUsePercentValues(true);
    mChart.setDescription("");
    mChart.setExtraOffsets(5, 10, 5, 5);

    mChart.setDragDecelerationFrictionCoef(0.95f);

    tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");

    mChart.setCenterTextTypeface(Typeface.createFromAsset(getAssets(), "OpenSans-Light.ttf"));
    mChart.setCenterText(generateCenterSpannableText());

    mChart.setDrawHoleEnabled(true);
    mChart.setHoleColor(Color.WHITE);

    mChart.setTransparentCircleColor(Color.WHITE);
    mChart.setTransparentCircleAlpha(110);

    mChart.setHoleRadius(58f);
    mChart.setTransparentCircleRadius(61f);

    mChart.setDrawCenterText(true);

    mChart.setRotationAngle(0);
    // enable rotation of the chart by touch
    mChart.setRotationEnabled(true);
    mChart.setHighlightPerTapEnabled(true);

    // mChart.setUnit(" €");
    // mChart.setDrawUnitsInChart(true);

    // add a selection listener
    mChart.setOnChartValueSelectedListener(this);

    setData(3, 100);

    mChart.animateY(1400, Easing.EasingOption.EaseInOutQuad);
    // mChart.spin(2000, 0, 360);

    Legend l = mChart.getLegend();
    l.setPosition(LegendPosition.RIGHT_OF_CHART);
    l.setXEntrySpace(7f);
    l.setYEntrySpace(0f);
    l.setYOffset(0f);
}