How to draw line graphs in Swift? - swift

For a new app I need to draw a line graph. That graph needs to consist of two references lines, and one line based on measurements per day (min 14 days, max 32 days). Up to the current date, that line based on measurements needs to be solid. From the current date up to the max, it needs to be dashed. For now, the data is in arrays.
I tried to find examples and also saw a framework called Core Plot. I do like the design of the Health graphs a lot. Maybe that is also possible with Core Plot.
Instead of figuring out the details myself, I was hoping I could find somebody (with experience with Core Plot) to setup an example app. So I have more of a head start developing my own app. Willing to pay for the effort, though.
Hope Stackoverflow is the right place for such a question.
Thanks.
Jan

Stack overflow is most definitely not the right site for "please do all my work for me" questions. If you look at the Core-Plot project on Github it includes an example application, and a wiki with sample plots
It looks like the DropPlot Example App (from the samples wiki) is an example of a line plot. I suggest you start from that.
Here's what it's graph looks like

Related

What kind of chart has a count of objects?

I was trying to figure out how to make a chart like this but can't seem to find any information. I can't even find a name for this type of chart to Google it.
Does anyone know what these type of charts are called?
This is actually a little different that what I normally see. This is more of a percentage while most represent a certain number of people (one person = 100,000 people)
Here's a better example. I want to try to make something like this programmatically so it can be populated by data.
This is less of a chart and more of an Infographic. It's used to visual display facts or statistics in a friendly and accessible manner. There are plenty of tools on-line that can help you make one of these, but generally they're made custom by graphic designers using image processing tools such as Adobe Illustrator or Inkscape (free).

Sample code using Core-Plot for iPhone

I'm trying to find some sample code for Core-Plot on the iPhone. So far, all the examples I've found plot equations such as X^2 or 1/X, etc. over some range. My goal is to find some sample code that just plots two points ((1,2) and (2,3), for example) and connects them with a line.
It seems simple, but I've yet to find out how to approach this. I've checked the Core-Plot Wiki, and am again only able to find more complex examples.
Appreciate any help, thank you.
Have you looked at the examples included with Core Plot? There's a mix of Mac and iOS apps. Except for the hosting view, the API is identical on both platforms.

What type of chart would be best for displaying this data?

EDIT:
I don't mean in terms of how to implement it. i mean i dont like how the date is displayed with the bars. what other type of chart would be more suitable. I know a threadhold line wouldnt work beacause the values of the capacity are different for each day. if they were all the same a threadhold line indicating capacity would work
I think a line graph would be an excellent way to show the data.
I made that using the chart wizard. Link: here. I used the data you provided above, so it should be accurate unless I mistyped.
On the chart wizard, you can import this chart using the link I gave you above if you want to clean it up, add axes, etc.
The best way is impossible to answer, depends on too many things specially since you didn't clarify almost anything in you question.
Anyway, Google's chart API would be ans "easy" way to do this.
Good luck, I you clarify further in your question, I'll try to be more specific and improve my answer!
It can do this quite easily:
See here.

iPhone, how do I draw a simple line graph from an array of prices and dates?

I'm looking for some very simple to develop line graph library. However, all the examples seem quite complicated. I have a database with two main fields, date and value.
Can anyone point me at or provide me with an example of code which will do just that ?
I've used the CorePlot library with success. Here is a really good tutorial on how to use it.
There's example code for line graphs in Apple's Accelerometer sample app.

Are there any examples for how to draw a line chart in Core Plot on the iPhone?

Is there some sample code or a tutorial out there about how to draw a line chart using the Core Plot framework? I can't find anything using Google.
I've created a Core Plot "Hello World" with an x^2 graph here: http://recycled-parts.blogspot.com/2011/08/coreplot-hello-world.html
Hope this helps!
If you have downloaded the framework, go to the examples directory within your checked-out version. There are several examples there, including CPTestApp-iPhone (which demonstrates line, bar, and pie charts), CPTestApp-iPad (same, but for the iPad), StockPlot (which downloads stock charts and plots the line graphs for them), and AAPLot (which grabs Apple's stock price and plots it using an open-high-low-close chart).
These examples are updated as the API changes, so they can be considered reliable sources to work from.