draw pie chart using iOS quartz 2D - ios

I am looking for a tutorial where I can draw pie chart programmatically using Core Graphics or Quartz 2D in iOS. I want to understand how can we draw the PIE Chart which is gradient and having multi-color filled slices in it.
Note: Not looking for Coreplot framework.
Please share me some links regarding the same.

I have used "XYPieChart" library in my so many apps and it's very easy to modify.
Available on github.
Link is given below:
https://github.com/xyfeng/XYPieChart
Still needs any help then let me know.

You can also use this library, as this is also completely customisable and too easy to use.
Just use one line of code, this method along with the pie chart view used & the array with values to be rendered in the pie chart view:
- (void)renderInLayer:(RJPieChart *)layerHostingView dataArray:(NSMutableArray*)dataArray
Hope this helps.
Thanks

Related

Have to develop the component shown in below image

Need to develop the component shown in the image above using Objective-C language. No idea where to start and which framework to use. Any heads up/reference links to develop this component is highly appreciated.
Use a combination of UIBezierPaths with custom fill colors. You can either use a shape layer or core graphics. Bezier path allows you to construct a custom path, so the first one will be a triangle, and the second a quadrilateral.
You could also use paint code if you want to construct the path visually.
Look at this
https://www.raywenderlich.com/76433/how-to-make-a-custom-control-swift
It's a very general way to create whatever control you want.

Is it possible to change dots size on LineChart?

I am creating a CombinedChart with ios-chart library and I would like to change the dots size (data markers) of the LineChart. I would like to make them smaller because they are very big in comparison of the data. You can see an screenshot below:
Is it possible to change the size of that data markers? I could not find anything on the web.
Thanks in advance!
In Objective-c you can change the data marker radius from a LineChartDataSet
simply with
yourDataSet.circleRadius = 1.0
You can change the size of the circles with the next line:
yourline.circleRadius = CGFloat.init(4.0)
You are using a 3rd party framework. You can modify it to suit your needs.
In particular, it seems you would have to modify this file:
https://github.com/danielgindi/Charts/blob/master/Source/Charts/Components/MarkerImage.swift
If you run into any further difficulties you should ask a new question.

Draw gantt chart using UIcollectionviewcontroller?

I have research in forum satackovzrflow and I have found(Using a UICollectionViewController and my own UICollectionViewLayout subclass, I've put together a view that shows a Gannt style time chart. Using that framework to do the bands has been really easy of Travis Griggs) So How can I draw gantt chart Using UIcollectionviewController? Give me any idea to I can start draw it?
http://i.stack.imgur.com/7dg6G.png
Two years ago I have same task. I have folders, and tasks. I done all staff with simple view and autoresizing mask. I go through all tasks, calculate frames and create view hierarchy with this frames. To draw arrows between tasks, I create overlay that draws arrows.
If you really want use UICollectionView, I recommend to you read about custom layout.
Why to reinvent the wheel, you can check one of the library that draw charts on iOS and use it
Check the following Libraries
IQ Widgets
ios-charts
JBChartView
PNChart
The first library IQ Widgets has a Gantt chart

The best way to create animation diagram

I'm trying to create something like this:
I looked many resources for that, but I still don't have idea how can I do it. Using CoreAnimation, Quartz2d or UIBezierPath I can draw a circle, but how can I draw a nice diagram with touch gesture's aid, using that? Maybe I wrong searched? If any tutorial, or sample code for this issue?
Best and easy library I used to draw pie chart with animation; MIM Chart Library for iOS
https://github.com/ReetuRaj/MIMChart-Library
Open source.
OK, CoreAnimation is not what you're looking for with this.
Anyway...
If you want to make a nice Pie Chart then you should take a look at CorePlot.
It has a lot of graphing functions and pie charts are in there too.
You can still animate with this you just need to update the percentages based on touch. Don't try to animate the sections of the circle. Change the percentages and update the circle.
Looks like you are trying to do some charts & plotting. If that is so, there is something called as
Core Plot
ILGraphics
OVGraphView
Some controls as well
Hope that helps.

CaLayer performance with animating pie chart

I've developed a Pie Chart with animating pie segments. Each segment s a sublayer with custom drawing. The start and end angles are dynamic properties. The parts and their labels are drawn with core gaphics.
However, i notice bad performance with lots of red layers in the simulator. I cannot you opaque layers with pie parts obviously. i've set the ShouldRasterize to yes, that helped a bit. I also tried using instruments to spot the problem to no avail.
Core Plot
This open-source project may bring some thoughts about perfomance.
I've used this with animations in production and have great results
I couldn't solve the problem, so i took a totally different approach by using smaller layers.

Resources