Archive

Monthly Archives: May 2015

A few weeks ago I published my first contribution to CocoaPods. It is a library to draw line graphs on a plot.

I wanted something really easy to use, where you just drop some values and the library does the rest. Calculates nice axis values, functionality for logarithmic plot, linear plot, value changes animated or not, dashed/dotted/solid lines, filled or not, etc.

All this in a very “Apple style” library, with delegates asking optionally anything that could be customised. Another important thing to me was, that it should be able to work with nib files as well as views created by code and Auto-layout.

See video: Not a very “designish” example of what can be done, but it shows all functionality. On the previous post you’ll see a much nicer version of it.

Gif:
graphs

Please check it out at github, fork it, tweak it, comment it, would be nice to see it grow!
There is still work to do on it. Adding tests, more functionalities, etc.

In CocoaPods

And to finish just a note about CocoaPods and their great work, it was really ease to follow the steps with their awesome guides

I come across an issue as I have wanted to draw lines in a grid format. My first approach, drawing a UIBezierPath in a CAShapeLayer.

My issue is the resultant fuzziness on the lines, as they need to be located in floating values. Which makes actually sense that the lines are fuzzy. What I didn’t expect is that, if I use UIViews and position them on the exact same points as the Bezier points, I don’t get this fuzziness (see screenshot. UIView must be doing this correction somehow, don’t remember if in AS3 this was the case… but I am pretty sure even Views had to be on the integer value to avoid this.

graphs

I most likely will get the same result as the UIView, rounding up or down the floating values.