1 // Abstract class 2 #import "CPTBorderedLayer.h" 3 #import "CPTDefinitions.h" 4 5 /// @file 6 7 @class CPTAxisSet; 8 @class CPTLegend; 9 @class CPTPlot; 10 @class CPTPlotAreaFrame; 11 @class CPTPlotSpace; 12 @class CPTTheme; 13 @class CPTTextStyle; 14 @class CPTLayerAnnotation; 15 16 /// @name Graph 17 /// @{ 18 19 /** @brief Notification sent by various objects to tell the graph it should redraw itself. 20 * @ingroup notification 21 **/ 22 extern NSString * const CPTGraphNeedsRedrawNotification; 23 24 /// @} 25 26 /** 27 * @brief Enumeration of graph layers. 28 **/ 29 typedef enum _CPTGraphLayerType { 30 CPTGraphLayerTypeMinorGridLines, ///< Minor grid lines. 31 CPTGraphLayerTypeMajorGridLines, ///< Major grid lines. 32 CPTGraphLayerTypeAxisLines, ///< Axis lines. 33 CPTGraphLayerTypePlots, ///< Plots. 34 CPTGraphLayerTypeAxisLabels, ///< Axis labels. 35 CPTGraphLayerTypeAxisTitles ///< Axis titles. 36 } CPTGraphLayerType; 37 38 #pragma mark - 39 40 @interface CPTGraph : CPTBorderedLayer { 41 @private 42 CPTPlotAreaFrame *plotAreaFrame; 43 NSMutableArray *plots; 44 NSMutableArray *plotSpaces; 45 NSString *title; 46 CPTTextStyle *titleTextStyle; 47 CPTRectAnchor titlePlotAreaFrameAnchor; 48 CGPoint titleDisplacement; 49 CPTLayerAnnotation *titleAnnotation; 50 CPTLegend *legend; 51 CPTLayerAnnotation *legendAnnotation; 52 CPTRectAnchor legendAnchor; 53 CGPoint legendDisplacement; 54 } 55 56 /// @name Title 57 /// @{ 58 @property (nonatomic, readwrite, copy) NSString *title; 59 @property (nonatomic, readwrite, copy) CPTTextStyle *titleTextStyle; 60 @property (nonatomic, readwrite, assign) CGPoint titleDisplacement; 61 @property (nonatomic, readwrite, assign) CPTRectAnchor titlePlotAreaFrameAnchor; 62 /// @} 63 64 /// @name Layers 65 /// @{ 66 @property (nonatomic, readwrite, retain) CPTAxisSet *axisSet; 67 @property (nonatomic, readwrite, retain) CPTPlotAreaFrame *plotAreaFrame; 68 @property (nonatomic, readonly, retain) CPTPlotSpace *defaultPlotSpace; 69 @property (nonatomic, readwrite, retain) NSArray *topDownLayerOrder; 70 /// @} 71 72 /// @name Legend 73 /// @{ 74 @property (nonatomic, readwrite, retain) CPTLegend *legend; 75 @property (nonatomic, readwrite, assign) CPTRectAnchor legendAnchor; 76 @property (nonatomic, readwrite, assign) CGPoint legendDisplacement; 77 /// @} 78 79 /// @name Data Source 80 /// @{ 81 -(void)reloadData; 82 -(void)reloadDataIfNeeded; 83 /// @} 84 85 /// @name Retrieving Plots 86 /// @{ 87 -(NSArray *)allPlots; 88 -(CPTPlot *)plotAtIndex:(NSUInteger)index; 89 -(CPTPlot *)plotWithIdentifier:(id <NSCopying>)identifier; 90 /// @} 91 92 /// @name Adding and Removing Plots 93 /// @{ 94 -(void)addPlot:(CPTPlot *)plot; 95 -(void)addPlot:(CPTPlot *)plot toPlotSpace:(CPTPlotSpace *)space; 96 -(void)removePlot:(CPTPlot *)plot; 97 -(void)removePlotWithIdentifier:(id <NSCopying>)identifier; 98 -(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)index; 99 -(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)index intoPlotSpace:(CPTPlotSpace *)space; 100 /// @} 101 102 /// @name Retrieving Plot Spaces 103 /// @{ 104 -(NSArray *)allPlotSpaces; 105 -(CPTPlotSpace *)plotSpaceAtIndex:(NSUInteger)index; 106 -(CPTPlotSpace *)plotSpaceWithIdentifier:(id <NSCopying>)identifier; 107 /// @} 108 109 /// @name Adding and Removing Plot Spaces 110 /// @{ 111 -(void)addPlotSpace:(CPTPlotSpace *)space; 112 -(void)removePlotSpace:(CPTPlotSpace *)plotSpace; 113 /// @} 114 115 /// @name Themes 116 /// @{ 117 -(void)applyTheme:(CPTTheme *)theme; 118 /// @} 119 120 @end 121 122 #pragma mark - 123 124 /** @category CPTGraph(AbstractFactoryMethods) 125 * @brief CPTGraph abstract methods—must be overridden by subclasses 126 **/ 127 @interface CPTGraph(AbstractFactoryMethods) 128 129 /// @name Factory Methods 130 /// @{ 131 -(CPTPlotSpace *)newPlotSpace; 132 -(CPTAxisSet *)newAxisSet; 133 /// @} 134 135 @end 136