Skip to content

Getting started

ArsenyMalkov edited this page Dec 29, 2018 · 4 revisions

Create a new project and choose "Single View App".

Create new project


Create new project

Fill product name, organization name, and organization indentifier.

Create new project


Create new project

When you click Next, you'll be prompted for a location to save it. Also, you could enable "Create a Git repository".

Select your application's Xcode project, then your application target, then select "Build Phases". Open "Link Binary With Libraries" and click the “+” icon.

Create new project


Create new project

Click the button "Add Other..." and select "AnyChart-iOS.xcodeproj".

Create new project


Create new project

Create new project


Create new project

After that click the “+” icon again and now you could add "AnyChart_iOS.framework".

Create new project


Create new project

Go to the "Main.storyboard" and set "AnyChartView" in custom class for your View.

Create new project


Create new project

Now click on the "Assistant editor" (two intesected circles at the top) and connect your AnyChartView to the ViewController. To do that, press and hold down the CTRL key while you drag your AnyChartView to the ViewController. Name it as "anyChartView".

Create new project


Create new project

Go to the ViewController and make sure you have import "AnyChart_iOS" at the top of your ViewController. Add code in the "viewDidLoad" method. For example, if you want to create simple pie chart:

let chart = AnyChart.pie()

let data: Array<DataEntry> = [
    ValueDataEntry(x: "Apples", value: 6371664)
    ValueDataEntry(x: "Pears", value: 789622)
    ValueDataEntry(x: "Bananas", value: 7216301)
    ValueDataEntry(x: "Grapes", value: 1486621)
    ValueDataEntry(x: "Oranges", value: 1200000)
]
chart.data(data: data)

chart.title(settings: "Fruits imported in 2015 (in kg)")

anyChartView.setChart(chart: chart)

Create new project


Create new project

Run your project.

Create new project


Create new project
Clone this wiki locally