The view, whose header import every other one, so #import
< PHGraph/PHGraphView.h > is usually everything you
need.
Relevant instance variables are :
NSMutableArray *xAxis;
NSMutableArray *yAxis;
NSMutableArray *graphObjects;
NSPoint
currentLocation;
int
mouseEventsMode;
IBOutlet
id
delegate;
BOOL
hasBorder;
float
leftBorder;
float
rightBorder;
float
topBorder;
float
bottomBorder;
and methods :
-(void)addPHxAxis:(PHxAxis*)axis;
-(void)addPHyAxis:(PHyAxis*)axis;
-(void)addPHGraphObject:(PHGraphObject*)object;
-(void)removePHxAxis:(PHxAxis*)axis;
-(void)removePHyAxis:(PHyAxis*)axis;
-(void)removePHGraphObject:(PHGraphObject*)object;
Direct accessors to the objects arrays :
-(NSMutableArray*)xAxisMutableArray;
-(NSMutableArray*)yAxisMutableArray;
-(NSMutableArray*)graphObjectsMutableArray;
-(void)setXAxisMutableArray:(NSMutableArray*)anArray;
-(void)setYAxisMutableArray:(NSMutableArray*)anArray;
-(void)setGraphObjectsMutableArray:(NSMutableArray*)anArray;
-(void)setMouseEventsMode:(int)mode;
-(void)setDelegate:(id)newDelegate;
-(id)delegate;
-(void)setHasBorder:(BOOL)value;
-(void)setLeftBorder:(float)newLeftBorder
rightBorder:(float)newRightBorder
bottomBorder:(float)newBottomBorder
topBorder:(float)newTopBorder;
The three following methods are called by the contextual
menu :
-(void)copyToPasteboardAsTIFF;
-(void)copyToPasteboardAsPDF;
-(void)copyToPasteboardAsEPS;
The mouseEventsMode is one of PHOnlyDelegate,
PHCompositeZoomAndDrag, PHDragAndMove and PHZoomOnSelection
(try the provided examples to see how they perform).
The
hasBorder boolean
allows one to decide if the tickmarks are to be drawn
inside the graph or outside it. (In the second case, some
space must be reserved for the drawing of the tickmarks and
of their values.) By default, there is no border around the
graph.
The delegate may implement :
-(void)mouseDownAtPoint:(NSPoint)pos;
-(void)mouseDraggedAtPoint:(NSPoint)pos;
-(void)mouseUpAtPoint:(NSPoint)pos;
getting the position of the event, with 0 to 1 scaling
(then can use convertValue from one axis to get the good
coordinate of the event.)