问题
I have a graph and I wan't that the x
and the 2 y
to start at 1 not 0.
![enter image description here][1]
This is how i setup the plotspaces:
//plotspace 1
var plotSpace: CPTXYPlotSpace = graph.defaultPlotSpace as CPTXYPlotSpace
var xRange = plotSpace.xRange.mutableCopy() as CPTMutablePlotRange
var yRange = plotSpace.yRange.mutableCopy() as CPTMutablePlotRange
xRange.length = self.maxX
yRange.length = maxPoids
plotSpace.xRange = xRange
plotSpace.yRange = yRange
//plotspace2 (second y)
var plotSpace2: CPTXYPlotSpace = CPTXYPlotSpace()
var xRange2 = plotSpace2.xRange.mutableCopy() as CPTMutablePlotRange
var yRange2 = plotSpace2.yRange.mutableCopy() as CPTMutablePlotRange
xRange2.length = self.maxX
yRange2.length = maxEau
plotSpace2.xRange = xRange2
plotSpace2.yRange = yRange2
graph.addPlotSpace(plotSpace2)
How can I do that?
回答1:
The location
of a plot range is the left end (on the x-axis) or bottom end (on the y-axis). Give each range a location
of one (1) and adjust the length
to the max - min (i.e., one in this case).
来源:https://stackoverflow.com/questions/27324882/coreplot-in-swift-change-starting-value-of-axis-to-1