Shinobi 甜甜圈图表标签颜色不会改变

Shinobi donut chart label color will not change

我有一个 Shinobi 甜甜圈图表,我想为其更改切片标签颜色。

我使用 Swift3。图表显示完美,但标签颜色为白色。

class myViewController: UIViewController, SChartDatasource {

    @IBOutlet weak var paymentChartView: UIView!

    override func viewDidLoad() {           
        addPaymentInformationChart()
    }

    func addPaymentInformationChart() {
        let chart = ShinobiChart(frame: paymentChartView.bounds)
        chart.title = "Payment Information"
        chart.autoresizingMask = [.flexibleHeight, .flexibleWidth]
        chart.titleLabel.textColor = UIColor.black

        chart.datasource = self
        paymentChartView.addSubview(chart)
    }

    /* SChartDatasource methods */

    func numberOfSeries(in chart: ShinobiChart) -> Int {
        return 1
    }

    func sChart(_ chart: ShinobiChart, seriesAt index: Int) -> SChartSeries {
        let donutSeries = SChartDonutSeries()
        donutSeries.style().spokeStyle.showSpokes = true;
        donutSeries.selectedStyle().spokeStyle.showSpokes = true;
        return donutSeries
    }

    func sChart(_ chart: ShinobiChart, numberOfDataPointsForSeriesAt seriesIndex: Int) -> Int {
        return 3
    }

    func sChart(_ chart: ShinobiChart, dataPointAt dataIndex: Int, forSeriesAt seriesIndex: Int) -> SChartData {
        let dp = SChartDataPoint()
        dp.xValue = 0
        dp.yValue = 0
        if paymentDatasource.count > 0 {
            switch dataIndex {
            case 0:
                dp.yValue = 100.0
                break
            case 1:
                dp.yValue = 200.0
                break
            case 2:
                dp.yValue = 300.0
                break
            default:
                break
            }
        }
        return dp
    }

    func sChart(_ chart: ShinobiChart, labelForSliceAt sliceIndex: Int, in series: SChartRadialSeries) -> UILabel? {

        let sliceLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 200, height: 21))
        sliceLabel.textColor = UIColor.black

        switch sliceIndex {
        case 0:
            sliceLabel.text = "Principal"
            break
        case 1:
            sliceLabel.text = "Interest"
            break
        case 2:
            sliceLabel.text = "Total"
            break
        default:
            break
        }
        return sliceLabel
    }

}

标签文本设置正确,但标签颜色不会改变。

如有任何帮助,我将不胜感激

毕竟我发现我必须更改图表样式才能更改标签样式:

func sChart(_ chart: ShinobiChart, seriesAt index: Int) -> SChartSeries {
    let donutSeries = SChartDonutSeries()
    donutSeries.style().spokeStyle.showSpokes = true;
    donutSeries.selectedStyle().spokeStyle.showSpokes = true;
    donutSeries.style().labelFontColor = UIColor.black
    donutSeries.selectedStyle().labelFontColor = UIColor.black
    return donutSeries
}