Change width of individual shapes in pie charts in Swift 3.0 (using iOS charts)

I have a piechart that displays two values: total and subtotal. It currently looks like this:

gray and red width are the same

I need it to look like this:

The gray part should be thinner and then the red, thicker

I have set the attributes:

let chart = PieChartView()

chart.data = pieChartData
chart.legend.enabled = false
chart.transparentCircleColor = nil

func setChart(labels: [String], pieSplit: [Double]) {
    var dataEntries: [ChartDataEntry] = []

    for i in 0..<labels.count {
        let dataEntry = PieChartDataEntry(value : pieSplit[i], label : labels[i])
        dataEntries.append(dataEntry)
    }

    let dataSet = PieChartDataSet(values: dataEntries, label: self.totalSpent)
    dataSet.selectionShift = 7.0
    dataSet.drawValuesEnabled = false
    let chartData = PieChartData(dataSets: [dataSet])

      

This way the chart is uniform width, I assume the default width. Setting userInteractionEnabled to "true" changes the width of the gray area when clicked (becomes some default thinner), but that's not what I want. Any advice?

+3


source to share





All Articles