快速绘制Coreplot:将轴的起始值更改为1 [英] Coreplot in swift: change starting value of axis to 1

查看:73
本文介绍了快速绘制Coreplot:将轴的起始值更改为1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图,但我不想 x 和2 y 从1开始不是0.

I have a graph and I wan't that the x and the 2 y to start at 1 not 0.

![在此处输入图片描述] [1]

![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)

我该怎么做?

推荐答案

绘图范围的位置是左端(在x-轴)或底端(在y轴上)。将每个范围的位置设为一(1),然后将 length 调整为最大值-最小值(即,这种情况)。

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).

这篇关于快速绘制Coreplot:将轴的起始值更改为1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆