如何从MpAndroidCharts的饼图中去除额外的空白?

7

我有一个使用setMaxAngle创建类似仪表盘的PieChart,但是在它下面有很多明显的空白需要去掉。我找不到修改PieChart视口的任何方法。那么如何处理这个空白呢?请参见下面的图片。

enter image description here

我的布局如下:

<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>

1个回答

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

dataset.setSliceSpace(0f);

我希望你能成为有用的助手。

谢谢您的回答,但那不是我所指的。我在谈论饼图下面非常大的空白区域。即文本“85 Mobiles”下面的空白区域,而不是每个饼片之间的空格。 - chubbsondubs

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接