更改Swift 3.0中饼图中各个部分的宽度(使用图表iOS)

时间:2017-04-06 20:53:10

标签: swift pie-chart

我有一个显示两个值的饼图:总计和小计。它目前是这样的:

the grey and red width is the same

我需要它看起来像这样:

The grey part needs to be thinner, and then red, thicker

我已经设置了属性:

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

因此图表是一个统一的宽度,我假设默认宽度。将userInteractionEnabled设置为&#39; true&#39;单击时更改灰色部分的宽度(变为默认值更薄),但这不是我需要的。有什么建议吗?

0 个答案:

没有答案