 <p>I finally got a solution for the problem. The code that works for me is the following:</p> <pre><code>override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. view.backgroundColor = UIColor.cyanColor() playButton.layer.backgroundColor = UIColor.whiteColor().CGColor playButton.layer.cornerRadius = 5 let initSignalExample = [0.0, 1.0, 2.0, 1.0, 0.0] lineChartSubView.frame = CGRectMake(0, 0, screenWidth, screenHeight) lineChartSubView.backgroundColor = UIColor.whiteColor() lineChartSubView.setXLabels(["0","1","2","3","4"], withWidth: 1) lineChartSubView.showCoordinateAxis = true lineChartSubView.showLabel = true lineChartSubView.delegate = self var signalObtainedValues = PNLineChartData() signalObtainedValues.color = UIColor.greenColor() signalObtainedValues.itemCount = UInt(initSignalExample.count) signalObtainedValues.getData = ({(index: UInt) -&gt; PNLineChartDataItem in var yValue:CGFloat = CGFloat(initSignalExample[Int(index)]) var item = PNLineChartDataItem(y: yValue) return item }) lineChartSubView.chartData = [signalObtainedValues] lineChartSubView.strokeChart() } </code></pre> <p>Now the problem is that the graph does not fit in the subview, but maybe I will open another question since the original post is solved. Thank you very much!</p>