forked from core-plot/core-plot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCPTGraph.h
More file actions
150 lines (124 loc) · 4.49 KB
/
CPTGraph.h
File metadata and controls
150 lines (124 loc) · 4.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// Abstract class
#import "CPTBorderedLayer.h"
#import "CPTDefinitions.h"
#import "CPTPlot.h"
#import "CPTPlotSpace.h"
/// @file
@class CPTAxisSet;
@class CPTGraphHostingView;
@class CPTLegend;
@class CPTPlotAreaFrame;
@class CPTTheme;
@class CPTTextStyle;
@class CPTLayerAnnotation;
/// @name Graph
/// @{
/** @brief Notification sent by various objects to tell the graph it should redraw itself.
* @ingroup notification
**/
extern NSString *__nonnull const CPTGraphNeedsRedrawNotification;
/** @brief Notification sent by a graph after adding a new plot space.
* @ingroup notification
*
* The notification <code>userInfo</code> dictionary will include the new plot space under the
* CPTGraphPlotSpaceNotificationKey key.
**/
extern NSString *__nonnull const CPTGraphDidAddPlotSpaceNotification;
/** @brief Notification sent by a graph after removing a plot space.
* @ingroup notification
*
* The notification <code>userInfo</code> dictionary will include the removed plot space under the
* CPTGraphPlotSpaceNotificationKey key.
**/
extern NSString *__nonnull const CPTGraphDidRemovePlotSpaceNotification;
/** @brief The <code>userInfo</code> dictionary key used by the CPTGraphDidAddPlotSpaceNotification
* and CPTGraphDidRemovePlotSpaceNotification notifications for the plot space.
* @ingroup notification
**/
extern NSString *__nonnull const CPTGraphPlotSpaceNotificationKey;
/// @}
/**
* @brief Enumeration of graph layers.
**/
typedef NS_ENUM (NSInteger, CPTGraphLayerType) {
CPTGraphLayerTypeMinorGridLines, ///< Minor grid lines.
CPTGraphLayerTypeMajorGridLines, ///< Major grid lines.
CPTGraphLayerTypeAxisLines, ///< Axis lines.
CPTGraphLayerTypePlots, ///< Plots.
CPTGraphLayerTypeAxisLabels, ///< Axis labels.
CPTGraphLayerTypeAxisTitles ///< Axis titles.
};
#pragma mark -
@interface CPTGraph : CPTBorderedLayer
/// @name Hosting View
/// @{
@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTGraphHostingView *hostingView;
/// @}
/// @name Title
/// @{
@property (nonatomic, readwrite, copy, nullable) NSString *title;
@property (nonatomic, readwrite, copy, nullable) NSAttributedString *attributedTitle;
@property (nonatomic, readwrite, copy, nullable) CPTTextStyle *titleTextStyle;
@property (nonatomic, readwrite, assign) CGPoint titleDisplacement;
@property (nonatomic, readwrite, assign) CPTRectAnchor titlePlotAreaFrameAnchor;
/// @}
/// @name Layers
/// @{
@property (nonatomic, readwrite, strong, nullable) CPTAxisSet *axisSet;
@property (nonatomic, readwrite, strong, nullable) CPTPlotAreaFrame *plotAreaFrame;
@property (nonatomic, readonly, nullable) CPTPlotSpace *defaultPlotSpace;
@property (nonatomic, readwrite, strong, nullable) CPTNumberArray *topDownLayerOrder;
/// @}
/// @name Legend
/// @{
@property (nonatomic, readwrite, strong, nullable) CPTLegend *legend;
@property (nonatomic, readwrite, assign) CPTRectAnchor legendAnchor;
@property (nonatomic, readwrite, assign) CGPoint legendDisplacement;
/// @}
/// @name Data Source
/// @{
-(void)reloadData;
-(void)reloadDataIfNeeded;
/// @}
/// @name Retrieving Plots
/// @{
-(nonnull CPTPlotArray *)allPlots;
-(nullable CPTPlot *)plotAtIndex:(NSUInteger)idx;
-(nullable CPTPlot *)plotWithIdentifier:(nullable id<NSCopying>)identifier;
/// @}
/// @name Adding and Removing Plots
/// @{
-(void)addPlot:(nonnull CPTPlot *)plot;
-(void)addPlot:(nonnull CPTPlot *)plot toPlotSpace:(nullable CPTPlotSpace *)space;
-(void)removePlot:(nullable CPTPlot *)plot;
-(void)removePlotWithIdentifier:(nullable id<NSCopying>)identifier;
-(void)insertPlot:(nonnull CPTPlot *)plot atIndex:(NSUInteger)idx;
-(void)insertPlot:(nonnull CPTPlot *)plot atIndex:(NSUInteger)idx intoPlotSpace:(nullable CPTPlotSpace *)space;
/// @}
/// @name Retrieving Plot Spaces
/// @{
-(nonnull CPTPlotSpaceArray *)allPlotSpaces;
-(nullable CPTPlotSpace *)plotSpaceAtIndex:(NSUInteger)idx;
-(nullable CPTPlotSpace *)plotSpaceWithIdentifier:(nullable id<NSCopying>)identifier;
/// @}
/// @name Adding and Removing Plot Spaces
/// @{
-(void)addPlotSpace:(nonnull CPTPlotSpace *)space;
-(void)removePlotSpace:(nullable CPTPlotSpace *)plotSpace;
/// @}
/// @name Themes
/// @{
-(void)applyTheme:(nullable CPTTheme *)theme;
/// @}
@end
#pragma mark -
/** @category CPTGraph(AbstractFactoryMethods)
* @brief CPTGraph abstract methods—must be overridden by subclasses
**/
@interface CPTGraph(AbstractFactoryMethods)
/// @name Factory Methods
/// @{
-(nullable CPTPlotSpace *)newPlotSpace;
-(nullable CPTAxisSet *)newAxisSet;
/// @}
@end