Husein Kareem
Husein Kareem

Reputation: 526

Remove all slice text from Pie Chart (ios-charts/mpandroidchart)

I know the method for removing the x-values but how do I remove the y-values. I basically don't want ANY text on my Pie Chart.

The image shows the current-state with the 80.0 and 20.0 labels on top of the pie chart. pie chart

Upvotes: 22

Views: 19661

Answers (9)

GreddyDC5
GreddyDC5

Reputation: 21

For MPAndroidChart use the following as one of the recommendations above is deprecated:

pieData.setDrawValues(false);

pieChart.setDrawEntryLabels(false);

Upvotes: 0

Energy
Energy

Reputation: 958

Mp Android chart, please use this

To remove x-Values use pieChart.setDrawSliceText(false).

To remove y-Values use pieChart.getData().setDrawValues(false).

Upvotes: 2

Govind Kumawat
Govind Kumawat

Reputation: 1592

For Charts Version 3.2.1

Both X - Y values enabled

pieChartDataSet.drawValuesEnabled = true
pieChartView.drawEntryLabelsEnabled = true

enter image description here

To remove the Y-Values

pieChartDataSet.drawValuesEnabled = false

enter image description here

To remove the X-Values

pieChartView.drawEntryLabelsEnabled = false

enter image description here

Upvotes: 26

onDroid
onDroid

Reputation: 471

To remove the Y-Values

Use dataset.setDrawValues(false);

To remove the X-Values

Use MyPieChart.setDrawSliceText(false);

Upvotes: 46

Khushabu
Khushabu

Reputation: 101

In ios-charts version 3.1.1, you can hide piechart slice labels by setting pie_chart.drawEntryLabelsEnabled = NO;

Upvotes: 3

Morgan
Morgan

Reputation: 1310

To remove the labels (xVals):

pieChartView.drawSliceTextEnabled = false

To remove the values (yVals):

pieChartDataSet.drawValuesEnabled = false

Upvotes: 7

DawnSong
DawnSong

Reputation: 5162

In ios-charts 2.1.3, dataset.drawValuesEnabled = NO; to hide Y-Values.

Upvotes: 1

Husein Kareem
Husein Kareem

Reputation: 526

Never mind figured it out!

pieChartView.data?.setValueTextColor(UIColor.clearColor())

That at least gets it from not seeing those labels.

Also another way is setting this to false:

drawLabelsEnabled

Upvotes: 7

Wingzero
Wingzero

Reputation: 9754

drawLabelsEnabled will not draw any label on your chart. It is for both xAxis and yAxis

checkout for all the basic configurations: https://github.com/danielgindi/ios-charts/blob/master/Charts/Classes/Components/ChartAxisBase.swift

Upvotes: 3

Related Questions