-
Notifications
You must be signed in to change notification settings - Fork 8
Getting started
Create a new project and choose "Single View App".
|
Fill product name, organization name, and organization indentifier.
|
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.
|
Click the button "Add Other..." and select "AnyChart-iOS.xcodeproj".
|
|
After that click the "+" icon again and now you could add "AnyChart_iOS.framework".
|
Go to the "Main.storyboard" and set "AnyChartView" in custom class for your View.
|
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".
|
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)
|
Run your project.
|