source: orbit/iOS/Orbit/Orbit/CorePlotHeaders/CPTPieChart.h @ f323fb4

Raw_EEG_Plot
Last change on this file since f323fb4 was a9059a5, checked in by Steve Castellotti <sc@…>, 9 years ago

Arduino:

  • updated to permit custom setting of Throttle, Yaw, and Pitch

Android:

  • Minor tweak to Configuration location

iOS:

  • Property mode set to 100644
File size: 5.5 KB
Line 
1#import "CPTDefinitions.h"
2#import "CPTPlot.h"
3#import <Foundation/Foundation.h>
4
5/// @file
6
7@class CPTColor;
8@class CPTFill;
9@class CPTMutableNumericData;
10@class CPTNumericData;
11@class CPTPieChart;
12@class CPTTextLayer;
13@class CPTLineStyle;
14
15/// @ingroup plotBindingsPieChart
16/// @{
17extern NSString *const CPTPieChartBindingPieSliceWidthValues;
18extern NSString *const CPTPieChartBindingPieSliceFills;
19extern NSString *const CPTPieChartBindingPieSliceRadialOffsets;
20/// @}
21
22/**
23 *  @brief Enumeration of pie chart data source field types.
24 **/
25typedef enum _CPTPieChartField {
26    CPTPieChartFieldSliceWidth,           ///< Pie slice width.
27    CPTPieChartFieldSliceWidthNormalized, ///< Pie slice width normalized [0, 1].
28    CPTPieChartFieldSliceWidthSum         ///< Cumulative sum of pie slice widths.
29}
30CPTPieChartField;
31
32/**
33 *  @brief Enumeration of pie slice drawing directions.
34 **/
35typedef enum _CPTPieDirection {
36    CPTPieDirectionClockwise,       ///< Pie slices are drawn in a clockwise direction.
37    CPTPieDirectionCounterClockwise ///< Pie slices are drawn in a counter-clockwise direction.
38}
39CPTPieDirection;
40
41#pragma mark -
42
43/**
44 *  @brief A pie chart data source.
45 **/
46@protocol CPTPieChartDataSource<CPTPlotDataSource>
47@optional
48
49/// @name Slice Style
50/// @{
51
52/** @brief @optional Gets a range of slice fills for the given pie chart.
53 *  @param pieChart The pie chart.
54 *  @param indexRange The range of the data indexes of interest.
55 *  @return The pie slice fill for the slice with the given index.
56 **/
57-(NSArray *)sliceFillsForPieChart:(CPTPieChart *)pieChart recordIndexRange:(NSRange)indexRange;
58
59/** @brief @optional Gets a fill for the given pie chart slice.
60 *  This method will not be called if
61 *  @link CPTPieChartDataSource::sliceFillsForPieChart:recordIndexRange: -sliceFillsForPieChart:recordIndexRange: @endlink
62 *  is also implemented in the datasource.
63 *  @param pieChart The pie chart.
64 *  @param idx The data index of interest.
65 *  @return The pie slice fill for the slice with the given index.
66 **/
67-(CPTFill *)sliceFillForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)idx;
68
69/// @}
70
71/// @name Slice Layout
72/// @{
73
74/** @brief @optional Gets a range of slice offsets for the given pie chart.
75 *  @param pieChart The pie chart.
76 *  @param indexRange The range of the data indexes of interest.
77 *  @return An array of radial offsets.
78 **/
79-(NSArray *)radialOffsetsForPieChart:(CPTPieChart *)pieChart recordIndexRange:(NSRange)indexRange;
80
81/** @brief @optional Offsets the slice radially from the center point. Can be used to @quote{explode} the chart.
82 *  This method will not be called if
83 *  @link CPTPieChartDataSource::radialOffsetsForPieChart:recordIndexRange: -radialOffsetsForPieChart:recordIndexRange: @endlink
84 *  is also implemented in the datasource.
85 *  @param pieChart The pie chart.
86 *  @param idx The data index of interest.
87 *  @return The radial offset in view coordinates. Zero is no offset.
88 **/
89-(CGFloat)radialOffsetForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)idx;
90
91/// @}
92
93/// @name Legends
94/// @{
95
96/** @brief @optional Gets the legend title for the given pie chart slice.
97 *  @param pieChart The pie chart.
98 *  @param idx The data index of interest.
99 *  @return The title text for the legend entry for the point with the given index.
100 **/
101-(NSString *)legendTitleForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)idx;
102
103/// @}
104@end
105
106#pragma mark -
107
108/**
109 *  @brief Pie chart delegate.
110 **/
111@protocol CPTPieChartDelegate<CPTPlotDelegate>
112
113@optional
114
115/// @name Slice Selection
116/// @{
117
118/** @brief @optional Informs the delegate that a pie slice was
119 *  @if MacOnly clicked. @endif
120 *  @if iOSOnly touched. @endif
121 *  @param plot The pie chart.
122 *  @param idx The index of the
123 *  @if MacOnly clicked pie slice. @endif
124 *  @if iOSOnly touched pie slice. @endif
125 **/
126-(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)idx;
127
128/** @brief @optional Informs the delegate that a pie slice was
129 *  @if MacOnly clicked. @endif
130 *  @if iOSOnly touched. @endif
131 *  @param plot The pie chart.
132 *  @param idx The index of the
133 *  @if MacOnly clicked pie slice. @endif
134 *  @if iOSOnly touched pie slice. @endif
135 *  @param event The event that triggered the selection.
136 **/
137-(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event;
138
139/// @}
140
141@end
142
143#pragma mark -
144
145@interface CPTPieChart : CPTPlot {
146    @private
147    CGFloat pieRadius;
148    CGFloat pieInnerRadius;
149    CGFloat startAngle;
150    CGFloat endAngle;
151    CPTPieDirection sliceDirection;
152    CGPoint centerAnchor;
153    CPTLineStyle *borderLineStyle;
154    CPTFill *overlayFill;
155    BOOL labelRotationRelativeToRadius;
156}
157
158/// @name Appearance
159/// @{
160@property (nonatomic, readwrite) CGFloat pieRadius;
161@property (nonatomic, readwrite) CGFloat pieInnerRadius;
162@property (nonatomic, readwrite) CGFloat startAngle;
163@property (nonatomic, readwrite) CGFloat endAngle;
164@property (nonatomic, readwrite) CPTPieDirection sliceDirection;
165@property (nonatomic, readwrite) CGPoint centerAnchor;
166/// @}
167
168/// @name Drawing
169/// @{
170@property (nonatomic, readwrite, copy) CPTLineStyle *borderLineStyle;
171@property (nonatomic, readwrite, copy) CPTFill *overlayFill;
172/// @}
173
174/// @name Data Labels
175/// @{
176@property (nonatomic, readwrite, assign) BOOL labelRotationRelativeToRadius;
177/// @}
178
179/// @name Information
180/// @{
181-(NSUInteger)pieSliceIndexAtAngle:(CGFloat)angle;
182-(CGFloat)medianAngleForPieSliceIndex:(NSUInteger)index;
183/// @}
184
185/// @name Factory Methods
186/// @{
187+(CPTColor *)defaultPieSliceColorForIndex:(NSUInteger)pieSliceIndex;
188/// @}
189
190@end
Note: See TracBrowser for help on using the repository browser.