I have been trying to develop a view controller with multiple charts(bar chart, line chart, pie chart). I created a table view and custom table view cell. There is a UIView
inside custom table view cell. However, when I am trying to cast that UIView
to BarchartView
it gives me an error
Could not cast value of type 'UIView' (0x10a8e7f40) to 'Charts.LineChartView' (0x1074f63a0).
How can I achieve that multiple charts in same table view? Thanks in advance.
cellForRowAt indexPath:
let cell = myTableView.dequeueReusableCell(withIdentifier: "chart") as? GraphicCell
var lineChart:LineChartView = cell?.chart as! LineChartView
lineChart.noDataText = "A"
return cell!
the view outlet that I have created in GraphicCell is UIView type
The charts which are shown depends on the user choice. User can select one bar chart and two line chart or only two line chart without bar chart. I do not understand completely how to achieve this. I have added my project to GitHub project link