理解hostingView Graph plotAreaFrame plotArea四者關系
- hostingView:承載整個繪圖的view
- Graph :畫布,可以在上面畫圖
- plotAreaFrame:通過三個屬性CPTPlotArea、CPTAxisSet、CPTPlotGroup分別管理繪圖區域、坐標系、圖表類型
- ** plotArea:**繪制圖表區域
CPTXYGraph類繼承關系
CPTXYGraph
->CPTGraph
->CPTBorderedLayer:設置Graph邊界線條
->CPTAnnotationHostLayer
->CPTLayer
CPTGraph在初始化過程中主要完成5大功能:
- 功能1:設置graph中坐標軸距離hostingView的邊距
- 功能2:設置繪圖區域
- 功能3:設置繪圖范圍,例如XY軸顯示范圍、XY軸滾動范圍、XY軸顯示樣式等
- 功能4:設置圖表標題
- 功能5:設置圖表說明
CPTPlotAreaFrame
CPTPlotAreaFrame
->CPTBorderedLayer
->CPTAnnotationHostLayer
->CPTLayer
//繪圖區域管理者
@interface CPTPlotAreaFrame : CPTBorderedLayer
@property (nonatomic, readonly, nullable) CPTPlotArea *plotArea;//在initWithFrame中創建
@property (nonatomic, readwrite, strong, nullable) CPTAxisSet *axisSet;//坐標軸
@property (nonatomic, readwrite, strong, nullable) CPTPlotGroup *plotGroup;//坐標軸應用于哪個group
@end
CPTXYAxisSet
繼承關系
CPTXYAxisSet:坐標軸的集合
->CPTAxisSet:坐標軸的集合
->CPTLayer
CPTXYAxis
繼承關系
CPTXYAxis
->CPTAxis:坐標軸
->CPTLayer
CPTXYPlotSpace坐標軸顯示范圍
CPTXYPlotSpace
->CPTPlotSpace
->NSObject