Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove extra whitespace on pie charts from MpAndroidCharts?

So I have a PieChart that is using setMaxAngle to create something like a gauge. However, there is significant whitespace under it that I need to remove. I can't find any methods to modify the viewport for PieChart. So how can I refer the white space? See pic below.

enter image description here

My layout is the following:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.nextraq.anders.ui.dashboard.DashboardActivityFragment"
tools:showIn="@layout/dashboard_activity">

<android.support.v7.widget.CardView
    style="@style/AndersMaterialTheme.Dashboard.Gadget"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
        android:padding="@dimen/card_margin"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/gadgetTitle"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@string/mobiles"
            android:ellipsize="end"
            android:singleLine="true"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <com.github.mikephil.charting.charts.PieChart
            android:id="@+id/mobileStateChart"
            android:layout_below="@id/gadgetTitle"
            android:layout_width="match_parent"
            android:layout_height="300dp"/>
    </RelativeLayout>

</android.support.v7.widget.CardView>

like image 237
chubbsondubs Avatar asked May 06 '16 20:05

chubbsondubs


1 Answers

PieDataSet dataset = new PieDataSet(entries, "# of Calls");

dataset.setSliceSpace(0f);

I hope you that helpful

like image 194
KENAI Avatar answered Oct 21 '22 05:10

KENAI