This code creates a new instance of TKChart and adds it as a subview of the ViewController's main view. The autoresizingMask property is set in order to allow correct resizing of the chart when the device is rotated in landscape mode.

The next step is to create some random data that will be consumed by the chart. You can use the following code:

The TKChartLineSeries tells the chart to present its data as a line chart and initializes it with the already created points.

Let's add a title and a legend to our chart. We can do so by setting the corresponding properties to NO. We can easily employ the built-in animations support to create some fancy animations. To do so, we should set the allowAnimations property to YES: