我需要幫助我想使用縮放圖在CorePlot中創建z軸。如何使用核心繪圖在x軸上顯示時間ios sdk
- (void)viewDidLoad
{
[super viewDidLoad];
// We need a hostview, you can create one in IB (and create an outlet) or just do this:
CPTGraphHostingView* hostView = [[CPTGraphHostingView alloc] initWithFrame:self.view.frame];
[self.view addSubview: hostView];
// Create a CPTGraph object and add to hostView
CPTGraph* graph = [[CPTXYGraph alloc] initWithFrame:hostView.bounds];
hostView.hostedGraph = graph;
// Get the (default) plotspace from the graph so we can set its x/y ranges
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *) graph.defaultPlotSpace;
// Note that these CPTPlotRange are defined by START and LENGTH (not START and END) !!
[plotSpace setYRange: [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0) length:CPTDecimalFromFloat(16)]];
[plotSpace setXRange: [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-4) length:CPTDecimalFromFloat(8)]];
// Create the plot (we do not define actual x/y values yet, these will be supplied by the datasource...)
CPTScatterPlot* plot = [[CPTScatterPlot alloc] initWithFrame:CGRectZero];
// Let's keep it simple and let this class act as datasource (therefore we implemtn <CPTPlotDataSource>)
plot.dataSource = self;
// Finally, add the created plot to the default plot space of the CPTGraph object we created before
[graph addPlot:plot toPlotSpace:graph.defaultPlotSpace];
}
如何根據繪圖點設置x軸時間像1:30,1:32,1:35。
核心繪圖僅支持2D圖形。你想繪製一個3D情節? –
@EricSkroch:是的,我需要設置第三軸,即核心圖中的z軸。 – MRJ
@EricSkroch:是的,我需要設置第三軸,即核心圖中的z軸。我需要右側y軸,所以你可以讓我知道我該怎麼辦? – MRJ