Kishore
Kishore

Reputation: 184

How to draw a histogram chart in cocoa

As per My requirements i need to generate a histogram chart using cocoa framework and objective c.

If any one knows the solution please let me know ASAP.

Thanks, Ravi

Upvotes: 1

Views: 3306

Answers (5)

dhilipsiva
dhilipsiva

Reputation: 3718

You can look at DSBarChart. It does exactly what you want.

http://www.cocoacontrols.com/platforms/ios/controls/dsbarchart

Upvotes: 0

Robin
Robin

Reputation: 10011

I know this question is pretty old but i found a link that gives sample code for drawing histogram

http://www.keepedge.com/iphone_charts/histogram_chart.html

Upvotes: 0

Eric Skroch
Eric Skroch

Reputation: 27381

You could use Core Plot. It doesn't support histograms directly, but if you calculate the bins and counts yourself, a bar plot is pretty easy to set up. The framework handles drawing everything including the axes and labels. It works on Mac, iPhone, and iPad.

Upvotes: 4

Jack
Jack

Reputation: 133609

You can easily write your own CALayer using CoreAnimation.

You will just need some basic CALayers with their colors, borders and shadows to draw the bars and some CATextLayers to draw the text on the axis or below bars.

With some basic CA knowledge it will be easy and allow you to easily customize the graph with animations or effects..

Upvotes: 0

Eiko
Eiko

Reputation: 25632

Depending on your needs you can use a custom UIView subclass and perform the drawing by hand (overwrite drawRect:) or add UIViews for every bar (making nice animations possible with few code, but will not be efficient if many bars are needed).

Upvotes: 1

Related Questions