Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 65 lines (49 sloc) 2.978 kB
d65d652 @xyfeng html added Readme
authored
1 h1. XYPieChart
2
e90e5c5 @xyfeng update the BTSPieChart Link, moved touch to pieview
authored
3 XYPieChart is an simple and easy-to-use pie chart for iOS app. It started from a "Potion":http://www.potiondesign.com Project which needs an animated pie graph without interaction. All animation was implemented in the drawRect: method. After played with "BTSPieChart":https://github.com/briancoyner/Core-Animation-Pie-Chart, really like its code structure, it's clean, has well named functions, structure like a UITableView. XYPieChart rewrote the code, based on CALayers for the animation. Compared to BTSPieChart, XYPieChart is a prettier version, it has a simpler insert/delete slices algorithm, different design of slice selection, more flexible to customize. "Video Demo":http://vimeo.com/38069395
d65d652 @xyfeng html added Readme
authored
4
49a4d09 @xyfeng fixed readme image
authored
5 !http://blog.xystudio.cc/wp-content/uploads/2012/03/XYPieChart_Screenshot_1.png!
d65d652 @xyfeng html added Readme
authored
6
7 h2. Features
8
9 * Customized color for slices (default color supported)
10 * animated insert/delete slice(s)
11 * slice selection animation
12 * text label option of showing percentage or actual value
13 * text label auto-hide when slice is too small
14 * customizable text label font and relative postion
15 * pie opening/closing animation
16 * pie starting angle support
17 * ARC(Automatic Reference Counting) support
18 * interface builder support
19
20 h2. Installation
21
22 * Drag the @XYPieChart/XYPieChart@ folder into your project.
23 * Add the *QuartzCore* framework to your project.
24
25 h2. Usage
26
27 (see sample Xcode project in @/Demo@)
28
29 Set PieChart properties:
30
31 <pre>
32 [self.pieChart setDelegate:self];
33 [self.pieChart setDataSource:self];
34 [self.pieChart setStartPieAngle:M_PI_2]; //optional
35 [self.pieChart setAnimationSpeed:1.0]; //optional
36 [self.pieChart setLabelFont:[UIFont fontWithName:@"DBLCDTempBlack" size:24]]; //optional
c620042 @nschum Add options to adjust label color and shadow for better contrast.
nschum authored
37 [self.pieChart setLabelColor:[UIColor blackColor]]; //optional, defaults to white
38 [self.pieChart setLabelShadowColor:[UIColor blackColor]]; //optional, defaults to none (nil)
d65d652 @xyfeng html added Readme
authored
39 [self.pieChart setLabelRadius:160]; //optional
40 [self.pieChart setShowPercentage:YES]; //optional
41 [self.pieChart setPieBackgroundColor:[UIColor colorWithWhite:0.95 alpha:1]]; //optional
42 [self.pieChart setPieCenter:CGPointMake(240, 240)]; //optional
43 </pre>
44
45 Implement Data Source Methods:
46
47 <pre>
48 - (NSUInteger)numberOfSlicesInPieChart:(XYPieChart *)pieChart;
49 - (CGFloat)pieChart:(XYPieChart *)pieChart valueForSliceAtIndex:(NSUInteger)index;
50 - (UIColor *)pieChart:(XYPieChart *)pieChart colorForSliceAtIndex:(NSUInteger)index; //optional
9bb14e7 @xyfeng add custom label text
authored
51 - (NSString *)pieChart:(XYPieChart *)pieChart textForSliceAtIndex:(NSUInteger)index; //optional
d65d652 @xyfeng html added Readme
authored
52 </pre>
53
54 Implement  Delegate Methods (OPTIONAL):
6dd6795 @xyfeng fixed Readme space
authored
55
d65d652 @xyfeng html added Readme
authored
56 <pre>
57 - (void)pieChart:(XYPieChart *)pieChart willSelectSliceAtIndex:(NSUInteger)index;
58 - (void)pieChart:(XYPieChart *)pieChart didSelectSliceAtIndex:(NSUInteger)index;
59 - (void)pieChart:(XYPieChart *)pieChart willDeselectSliceAtIndex:(NSUInteger)index;
60 - (void)pieChart:(XYPieChart *)pieChart didDeselectSliceAtIndex:(NSUInteger)index;
61 </pre>
62
63 h2. Credits
64
65 XYPieChart is brought to you by "XY Feng":http://xystudio.cc
Something went wrong with that request. Please try again.