English 中文(简体)
CorePlot: 带有标签政策冲突的 XAxis 文本标签
原标题:CorePlot: XAxis Text Labels with labelingPolicy conflict

为何在字符串标签中找不到 CPTAxisLabeling Policy 与 CPTAxisLabeling Policy 不同的标签?

x.labelingPolicy = CPTAxisLabelingPolicyNone;

""https://i.sstatic.net/xfTJs.png" alt="此处输入图像描述"/ >

我想要这个全球资源信息数据库LineStyle, 但用我的文字标签:

x.labelingPolicy = CPTAxisLabelingPolicyFixedInterval

""https://i.sstatic.net/aqRkv.png" alt="此处输入图像描述"/ >

我用这个代码完成了 xAxis标签 :

NSMutableArray *labels = [[NSMutableArray alloc] initWithCapacity:[labelsAxisX count]];
    int idx = 0;
    for (NSString *product in labelsAxisX)
    {
        CPTAxisLabel *label = [[CPTAxisLabel alloc] initWithText:product textStyle:x.labelTextStyle];
        label.tickLocation = CPTDecimalFromInt(idx);
        label.offset = 5.0f;
        [labels addObject:label];
        [label release];
        idx++;
    }

    x.axisLabels = [NSSet setWithArray:labels];
    [labels release];
最佳回答

使用 CPTAxisLabeling PolicyNone 标签政策,您除了制作标签外,还需要提供标记位置(主要位置和/或次要位置)。如果您宁愿使用固定间隔标签政策,您可以为返回文本标签而不是数字的轴设定一个自定义编号。

这里的示例来自Plot Gallery 示例应用程序中的标签政策演示 :

NSMutableSet *tickLocations = [NSMutableSet set];
for ( NSUInteger loc = 0; loc < labelsAxisX.count; loc++ ) {
    [tickLocations addObject:[NSDecimalNumber numberWithUnsignedInteger:loc]];
}
axis.majorTickLocations = tickLocations;

小滴滴位同样工作 。

问题回答

暂无回答




相关问题
Which non-bold UTF-8 iPhone SDK font can I use here?

Problem: I create a UILabel with this font: label.font = [UIFont systemFontOfSize:15.0f]; Now this system font is bold, but I want to display pretty small text, and the text may also contain very ...

Limiting file upload type

Simple question. Is there a way to only allow txt files upon uploading? I ve looked around and all I find is text/php, which allows PHP. $uploaded_type=="text/php

Extract everything from PDF [closed]

Looking for solution to extract content from a PDF file (using console tool or a library). It will be used on server to produce on-line e-books from uploaded PDF files. Need to extract following ...

Flash & external form fields

Does anybody know if this is possible? I am trying to create a flash movie that will show / preview what I am typing into a field in a normal HTML form. The call to update the flash movie would most ...

Avoiding escape sequence processing in ActionScript?

I need to mimic C# functionality of the @ symbol when it precedes a string. @"C:AFilePath" for example What is the best way to do this? Also there are some sites that will escape larger ...

iPhone: Draw rotated text?

I want to draw some text in a view, rotated 90°. I m pretty new to iPhone development, and poking around the web reveals a number of different solutions. I ve tried a few and usually end up with my ...

Numbering in jQuery

How could I change the text below so that the text within it has a number appended to it. <div class="right">This is some text</div> <div class="right">This is some text</div>...

热门标签