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