Skip to content

Commit

Permalink
DEMO Code Added
Browse files Browse the repository at this point in the history
  • Loading branch information
xyfeng committed Mar 6, 2012
1 parent a80ef58 commit cd1d795
Show file tree
Hide file tree
Showing 3 changed files with 573 additions and 0 deletions.
Empty file added README
Empty file.
42 changes: 42 additions & 0 deletions XYPieChart/XYPieChart.h
@@ -0,0 +1,42 @@
//
// XYPieView.h
// XYPieChart
//
// Created by XY Feng on 2/24/12.
// Copyright (c) 2012 Xiaoyang Feng. All rights reserved.
//

#import <UIKit/UIKit.h>

@class XYPieChart;
@protocol XYPieViewDataSource <NSObject>
@required
- (NSUInteger)numberOfSlicesInPieView:(XYPieChart *)pieView;
- (CGFloat)pieView:(XYPieChart *)pieView valueForSliceAtIndex:(NSUInteger)index;
@optional
- (UIColor *)pieView:(XYPieChart *)pieView colorForSliceAtIndex:(NSUInteger)index;
@end

@protocol XYPieViewDelegate <NSObject>
@optional
- (void)pieView:(XYPieChart *)pieView willSelectSliceAtIndex:(NSUInteger)index;
- (void)pieView:(XYPieChart *)pieView didSelectSliceAtIndex:(NSUInteger)index;
- (void)pieView:(XYPieChart *)pieView willDeselectSliceAtIndex:(NSUInteger)index;
- (void)pieView:(XYPieChart *)pieView didDeselectSliceAtIndex:(NSUInteger)index;
@end

@interface XYPieChart : UIView
@property(nonatomic, weak) id<XYPieViewDataSource> dataSource;
@property(nonatomic, weak) id<XYPieViewDelegate> delegate;
@property(nonatomic, assign) CGFloat startPieAngle;
@property(nonatomic, assign) CGFloat animationSpeed;
@property(nonatomic, assign) CGPoint pieCenter;
@property(nonatomic, assign) CGFloat pieRadius;
@property(nonatomic, assign) BOOL showLabel;
@property(nonatomic, strong) UIFont *labelFont;
@property(nonatomic, assign) CGFloat labelRadius;
@property(nonatomic, assign) CGFloat selectionStroke;
@property(nonatomic, assign) BOOL showPercentage;
- (id)initWithFrame:(CGRect)frame Center:(CGPoint)center Radius:(CGFloat)radius;
- (void)reloadData;
@end;

0 comments on commit cd1d795

Please sign in to comment.