Skip to content

Getting started

ArsenyMalkov edited this page Dec 29, 2018 · 4 revisions

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

Signel View App


Signel View App

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.

Build Phases


Build Phases

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

Add framework


Add framework

Open AnyChart-iOS


Open AnyChart-iOS

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

Add framework again


Add framework again

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

Storyboard


Storyboard

Now click on the "Assistant editor" (two intersected 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".

Assistant editor


Assistant editor

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 a 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)

Pie Chart


Pie Chart

Run your project.

Running project


Running project
Clone this wiki locally