Core Plot (macOS)
Cocoa plotting framework for macOS, iOS, and tvOS
CPTBarPlot.h
Go to the documentation of this file.
1 #import "CPTDefinitions.h"
2 #import "CPTFill.h"
3 #import "CPTLineStyle.h"
4 #import "CPTPlot.h"
5 
7 
9 @class CPTNumericData;
10 @class CPTPlotRange;
11 @class CPTColor;
12 @class CPTBarPlot;
13 @class CPTTextLayer;
14 @class CPTTextStyle;
15 
20 
24 extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarTips;
25 extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarBases;
26 extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarFills;
30 
34 typedef NS_ENUM (NSInteger, CPTBarPlotField) {
38 };
39 
40 #pragma mark -
41 
46 @optional
47 
50 
56 -(nullable CPTFillArray *)barFillsForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange;
57 
67 -(nullable CPTFill *)barFillForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx;
68 
74 -(nullable CPTLineStyleArray *)barLineStylesForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange;
75 
85 -(nullable CPTLineStyle *)barLineStyleForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx;
86 
92 -(nullable CPTNumberArray *)barWidthsForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange;
93 
102 -(nullable NSNumber *)barWidthForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx;
103 
105 
108 
114 -(nullable NSString *)legendTitleForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx;
115 
121 -(nullable NSAttributedString *)attributedLegendTitleForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx;
122 
124 @end
125 
126 #pragma mark -
127 
132 
133 @optional
134 
137 
147 -(void)barPlot:(nonnull CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx;
148 
159 -(void)barPlot:(nonnull CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(nonnull CPTNativeEvent *)event;
160 
169 -(void)barPlot:(nonnull CPTBarPlot *)plot barTouchDownAtRecordIndex:(NSUInteger)idx;
170 
180 -(void)barPlot:(nonnull CPTBarPlot *)plot barTouchDownAtRecordIndex:(NSUInteger)idx withEvent:(nonnull CPTNativeEvent *)event;
181 
190 -(void)barPlot:(nonnull CPTBarPlot *)plot barTouchUpAtRecordIndex:(NSUInteger)idx;
191 
201 -(void)barPlot:(nonnull CPTBarPlot *)plot barTouchUpAtRecordIndex:(NSUInteger)idx withEvent:(nonnull CPTNativeEvent *)event;
202 
204 
205 @end
206 
207 #pragma mark -
208 
209 @interface CPTBarPlot : CPTPlot
210 
213 @property (nonatomic, readwrite, assign) BOOL barWidthsAreInViewCoordinates;
214 @property (nonatomic, readwrite, strong, nonnull) NSNumber *barWidth;
215 @property (nonatomic, readwrite, strong, nonnull) NSNumber *barOffset;
216 @property (nonatomic, readwrite, assign) CGFloat barCornerRadius;
217 @property (nonatomic, readwrite, assign) CGFloat barBaseCornerRadius;
218 @property (nonatomic, readwrite, assign) BOOL barsAreHorizontal;
219 @property (nonatomic, readwrite, strong, nonnull) NSNumber *baseValue;
220 @property (nonatomic, readwrite, assign) BOOL barBasesVary;
221 @property (nonatomic, readwrite, copy, nullable) CPTPlotRange *plotRange;
223 
226 @property (nonatomic, readwrite, copy, nullable) CPTLineStyle *lineStyle;
227 @property (nonatomic, readwrite, copy, nullable) CPTFill *fill;
229 
232 +(nonnull instancetype)tubularBarPlotWithColor:(nonnull CPTColor *)color horizontalBars:(BOOL)horizontal;
234 
239 
242 -(void)reloadBarFills;
243 -(void)reloadBarFillsInIndexRange:(NSRange)indexRange;
244 -(void)reloadBarLineStyles;
245 -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange;
246 -(void)reloadBarWidths;
247 -(void)reloadBarWidthsInIndexRange:(NSRange)indexRange;
249 
250 @end
CPTLineStyle
Immutable wrapper for various line drawing properties. Create a CPTMutableLineStyle if you want to cu...
Definition: CPTLineStyle.h:20
NSArray
CPTPlotDataSource-p
A plot data source.
Definition: CPTPlot.h:51
CPTBarPlot::barCornerRadius
CGFloat barCornerRadius
The corner radius for the end of the bars. Default is 0.0 for square corners.
Definition: CPTBarPlot.h:216
CPTBarPlotFieldBarTip
@ CPTBarPlotFieldBarTip
Bar tip value.
Definition: CPTBarPlot.h:36
CPTBarPlot::plotRange
CPTPlotRange * plotRange
Sets the plot range for the independent axis.
Definition: CPTBarPlot.h:221
CPTBarPlotDataSource-p
A bar plot data source.
Definition: CPTBarPlot.h:45
CPTBarPlot::barWidth
NSNumber * barWidth
The width of each bar. Either view or plot coordinates can be used.
Definition: CPTBarPlot.h:214
CPTBarPlot::barWidthsAreInViewCoordinates
BOOL barWidthsAreInViewCoordinates
Whether the bar width and bar offset is in view coordinates, or in plot coordinates....
Definition: CPTBarPlot.h:213
CPTBarPlot
A two-dimensional bar plot.
Definition: CPTBarPlot.h:210
CPTBarPlotBindingBarBases
CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarBases
Bar bases.
Definition: CPTBarPlot.m:32
NSRange
typedef NSRange
CPTBarPlotBindingBarWidths
CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarWidths
Bar widths.
Definition: CPTBarPlot.m:35
CPTBarPlotFieldBarBase
@ CPTBarPlotFieldBarBase
Bar base (used only if barBasesVary is YES).
Definition: CPTBarPlot.h:37
CPTBarPlotBindingBarLocations
CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarLocations
Bar locations.
Definition: CPTBarPlot.m:30
CPTPlotRange
Defines an immutable range of plot data.
Definition: CPTPlotRange.h:27
NSUInteger
typedef NSUInteger
CPTFill.h
CPTBarPlot::baseValue
NSNumber * baseValue
The coordinate value of the fixed end of the bars. This is only used if barBasesVary is NO....
Definition: CPTBarPlot.h:219
CPTTextStyle
Immutable wrapper for various text style properties.
Definition: CPTTextStyle.h:18
CPTColor
An immutable color.
Definition: CPTColor.h:3
-[CPTBarPlot plotRangeEnclosingBars]
nullable CPTPlotRange * plotRangeEnclosingBars()
Computes a plot range that completely encloses all of the bars.
Definition: CPTBarPlot.m:834
-[CPTBarPlot reloadBarLineStyles]
void reloadBarLineStyles()
Reload all bar line styles from the data source immediately.
Definition: CPTBarPlot.m:557
CPTFill
Draws area fills.
Definition: CPTFill.h:18
-[NSObject copy]
id copy
NSAttributedString
CPTBarPlot::lineStyle
CPTLineStyle * lineStyle
The line style for the bar outline. If nil, the outline is not drawn.
Definition: CPTBarPlot.h:226
CPTBarPlotBindingBarTips
CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarTips
Bar tips.
Definition: CPTBarPlot.m:31
CPTMutableNumericData
An annotated NSMutableData type.
Definition: CPTMutableNumericData.h:5
CPTBarPlot::barsAreHorizontal
BOOL barsAreHorizontal
If YES, the bars will have a horizontal orientation, otherwise they will be vertical.
Definition: CPTBarPlot.h:218
BOOL
typedef BOOL
CPTDefinitions.h
-[CPTBarPlot reloadBarFills]
void reloadBarFills()
Reload all bar fills from the data source immediately.
Definition: CPTBarPlot.m:503
CPTPlot.h
CPTBarPlotDelegate-p
Bar plot delegate.
Definition: CPTBarPlot.h:131
CPTNumericData
An annotated NSData type.
Definition: CPTNumericData.h:4
CPTPlot
An abstract plot class.
Definition: CPTPlot.h:258
CPTBarPlotField
CPTBarPlotField
Enumeration of bar plot data source field types.
Definition: CPTBarPlot.h:34
CPTBarPlot::fill
CPTFill * fill
The fill style for the bars. If nil, the bars are not filled.
Definition: CPTBarPlot.h:227
CPTLineStyle.h
CPTTextLayer
A Core Animation layer that displays text drawn in a uniform style.
Definition: CPTTextLayer.h:9
cpt_swift_struct
#define cpt_swift_struct
Marks a type definition to be imported into Swift as a structure.
Definition: CPTDefinitions.h:73
NSString
CPTBarPlot::barBaseCornerRadius
CGFloat barBaseCornerRadius
The corner radius for the end of the bars drawn at the base value. Default is 0.0 for square corners.
Definition: CPTBarPlot.h:217
CPTPlotDelegate-p
Plot delegate.
Definition: CPTPlot.h:170
CPTBarPlotFieldBarLocation
@ CPTBarPlotFieldBarLocation
Bar location on independent coordinate axis.
Definition: CPTBarPlot.h:35
CPTBarPlotBindingBarLineStyles
CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarLineStyles
Bar line styles.
Definition: CPTBarPlot.m:34
-[CPTBarPlot reloadBarWidths]
void reloadBarWidths()
Reload all bar widths from the data source immediately.
Definition: CPTBarPlot.m:611
CPTBarPlot::barBasesVary
BOOL barBasesVary
If NO, a constant base value is used for all bars. If YES, the data source is queried to supply a bas...
Definition: CPTBarPlot.h:220
CPTBarPlotBindingBarFills
CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarFills
Bar fills.
Definition: CPTBarPlot.m:33
CPTBarPlot::barOffset
NSNumber * barOffset
The starting offset of the first bar in location data units.
Definition: CPTBarPlot.h:215