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()
}