source: orbit/iOS/Orbit/Orbit/CorePlotHeaders/CPTBarPlot.h @ e5b8e57

ServoTab_Interfacepyramid
Last change on this file since e5b8e57 was a9059a5, checked in by Steve Castellotti <sc@…>, 10 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.7 KB
Line 
1#import "CPTDefinitions.h"
2#import "CPTPlot.h"
3#import <Foundation/Foundation.h>
4
5/// @file
6
7@class CPTLineStyle;
8@class CPTMutableNumericData;
9@class CPTNumericData;
10@class CPTFill;
11@class CPTPlotRange;
12@class CPTColor;
13@class CPTBarPlot;
14@class CPTTextLayer;
15@class CPTTextStyle;
16
17/// @ingroup plotBindingsBarPlot
18/// @{
19extern NSString *const CPTBarPlotBindingBarLocations;
20extern NSString *const CPTBarPlotBindingBarTips;
21extern NSString *const CPTBarPlotBindingBarBases;
22extern NSString *const CPTBarPlotBindingBarFills;
23extern NSString *const CPTBarPlotBindingBarLineStyles;
24/// @}
25
26/**
27 *  @brief Enumeration of bar plot data source field types
28 **/
29typedef enum _CPTBarPlotField {
30    CPTBarPlotFieldBarLocation, ///< Bar location on independent coordinate axis.
31    CPTBarPlotFieldBarTip,      ///< Bar tip value.
32    CPTBarPlotFieldBarBase      ///< Bar base (used only if @link CPTBarPlot::barBasesVary barBasesVary @endlink is YES).
33}
34CPTBarPlotField;
35
36#pragma mark -
37
38/**
39 *  @brief A bar plot data source.
40 **/
41@protocol CPTBarPlotDataSource<CPTPlotDataSource>
42@optional
43
44/// @name Bar Style
45/// @{
46
47/** @brief @optional Gets an array of bar fills for the given bar plot.
48 *  @param barPlot The bar plot.
49 *  @param indexRange The range of the data indexes of interest.
50 *  @return An array of bar fills.
51 **/
52-(NSArray *)barFillsForBarPlot:(CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange;
53
54/** @brief @optional Gets a bar fill for the given bar plot.
55 *  This method will not be called if
56 *  @link CPTBarPlotDataSource::barFillsForBarPlot:recordIndexRange: -barFillsForBarPlot:recordIndexRange: @endlink
57 *  is also implemented in the datasource.
58 *  @param barPlot The bar plot.
59 *  @param idx The data index of interest.
60 *  @return The bar fill for the bar with the given index. If the data source returns @nil, the default fill is used.
61 *  If the data source returns an NSNull object, no fill is drawn.
62 **/
63-(CPTFill *)barFillForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx;
64
65/** @brief @optional Gets an array of bar line styles for the given bar plot.
66 *  @param barPlot The bar plot.
67 *  @param indexRange The range of the data indexes of interest.
68 *  @return An array of line styles.
69 **/
70-(NSArray *)barLineStylesForBarPlot:(CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange;
71
72/** @brief @optional Gets a bar line style for the given bar plot.
73 *  This method will not be called if
74 *  @link CPTBarPlotDataSource::barLineStylesForBarPlot:recordIndexRange: -barLineStylesForBarPlot:recordIndexRange: @endlink
75 *  is also implemented in the datasource.
76 *  @param barPlot The bar plot.
77 *  @param idx The data index of interest.
78 *  @return The bar line style for the bar with the given index. If the data source returns @nil, the default line style is used.
79 *  If the data source returns an NSNull object, no line is drawn.
80 **/
81-(CPTLineStyle *)barLineStyleForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx;
82
83/// @}
84
85/// @name Legends
86/// @{
87
88/** @brief @optional Gets the legend title for the given bar plot bar.
89 *  @param barPlot The bar plot.
90 *  @param idx The data index of interest.
91 *  @return The title text for the legend entry for the point with the given index.
92 **/
93-(NSString *)legendTitleForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx;
94
95/// @}
96@end
97
98#pragma mark -
99
100/**
101 *  @brief Bar plot delegate.
102 **/
103@protocol CPTBarPlotDelegate<CPTPlotDelegate>
104
105@optional
106
107/// @name Point Selection
108/// @{
109
110/** @brief @optional Informs the delegate that a bar was
111 *  @if MacOnly clicked. @endif
112 *  @if iOSOnly touched. @endif
113 *  @param plot The bar plot.
114 *  @param idx The index of the
115 *  @if MacOnly clicked bar. @endif
116 *  @if iOSOnly touched bar. @endif
117 **/
118-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx;
119
120/** @brief @optional Informs the delegate that a bar was
121 *  @if MacOnly clicked. @endif
122 *  @if iOSOnly touched. @endif
123 *  @param plot The bar plot.
124 *  @param idx The index of the
125 *  @if MacOnly clicked bar. @endif
126 *  @if iOSOnly touched bar. @endif
127 *  @param event The event that triggered the selection.
128 **/
129-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event;
130
131/// @}
132
133@end
134
135#pragma mark -
136
137@interface CPTBarPlot : CPTPlot {
138    @private
139    CPTLineStyle *lineStyle;
140    CPTFill *fill;
141    NSDecimal barWidth;
142    CGFloat barWidthScale;
143    NSDecimal barOffset;
144    CGFloat barOffsetScale;
145    CGFloat barCornerRadius;
146    CGFloat barBaseCornerRadius;
147    NSDecimal baseValue;
148    BOOL barsAreHorizontal;
149    BOOL barBasesVary;
150    BOOL barWidthsAreInViewCoordinates;
151    CPTPlotRange *plotRange;
152}
153
154/// @name Appearance
155/// @{
156@property (nonatomic, readwrite, assign) BOOL barWidthsAreInViewCoordinates;
157@property (nonatomic, readwrite, assign) NSDecimal barWidth;
158@property (nonatomic, readwrite, assign) CGFloat barWidthScale;
159@property (nonatomic, readwrite, assign) NSDecimal barOffset;
160@property (nonatomic, readwrite, assign) CGFloat barOffsetScale;
161@property (nonatomic, readwrite, assign) CGFloat barCornerRadius;
162@property (nonatomic, readwrite, assign) CGFloat barBaseCornerRadius;
163@property (nonatomic, readwrite, assign) BOOL barsAreHorizontal;
164@property (nonatomic, readwrite, assign) NSDecimal baseValue;
165@property (nonatomic, readwrite, assign) BOOL barBasesVary;
166@property (nonatomic, readwrite, copy) CPTPlotRange *plotRange;
167/// @}
168
169/// @name Drawing
170/// @{
171@property (nonatomic, readwrite, copy) CPTLineStyle *lineStyle;
172@property (nonatomic, readwrite, copy) CPTFill *fill;
173/// @}
174
175/// @name Factory Methods
176/// @{
177+(CPTBarPlot *)tubularBarPlotWithColor:(CPTColor *)color horizontalBars:(BOOL)horizontal;
178/// @}
179
180/// @name Data Ranges
181/// @{
182-(CPTPlotRange *)plotRangeEnclosingBars;
183/// @}
184
185@end
Note: See TracBrowser for help on using the repository browser.