How to set long of spoke line in Donut Chart


#1

I have design some Donut Charts in my Apps, but I have a little problem with my spoke style.

The spoke line is too long for me, I set with code below but it doesnt work :

func sChart(_ chart: ShinobiChart, alter label: UILabel, for datapoint: SChartRadialDataPoint, atSlice index: Int, in series: SChartRadialSeries) {
    label.font = UIFont.boldSystemFont(ofSize: 11)

    if datapoint.value == 0 {
        label.isHidden = true
        let spokeStyle = SChartSpokeStyle()
        spokeStyle.showSpokes = false
         //            spokeStyle.length = 3
        //            spokeStyle.width = 3
       //            spokeStyle.anchorRadius = 3

        (series as! SChartDonutSeries).setSpokeStyle(spokeStyle, forSpokeAtSliceIndex: index)
    } else {
        label.text = "\(datapoint.name!): \(datapoint.value!)"
    }
}

Any suggest and answer will help for me. Thanks in Advance


#2

Hi MrX,

It looks like the commented-out code is setting the length/width/anchorRadius on a SChartSpokeStyle instance which is not showing the spokes - is that correct?

If you want to change the spoke style for all the spokes which are shown, I’d suggest setting those properties when you create the series, e.g.

let donutSeries = SChartDonutSeries()
donutSeries.style().spokeStyle.showSpokes = true
donutSeries.style().spokeStyle.length = 3
donutSeries.style().spokeStyle.width = 3
donutSeries.style().spokeStyle.anchorRadius = 3

Kind regards,

Alison


#3

Hi aclarke,

Thanks for answer I have done with this case and I forgot to update the answer. I will accept this as right answer. But I have new problem on [this] (Swift: Shinobi Data Grid scroll to a specific row) and I stil stuck at this problem for a day. Thanks in Advance