Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xyfeng/XYPieChart
A simple and animated Pie Chart for your iOS app.
https://github.com/xyfeng/XYPieChart
Last synced: 9 days ago
JSON representation
A simple and animated Pie Chart for your iOS app.
- Host: GitHub
- URL: https://github.com/xyfeng/XYPieChart
- Owner: xyfeng
- License: mit
- Created: 2012-03-06T14:26:28.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2016-03-18T06:29:19.000Z (over 8 years ago)
- Last Synced: 2024-11-30T04:06:46.597Z (13 days ago)
- Language: Objective-C
- Homepage:
- Size: 803 KB
- Stars: 1,729
- Watchers: 68
- Forks: 301
- Open Issues: 42
-
Metadata Files:
- Readme: README.textile
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-ios - XYPieChart - A simple and animated Pie Chart for your iOS app. (Charts)
- awesome-ios-star - XYPieChart - A simple and animated Pie Chart for your iOS app. (Charts)
- fucking-awesome-ios - XYPieChart - A simple and animated Pie Chart for your iOS app. (Charts)
- fucking-awesome-ios - XYPieChart - A simple and animated Pie Chart for your iOS app. (Charts)
README
h1. XYPieChart
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
!https://dl.dropboxusercontent.com/u/11819416/blog/XYPieChart_Screenshot.png!
h2. Features
* Customized color for slices (default color supported)
* animated insert/delete slice(s)
* slice selection animation
* text label option of showing percentage or actual value
* text label auto-hide when slice is too small
* customizable text label font and relative postion
* pie opening/closing animation
* pie starting angle support
* ARC(Automatic Reference Counting) support
* interface builder supporth2. Installation
* Drag the @XYPieChart/XYPieChart@ folder into your project.
* Add the *QuartzCore* framework to your project.h2. Usage
(see sample Xcode project in @/Demo@)
Set PieChart properties:
[self.pieChart setDelegate:self];
[self.pieChart setDataSource:self];
[self.pieChart setStartPieAngle:M_PI_2]; //optional
[self.pieChart setAnimationSpeed:1.0]; //optional
[self.pieChart setLabelFont:[UIFont fontWithName:@"DBLCDTempBlack" size:24]]; //optional
[self.pieChart setLabelColor:[UIColor blackColor]]; //optional, defaults to white
[self.pieChart setLabelShadowColor:[UIColor blackColor]]; //optional, defaults to none (nil)
[self.pieChart setLabelRadius:160]; //optional
[self.pieChart setShowPercentage:YES]; //optional
[self.pieChart setPieBackgroundColor:[UIColor colorWithWhite:0.95 alpha:1]]; //optional
[self.pieChart setPieCenter:CGPointMake(240, 240)]; //optionalImplement Data Source Methods:
- (NSUInteger)numberOfSlicesInPieChart:(XYPieChart *)pieChart;
- (CGFloat)pieChart:(XYPieChart *)pieChart valueForSliceAtIndex:(NSUInteger)index;
- (UIColor *)pieChart:(XYPieChart *)pieChart colorForSliceAtIndex:(NSUInteger)index; //optional
- (NSString *)pieChart:(XYPieChart *)pieChart textForSliceAtIndex:(NSUInteger)index; //optionalImplement Delegate Methods (OPTIONAL):
- (void)pieChart:(XYPieChart *)pieChart willSelectSliceAtIndex:(NSUInteger)index;
- (void)pieChart:(XYPieChart *)pieChart didSelectSliceAtIndex:(NSUInteger)index;
- (void)pieChart:(XYPieChart *)pieChart willDeselectSliceAtIndex:(NSUInteger)index;
- (void)pieChart:(XYPieChart *)pieChart didDeselectSliceAtIndex:(NSUInteger)index;h2. Credits
XYPieChart is brought to you by "XY Feng":http://xystudio.cc