SChartBarColumnSeriesStyle cornerRatio not working properly


#1

I’m trying to use the cornerRadius property of a SChartBarColumnSeriesStyle object to round the corners of my columns. According to the documentation: “When set to 1 the tip of each bar or column is fully rounded, when set to 0 there isn’t a corner radius applied.” However, when I set the cornerRadius property to 1.0, I get a bar that’s somewhat rounded, but not completely. It looks like the radius is too large. I’d expect that with a value of 1.0, the bar would look like a rectangle with a semicircle on top. Any thoughts on where I’m going wrong?


#2

Hi there,

This is an issue we are aware of and have implemented a fix for. Although we are currently focused on getting on our iOS 10 release, you can expect the release that includes this fix to come not long after that. Though I cannot promise a release date, I’d recommend you keep an eye out for our release emails to see when it is released.

Apologies for any inconvenience this may have cause you.

Kind regards,

Matt / iOS Developer


#3

any chances of having access to the fix implementation ? we are struggling with the same 


#4

Hi,

I suspect Matt may have gotten mixed up with a rounded corner bug that caused odd artefacts to appear in the GL canvas, unrelated to what you’re seeing. About the column not being fully round - can you provide a datasource which reproduces this? We haven’t seen anything like that locally.

Kind regards


#5

Absolutely. Here’s the datasource. I don’t see a way to upload a file, but if it’d be helpful, I have a very simple sample project I can send you that demonstrates the issue. With the series cornerRatio property set to 1.0, you’ll see bullet-shaped tops to each column, instead of semi-circular tops. Setting the cornerRatio to 0.5 results in columns with clipped tops.

Thanks for your help!

class BarChartDataSource: NSObject, SChartDatasource, SChartDelegate {
    let dataPoints = [
        SChartDataPoint(XValue: 1, yValue: 1)!,
        SChartDataPoint(XValue: 2, yValue: 2)!,
        SChartDataPoint(XValue: 3, yValue: 3)!,
        SChartDataPoint(XValue: 4, yValue: 4)!,
        SChartDataPoint(XValue: 5, yValue: 5)!,
        SChartDataPoint(XValue: 6, yValue: 6)!,
        SChartDataPoint(XValue: 7, yValue: 7)!
    ]
    
    func numberOfSeriesInSChart(chart: ShinobiChart) -> Int {
        return 1
    }
    
    func sChart(chart: ShinobiChart, seriesAtIndex: Int) -> SChartSeries {
        let series = SChartColumnSeries()
        series.style().cornerRatio = 1.0
        return series
    }
    
    func sChart(chart: ShinobiChart, dataPointsForSeriesAtIndex seriesIndex: Int) -> [SChartData] {
        return self.dataPoints
    }
    
    func sChart(chart: ShinobiChart, numberOfDataPointsForSeriesAtIndex seriesIndex: Int) -> Int {
        return self.dataPoints.count
    }

    func sChart(chart: ShinobiChart, dataPointAtIndex dataIndex: Int, forSeriesAtIndex seriesIndex: Int) -> SChartData {
        return self.dataPoints[dataIndex]
    }
}

#6

Thanks for the datasource! I’ve given it a try locally and I’ve attached an image of the chart I get:

Is there any setup that I’m perhaps missing?


#7

The shape of the bar tops seems to be affected by the aspect ratio of the chart view itself. Here are a couple of screenshots where I’ve constrained the chart view to 200px wide or tall.

https://dl.dropboxusercontent.com/u/47326/Screenshots/200px%20wide.png

https://dl.dropboxusercontent.com/u/47326/Screenshots/200px%20tall.png

(Apologies for just using links, but I’m having trouble posting an image here.)


#8

Hi tschmitz,

This is because we calculate a column or bar’s corner radius in data terms, not pixels.

So when one axis is given more pixels to display its range over you get these stretches rounded corners.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.


#9

Ahh, I see. In that case, I guess this is a feature request: It’d be great to be able to specify how the bar corners render in terms of how they’re displayed regardless of the shape of the chart.


#10

Hi tschmitz,

Thanks for the feature request!

I have passed this on to our dev team who will investigate this further.

Unfortunately I can’t promise if or when this will be added as an official feature.

However, if we do decide to implement this we will update this forum post to let you know.

If you have any questions please don’t hesitate to get in touch.

Kind regards,
Andrew Polkinghorn.