Charts with swift
Asked Answered
P

3

5

I'm new in iOS development and want to create an app with some charts. I decided to start development with swift because it seemed to be more easy to learn for me as Java developer. But meanwhile I think using objective-c would have been the better choice because AFAIK there is no chart library available that match my criteria:

  • usable with swift
  • has line and bar charts
  • ability to draw charts with date and time axis
  • free to use or low price < 100 USD

Common chart libraries like JBChartView, Core-Plot and iOSPlot do not fulfill my criteria so I'm thinking about either to use a JavaScript chart library in a WebView or switching completely to objective-c

Is it good practice to use a JavaScript chart API in a WebView? If so, may this make problems on different devices with different screen sizes and orientations? What are common pitfalls with this approach?

Edit: Core-Plot release-2.0 works well with Swift

Polky answered 16/3, 2015 at 12:55 Comment(2)
I think it's pretty clunky using JS and UIWebView - avoid IMHO. What's wrong with core plot?Assuming
@Assuming Core-Plot seems not be usable with swift because of incompatible datatypes github.com/core-plot/core-plot/issues/96Polky
T
1

As noted in the comments on the linked Core Plot issue, you can use Core Plot in Swift as long as you use the code from the release-2.0 branch. The changes on that branch resolve the issues with NSDecimal that 1.x versions of Core Plot have.

Terraqueous answered 17/3, 2015 at 1:5 Comment(1)
I already tried to use the release-2.0 version and thought there are still problems with NSDecimal in CPTPlotRange.length, but after trying it again it turned out that it works perfectly! So core-plot works great with Swift but this little difficulties has taught me to better switch to Objective-C because it is a more proved technology and especially for me as iOS beginner its important that there is much more documentation available.Polky
A
10

You could use iOS-Charts

This is a great chart library written in swift and is on github:

There are some great tutorials going through the basics here.

iOS-Charts seems to fit your criteria

  • It is completely free
  • It is written specifically for Swift
  • It has 8 different graph types
Aleksandr answered 7/10, 2015 at 4:20 Comment(0)
F
2

You can use this powerful ios charts library https://github.com/danielgindi/Charts

or you can use this SVG library to create your own https://github.com/exyte/Macaw

If you are looking for commercial library (I haven't used this yet) https://www.shinobicontrols.com

This is a great telegram channel, where you can find different useful information about ios development and libraries https://t.me/iostalks

Fireguard answered 25/12, 2017 at 15:34 Comment(0)
T
1

As noted in the comments on the linked Core Plot issue, you can use Core Plot in Swift as long as you use the code from the release-2.0 branch. The changes on that branch resolve the issues with NSDecimal that 1.x versions of Core Plot have.

Terraqueous answered 17/3, 2015 at 1:5 Comment(1)
I already tried to use the release-2.0 version and thought there are still problems with NSDecimal in CPTPlotRange.length, but after trying it again it turned out that it works perfectly! So core-plot works great with Swift but this little difficulties has taught me to better switch to Objective-C because it is a more proved technology and especially for me as iOS beginner its important that there is much more documentation available.Polky

© 2022 - 2024 — McMap. All rights reserved.