Core Plot (macOS)
Cocoa plotting framework for macOS, iOS, and tvOS
CPTGraph.h
Go to the documentation of this file.
1 // Abstract class
2 #import "CPTBorderedLayer.h"
3 #import "CPTDefinitions.h"
4 #import "CPTPlot.h"
5 #import "CPTPlotSpace.h"
6 
8 
9 @class CPTAxisSet;
10 @class CPTGraphHostingView;
11 @class CPTLegend;
12 @class CPTPlotAreaFrame;
13 @class CPTTheme;
14 @class CPTTextStyle;
15 @class CPTLayerAnnotation;
16 
21 
26 
29 
33 extern CPTGraphNotification __nonnull const CPTGraphNeedsRedrawNotification NS_SWIFT_NAME(needsRedraw);
34 
41 extern CPTGraphNotification __nonnull const CPTGraphDidAddPlotSpaceNotification NS_SWIFT_NAME(didAddPlotSpace);
42 
49 extern CPTGraphNotification __nonnull const CPTGraphDidRemovePlotSpaceNotification NS_SWIFT_NAME(didRemovePlotSpace);
50 
56 
58 
62 typedef NS_ENUM (NSInteger, CPTGraphLayerType) {
69 };
70 
71 #pragma mark -
72 
74 
77 @property (nonatomic, readwrite, cpt_weak_property, nullable) CPTGraphHostingView *hostingView;
79 
82 @property (nonatomic, readwrite, copy, nullable) NSString *title;
83 @property (nonatomic, readwrite, copy, nullable) NSAttributedString *attributedTitle;
84 @property (nonatomic, readwrite, copy, nullable) CPTTextStyle *titleTextStyle;
85 @property (nonatomic, readwrite, assign) CGPoint titleDisplacement;
86 @property (nonatomic, readwrite, assign) CPTRectAnchor titlePlotAreaFrameAnchor;
88 
91 @property (nonatomic, readwrite, strong, nullable) CPTAxisSet *axisSet;
92 @property (nonatomic, readwrite, strong, nullable) CPTPlotAreaFrame *plotAreaFrame;
93 @property (nonatomic, readonly, nullable) CPTPlotSpace *defaultPlotSpace;
94 @property (nonatomic, readwrite, strong, nullable) CPTNumberArray *topDownLayerOrder;
96 
99 @property (nonatomic, readwrite, strong, nullable) CPTLegend *legend;
100 @property (nonatomic, readwrite, assign) CPTRectAnchor legendAnchor;
101 @property (nonatomic, readwrite, assign) CGPoint legendDisplacement;
103 
106 -(void)reloadData;
107 -(void)reloadDataIfNeeded;
109 
112 -(nonnull CPTPlotArray *)allPlots;
113 -(nullable CPTPlot *)plotAtIndex:(NSUInteger)idx;
114 -(nullable CPTPlot *)plotWithIdentifier:(nullable id<NSCopying>)identifier;
116 
119 -(void)addPlot:(nonnull CPTPlot *)plot;
120 -(void)addPlot:(nonnull CPTPlot *)plot toPlotSpace:(nullable CPTPlotSpace *)space;
121 -(void)removePlot:(nullable CPTPlot *)plot;
122 -(void)removePlotWithIdentifier:(nullable id<NSCopying>)identifier;
123 -(void)insertPlot:(nonnull CPTPlot *)plot atIndex:(NSUInteger)idx;
124 -(void)insertPlot:(nonnull CPTPlot *)plot atIndex:(NSUInteger)idx intoPlotSpace:(nullable CPTPlotSpace *)space;
126 
129 -(nonnull CPTPlotSpaceArray *)allPlotSpaces;
130 -(nullable CPTPlotSpace *)plotSpaceAtIndex:(NSUInteger)idx;
131 -(nullable CPTPlotSpace *)plotSpaceWithIdentifier:(nullable id<NSCopying>)identifier;
133 
136 -(void)addPlotSpace:(nonnull CPTPlotSpace *)space;
137 -(void)removePlotSpace:(nullable CPTPlotSpace *)plotSpace;
139 
142 -(void)applyTheme:(nullable CPTTheme *)theme;
144 
145 @end
146 
147 #pragma mark -
148 
153 
156 -(nullable CPTPlotSpace *)newPlotSpace;
157 -(nullable CPTAxisSet *)newAxisSet;
159 
160 @end
CPTPlotSpace.h
CPTGraphPlotSpaceNotificationKey
CPTGraphPlotSpaceKey __nonnull const CPTGraphPlotSpaceNotificationKey
The userInfo dictionary key used by the CPTGraphDidAddPlotSpaceNotification and CPTGraphDidRemovePlot...
Definition: CPTGraph.m:28
NSArray
CPTBorderedLayer.h
CPTGraph::legend
CPTLegend * legend
The graph legend. Setting this property will automatically anchor the legend to the graph and positio...
Definition: CPTGraph.h:99
CPTGraphDidRemovePlotSpaceNotification
CPTGraphNotification __nonnull const CPTGraphDidRemovePlotSpaceNotification
Notification sent by a graph after removing a plot space.
Definition: CPTGraph.m:27
CPTGraphLayerTypeMajorGridLines
@ CPTGraphLayerTypeMajorGridLines
Major grid lines.
Definition: CPTGraph.h:64
-[CPTGraph(AbstractFactoryMethods) newAxisSet]
nullable CPTAxisSet * newAxisSet()
Creates a new axis set for the graph.
Definition: CPTGraph.m:1392
CPTGraph::topDownLayerOrder
CPTNumberArray * topDownLayerOrder
An array of graph layers to be drawn in an order other than the default.
Definition: CPTGraph.h:94
CPTGraphLayerTypeMinorGridLines
@ CPTGraphLayerTypeMinorGridLines
Minor grid lines.
Definition: CPTGraph.h:63
NSUInteger
typedef NSUInteger
CPTGraph::titleTextStyle
CPTTextStyle * titleTextStyle
The text style of the title.
Definition: CPTGraph.h:84
CPTGraph::axisSet
CPTAxisSet * axisSet
The axis set.
Definition: CPTGraph.h:91
CPTPlotSpace
Defines the coordinate system of a plot.
Definition: CPTPlotSpace.h:178
CPTTextStyle
Immutable wrapper for various text style properties.
Definition: CPTTextStyle.h:18
CPTGraph::title
NSString * title
The title string.
Definition: CPTGraph.h:82
-[CPTGraph reloadDataIfNeeded]
void reloadDataIfNeeded()
Makes all plots reload their data if their data cache is out of date.
Definition: CPTGraph.m:467
-[NSObject copy]
id copy
CPTRectAnchor
CPTRectAnchor
Locations around the edge of a rectangle.
Definition: CPTDefinitions.h:194
NSAttributedString
CPTGraphLayerTypeAxisLabels
@ CPTGraphLayerTypeAxisLabels
Axis labels.
Definition: CPTGraph.h:67
CPTLayerAnnotation
Positions a content layer relative to an anchor point in a reference layer.
Definition: CPTLayerAnnotation.h:7
CPTGraph::legendDisplacement
CGPoint legendDisplacement
A vector giving the displacement of the legend from the edge location.
Definition: CPTGraph.h:101
CPTGraphLayerTypeAxisLines
@ CPTGraphLayerTypeAxisLines
Axis lines.
Definition: CPTGraph.h:65
CPTGraph::titleDisplacement
CGPoint titleDisplacement
A vector giving the displacement of the title from the edge location.
Definition: CPTGraph.h:85
CPTTheme
Creates a CPTGraph instance formatted with a predefined style.
Definition: CPTTheme.h:22
CPTDefinitions.h
CPTGraphLayerTypeAxisTitles
@ CPTGraphLayerTypeAxisTitles
Axis titles.
Definition: CPTGraph.h:68
CPTLegend
A graph legend.
Definition: CPTLegend.h:185
CPTPlot.h
CPTGraphHostingView
A container view for displaying a CPTGraph.
Definition: CPTGraphHostingView.h:5
CPTGraphLayerTypePlots
@ CPTGraphLayerTypePlots
Plots.
Definition: CPTGraph.h:66
CPTPlot
An abstract plot class.
Definition: CPTPlot.h:258
CPTGraph::plotAreaFrame
CPTPlotAreaFrame * plotAreaFrame
The plot area frame.
Definition: CPTGraph.h:92
CPTGraphNeedsRedrawNotification
CPTGraphNotification __nonnull const CPTGraphNeedsRedrawNotification
Notification sent by various objects to tell the graph it should redraw itself.
Definition: CPTGraph.m:25
CPTBorderedLayer
A layer with a border line and background fill.
Definition: CPTBorderedLayer.h:7
-[CPTGraph allPlots]
nonnull CPTPlotArray * allPlots()
All plots associated with the graph.
Definition: CPTGraph.m:475
CPTGraph(AbstractFactoryMethods)
CPTGraph abstract methods—must be overridden by subclasses.
Definition: CPTGraph.h:152
cpt_swift_struct
#define cpt_swift_struct
Marks a type definition to be imported into Swift as a structure.
Definition: CPTDefinitions.h:73
CPTGraph::hostingView
CPTGraphHostingView * hostingView
The hosting view that contains the graph.
Definition: CPTGraph.h:77
NSString
CPTPlotAreaFrame
A layer drawn on top of the graph layer and behind all plot elements.
Definition: CPTPlotAreaFrame.h:8
-[CPTGraph allPlotSpaces]
nonnull CPTPlotSpaceArray * allPlotSpaces()
All plot spaces associated with the graph.
Definition: CPTGraph.m:603
cpt_weak_property
#define cpt_weak_property
A custom definition for automatic reference counting (ARC) weak properties that falls back to assign ...
Definition: CPTDefinitions.h:32
CPTGraph::defaultPlotSpace
CPTPlotSpace * defaultPlotSpace
The default plot space.
Definition: CPTGraph.h:93
-[CPTGraph(AbstractFactoryMethods) newPlotSpace]
nullable CPTPlotSpace * newPlotSpace()
Creates a new plot space for the graph.
Definition: CPTGraph.m:1384
CPTGraphDidAddPlotSpaceNotification
CPTGraphNotification __nonnull const CPTGraphDidAddPlotSpaceNotification
Notification sent by a graph after adding a new plot space.
Definition: CPTGraph.m:26
CPTGraph::attributedTitle
NSAttributedString * attributedTitle
The styled title string.
Definition: CPTGraph.h:83
-[CPTGraph reloadData]
void reloadData()
Makes all plots reload their data.
Definition: CPTGraph.m:458
CPTGraph::titlePlotAreaFrameAnchor
CPTRectAnchor titlePlotAreaFrameAnchor
The location of the title with respect to the plot area frame. Default is CPTRectAnchorTop.
Definition: CPTGraph.h:86
CPTGraph
An abstract graph class.
Definition: CPTGraph.h:74
CPTAxisSet
A container layer for the set of axes for a graph.
Definition: CPTAxisSet.h:7
CPTGraphLayerType
CPTGraphLayerType
Enumeration of graph layers.
Definition: CPTGraph.h:62
CPTGraph::legendAnchor
CPTRectAnchor legendAnchor
The location of the legend with respect to the graph frame. Default is CPTRectAnchorBottom.
Definition: CPTGraph.h:100