Ixar
Ixar

Reputation: 57

Hide inner label in pieChart Charts pod swift

I know there is the way to off (or hide) this inner labels in pieChart elements (circled in the image)! pieChart inner label image I try (all pieChart methods responsible for this i found in my opinion):

pieChart.drawEntryLabelsEnabled = false
pieChart.entryLabelColor = UIColor.clear
pieChart.drawCenterTextEnabled = false

But still labels are visible...

Upvotes: 1

Views: 1370

Answers (1)

m3-bit
m3-bit

Reputation: 354

So you're trying to hide "value" label. And for that, you need to set drawValuesEnabled = false for your dataset.

I think "value label" is being mixed up with "entry label" and "center text", so check out the image for your better understanding.

    // label inside the circle
    pieChart.centerText = "center text"
    
    // dataset for the pie chart
    let data = PieChartDataSet(entries: [
        PieChartDataEntry(value: 100, label: "entry label")
    ])
    
    // hides entry label
    pieChart.drawEntryLabelsEnabled = false
    
    // set clear color for entry label = hides entry label
    pieChart.entryLabelColor = .clear
    
    // hides center text
    pieChart.drawCenterTextEnabled = false

    // hides value label
    data.drawValuesEnabled = false

    pieChart.data = PieChartData(dataSet: data)

chart

Upvotes: 3

Related Questions