2

我想知道如何将单元附加到动态的 Core Plot 轴,如下所示。不幸的是,这并不像遍历标签和附加文本那么容易(我相信是由于图层操作和渲染)。有人知道该怎么做吗?

    CPTXYAxis *x = axisSet.xAxis;
    x.orthogonalCoordinateDecimal = CPTDecimalFromDouble(self.plotSpace1.xRange.minLimitDouble);//Where the Y Axis meets the X axis
    x.majorIntervalLength = CPTDecimalFromDouble(200.0);//Interval for X Axis
    x.minorTicksPerInterval = 0;
//    x.tickDirection = CPTSignNone;
//    x.axisLineStyle = axisLineStyle;
//    x.majorTickLength = 12.0;
//    x.majorTickLineStyle = axisLineStyle;
//    x.minorTickLength = 8.0;
    x.title = cYards;
    x.titleTextStyle = axisTitleTextStyle;
    x.titleOffset = 25.0;
    x.axisConstraints = [CPTConstraints constraintWithLowerOffset:0.0];


    // Label y with an automatic labeling policy.
    axisLineStyle.lineColor = [CPTColor greenColor];

    CPTXYAxis *y = axisSet.yAxis;
    y.labelingPolicy = CPTAxisLabelingPolicyAutomatic;
    y.preferredNumberOfMajorTicks = 11;
    y.majorIntervalLength = CPTDecimalFromDouble(100.0);
    y.minorTicksPerInterval = 0;
    y.tickDirection = CPTSignNegative;
    y.axisLineStyle = axisLineStyle;
    y.majorTickLineStyle = axisLineStyle;
    y.orthogonalCoordinateDecimal = CPTDecimalFromDouble(self.plotSpace1.xRange.minLimitDouble);
    y.title = cInches;
    y.titleTextStyle = axisTitleTextStyle;
    y.titleOffset = 30.0;


    // Label y2 with an equal division labeling policy.
    axisLineStyle.lineColor = [CPTColor orangeColor];

    CPTXYAxis *y2 = [[CPTXYAxis alloc] init];
    y2.coordinate = CPTCoordinateY;
    y2.plotSpace = self.plotSpace2;
    y2.orthogonalCoordinateDecimal = CPTDecimalFromDouble(self.plotSpace1.xRange.maxLimitDouble);//Where the Y Axis meets the X axis
    y2.preferredNumberOfMajorTicks = 8;

    y2.majorIntervalLength = CPTDecimalFromDouble(200.0);
    y2.minorTicksPerInterval = 0;
    y2.tickDirection = CPTSignPositive;
    y2.axisLineStyle = axisLineStyle;
    y2.majorTickLineStyle = axisLineStyle;
    y2.title= cFps;
    y2.titleTextStyle = axisTitleTextStyle;
    y2.titleOffset = 30.0;
4

1 回答 1

2

创建一个NSNumberFormatter,设置positiveSuffix和/或negativeSuffix,并将其设置为轴labelFormatter

于 2013-10-01T00:08:48.720 回答