This is a migrated thread and some comments may be shown as answers.

TKChartAreaSeries with stack100 mode

3 Answers 121 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michele
Top achievements
Rank 1
Michele asked on 06 Apr 2016, 04:03 PM

Hi,

I'm having a problem with the rendering of a TKChartAreaSeries with options to set the chart on stack100 mode.
The first problem is that the yAxis shows a range between value 0 and 150, not 0...100, despite of using Stack100 mode, i solved this problem using TKChartNumericAxis(minimum:0,maximum:100).Is this the correct way?
The other problem concerns the rendering of the chart: the third serie is not shown at the beginning as it is supposed to be, only if i do a zoom and go where the serie doesn't have the value 0, the serie appears on the chart, as shown in the "after zoom" image attached.

Best Regards,

Alessio

 

Code:
        chart.frame=(viewgraf?.bounds)!
        //chart.autoresizingMask=UIViewAutoresizing(rawValue: UIViewAutoresizing.FlexibleWidth.rawValue | UIViewAutoresizing.FlexibleHeight.rawValue)
        chart.autoresizingMask = .None
        
        viewgraf!.addSubview(chart)
        let stackInfo = TKChartStackInfo(ID: 100, withStackMode: TKChartStackMode.Stack100)
        for var i=0;i<(item?.count)!;i++ {
            var point=[TKChartDataPoint]()
            for var ii=0;ii<item?[i].lista_elem.count;ii++ {
                let lis=item?[i].lista_elem[ii]
                let dateFormatter = NSDateFormatter()
                dateFormatter.timeZone = NSTimeZone(name: "GMT")
                dateFormatter.dateFormat = "dd-MM-yyyy"
                let x = dateFormatter.dateFromString((lis?.s_nome)!)
                let y = lis?.s_val
                point.append(TKChartDataPoint(x: x, y: y))
                
            }
            
            let series=TKChartAreaSeries(items: point)
            series.title=item?[i].legenda
            series.stackInfo=stackInfo
            series.style.palette=paletteColor()
            series.style.paletteMode = .UseSeriesIndex
            series.hidden=false
            
            chart.addSeries(series)
        }
        if chart.series.count==1{
            chart.series[0].style.paletteMode = .UseItemIndex
            chart.legend.hidden=false
        }
        chart.yAxis=TKChartNumericAxis()
        //chart.yAxis=TKChartNumericAxis(minimum: 0, andMaximum: 100)  
        chart.allowAnimations=true
        chart.backgroundColor=UIColor.clearColor()
        chart.xAxis!.style.labelStyle.textColor = UIColor.whiteColor()
        chart.yAxis!.style.labelStyle.textColor = UIColor.whiteColor()
        //axis font
        chart.yAxis!.style.labelStyle.font=UIFont(name: "SinkinSans-400Regular", size: 12.0)
        chart.xAxis!.style.labelStyle.font=UIFont(name: "SinkinSans-400Regular", size: 12.0)
        
        chart.xAxis!.style.labelStyle.textOffset = UIOffsetMake(0,10)
        chart.xAxis!.allowZoom=true
        chart.legend.hidden=true
        chart.update()
}

3 Answers, 1 is accepted

Sort by
0
Sophi
Telerik team
answered on 11 Apr 2016, 04:55 PM
Hi Michele,

I tried reproducing this behavior in my project but I wasn't able to observe it. In order to provide you with a proper solution in short terms could you please send us the isolated problem in a sample project. This way we can stay focused on the issue and it's cause.
Thank  you for your understanding.
Looking forward to hearing from you.

Regards,
Sophi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Michele
Top achievements
Rank 1
answered on 15 Apr 2016, 02:16 PM

Hi Sophi, 

here's the classes for a simple project that represent the same "structure" in my App.

here's WeTransfer link: https://we.tl/2JKhPPPEFz

Thanking you in advance for your support.I look forward to your reply.

0
Sophi
Telerik team
answered on 21 Apr 2016, 10:11 AM
Hello Michele,

After the examination of your classes, it turns out that there seems to be an issue with stack100 when data points with 0 values are presented. In this case the chart is not rendering as it should be, this is why when you zoom and pan you see color change. Apart from that all of the three series are rendering on the plot you just need to change the green background color to see them clearly.

I have created an issue in our online feedback portal. Here is link to it, this way you can be up to date with it's status. We are planning to include the fix in one of our upcoming releases.
I have added 500 Telerik points to your account for bringing this issue to our attention.
In case you have any other questions, do not hesitate to contact us.

Regards,
Sophi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Michele
Top achievements
Rank 1
Answers by
Sophi
Telerik team
Michele
Top achievements
Rank 1
Share this question
or