标签: core-plot

在不同背景下颠倒呈现的核心图

我正在使用核心图库绘制图形。对于某些动画,我必须拍摄整个屏幕的图像快照以使其平滑。问题是当我尝试从图表中获取图像时。该图总是上下颠倒。如果我仅将图形本身作为快照,那么这将不是问题-我可以轻松地对其进行转换。问题是,我正在对整个屏幕进行动画处理,以便拍摄整个UIWindow的快照,该UIWindow在其子视图之一中包含图形。我使用code.google上coreplot项目中提供的coreplot 0.2.2示例进行了尝试。我只是向窗口添加了一个按钮(以便在每个选项卡上可见),当按下按钮时,我从窗口内容中获取图像,并使用以下代码将其另存为相册库中的图像:

  
UIView *window = [[UIApplication sharedApplication] keyWindow];
UIGraphicsBeginImageContext(window.frame.size);
[window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(newImage, nil, NULL, NULL);
Run Code Online (Sandbox Code Playgroud)

结果如上所述。与屏幕上可见的图形相比,生成的图像中的图形颠倒显示。我做错了还是那是核心漏洞?

iphone core-plot

2
推荐指数
1
解决办法
1426
查看次数

CorePlot - '@'令牌之前的预期令牌

我正在尝试将CorePlot合并到我的项目中.我终于设法识别我的头文件但我在main.m中不断收到以下错误.

"'''令牌之前的预期表达"

int main(int argc, char *argv[])
{ 
    @autoreleasepool { 
    return UIApplicationMain(argc, argv, nil, NSStringFromClass([ProjectFiveAppDelegate     class]));
    }
}
Run Code Online (Sandbox Code Playgroud)

xcode expression core-plot

2
推荐指数
1
解决办法
1874
查看次数

Core Plot饼图上奇怪的边框

为什么Core Plot绘制这两行?

ios图

这就是我设置图表的方式:

// setup the pie chart
graph = [[CPTXYGraph alloc] initWithFrame:[_pieView bounds]];
[_pieView setHostedGraph:graph];

CPTPieChart *pieChart = [[CPTPieChart alloc] init];
[pieChart setDataSource:self];
[pieChart setPieRadius:75.0];
[pieChart setIdentifier:@"PieChart1"];
[pieChart setStartAngle:M_PI_4];
[pieChart setSliceDirection:CPTPieDirectionClockwise];

[graph addPlot:pieChart];
Run Code Online (Sandbox Code Playgroud)

(_pieViewCPTGraphHostingView*)

如何删除两条黑线?我尝试过如何删除核心图表周围的边框,但无济于事.

core-plot ios pie-chart

2
推荐指数
1
解决办法
593
查看次数

Core Plot动力滚动

有什么方法可以让Core Plot滚动在UIScrollView中表现得像动量滚动一样吗?我制作了一个CPTGraphHostingView并将其作为子视图添加到UIViewController.view中.

有人会善意提供方向或代码来指导我完成吗?

iphone scroll graph uiscrollview core-plot

2
推荐指数
1
解决办法
688
查看次数

Core Plot Legent没有显示

我是Core Plot的新手,我无法在我的视图中添加一个Legend.我一直在尝试各种教程并阅读大量信息,但我不明白如何显示图例.

我真的很感激一些帮助,因为我花了很多时间试图让它发挥作用.

请注意,我在这一点上的目标是显示如下传奇:

我想要的是

这是我得到的:

现在的传奇

唯一出现的是右边的粗线.我可以移动,但不能得到传说.

代码:

// Create pieChart from theme
pieChart = [[CPTXYGraph alloc] initWithFrame:CGRectZero];
CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme];
[pieChart applyTheme:theme];

//Create host view
self.hostingView = [[CPTGraphHostingView alloc] 
                    initWithFrame:[[UIScreen mainScreen]bounds]];
[self.view addSubview:self.hostingView];

hostingView_.hostedGraph = pieChart;
pieChart.axisSet = nil;
pieChart.plotAreaFrame.borderLineStyle = nil; 

pieChart.paddingLeft   = 10.0;
pieChart.paddingTop    = 120.0;
pieChart.paddingRight  = 10.0;
pieChart.paddingBottom = 80.0;

pieChart.fill = [CPTFill fillWithColor:[CPTColor clearColor]];
pieChart.plotAreaFrame.fill = [CPTFill fillWithColor:[CPTColor clearColor]];

CPTMutableTextStyle *whiteText = [CPTMutableTextStyle textStyle];
whiteText.color = [CPTColor whiteColor];
whiteText.fontSize = 14;
whiteText.fontName = …
Run Code Online (Sandbox Code Playgroud)

objective-c core-plot

2
推荐指数
1
解决办法
884
查看次数

是否可以在不打开特定视图的情况下拍摄屏幕截图?

我是iPhone开发新手.对iPhone技术中的视图和布局不太熟悉.

我想要实现的是:

  • 我在包含一个按钮的页面中,点击该按钮我打开图表视图(使用核心图).
  • 我想拍一张该图表视图的屏幕截图,但我不想打开那个视图.

这可能吗 ?

任何帮助将不胜感激.

iphone screenshot objective-c core-plot ios

2
推荐指数
1
解决办法
194
查看次数

核心图:如何从用户选择的栏中显示弹出框

我想要完成什么

我正在使用Core Plot(1.1)来绘制一个条形图,我想在条形图下方提供一个popover,其中有更多细节由用户选择(点击).

我的代码看起来像这样:

- (void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx {

    NSNumber *yValue = self.values[idx];
    NSLog(@"barWasSelectedAtRecordIndex x: %i, y: %@",idx,yValue);

    NSDecimal plotPoint[2];
    NSNumber *plotXvalue = [self numberForPlot:plot
                                         field:CPTScatterPlotFieldX
                                   recordIndex:idx];
    plotPoint[CPTCoordinateX] =
        CPTDecimalFromFloat(plotXvalue.floatValue);

    NSNumber *plotYvalue = [self numberForPlot:plot
                                         field:CPTScatterPlotFieldY
                                   recordIndex:idx];

    plotPoint[CPTCoordinateY] =
        CPTDecimalFromFloat(plotYvalue.floatValue); 

    CPTXYPlotSpace *plotSpace =
        (CPTXYPlotSpace *)graph.defaultPlotSpace;
    CGPoint dataPoint =
        [plotSpace plotAreaViewPointForPlotPoint:plotPoint];
    NSLog(@"datapoint (CGPoint) coordinates tapped: %@",
          NSStringFromCGPoint(dataPoint));

    GrowthChartInfoTableViewController *infoViewController =
        [self.storyboard instantiateViewControllerWithIdentifier:
         @"GrowthChartInfo"];

    self.popover = [[UIPopoverController alloc]
                    initWithContentViewController:infoViewController];
    self.popover.popoverContentSize = CGSizeMake(320, 300);
    self.popover.delegate = self;
    CGRect popoverAnchor =
            CGRectMake(dataPoint.x + …
Run Code Online (Sandbox Code Playgroud)

objective-c uiview core-plot uipopovercontroller ios

2
推荐指数
1
解决办法
2761
查看次数

当我使用Core-Plot仅显示y轴上的间隔时,如何保持x轴可见

当我在y轴上只显示一个间隔时,我想在屏幕上看到x轴.当间隔从0显示时,x轴是可见的,所以我认为我应该使用yRange向上移动x轴,但我不确切知道如何做到这一点.

这是我设置xRange和yRange的部分.对于y轴,我搜索我想要显示的最小值和最大值.

    CPTMutablePlotRange *xRange = [plotSpace.xRange mutableCopy];
[xRange expandRangeByFactor:CPTDecimalFromCGFloat(1.1f)];
plotSpace.xRange = xRange;
//CPTMutablePlotRange *yRange = [plotSpace.yRange mutableCopy];
//[yRange expandRangeByFactor:CPTDecimalFromCGFloat(1.2f)];
//plotSpace.yRange = yRange;

cpd = [CPDStockPriceStore sharedInstance];
NSMutableArray *arr = cpd.prices;
minY = 10000;
maxY = 0;
for (unsigned i = 1; i < [arr count]; i++){
    if([[arr objectAtIndex:i] intValue] < minY) minY = [[arr objectAtIndex:i]intValue];
    if([[arr objectAtIndex:i] intValue] > maxY) maxY = [[arr objectAtIndex:i]intValue];
}

CGFloat yMin = 100*((minY-200)/100);
CGFloat yMax = 100*((maxY+200)/100);  // should determine dynamically based on max …
Run Code Online (Sandbox Code Playgroud)

plot core-plot ios axis-labels

2
推荐指数
1
解决办法
1144
查看次数

CorePlot在iOS7 app/Xcode5中抛出异常

我有一个iOS7应用程序,我试图将CorePlot 1.4集成到(从属项目安装).

@property (nonatomic) CPTGraphHostingView *hostingView;
Run Code Online (Sandbox Code Playgroud)

_hostingView = [[CPTGraphHostingView alloc] initWithFrame:CGRectNull];
Run Code Online (Sandbox Code Playgroud)

(_hostingView受自动布局限制.)如果我然后添加图表:

CPTXYGraph *graph = [[CPTXYGraph alloc] initWithFrame:CGRectZero];
_hostingView.hostedGraph = graph;
Run Code Online (Sandbox Code Playgroud)

我首先得到这个例外:

-[CPTTextStyle attributes]: unrecognized selector sent to instance 0xa392900
 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CPTTextStyle attributes]: unrecognized selector sent to instance 0xa392900'
5   myapp                     0x00074325 -[CPTAxis updateAxisLabelsAtLocations:inRange:useMajorAxisLabels:] + 1141
6   myapp                     0x00075662 -[CPTAxis relabel] + 1202
Run Code Online (Sandbox Code Playgroud)

无奈之下,我已经updateAxisLabelsAtLocations:inRange:useMajorAxisLabels通过以下方式解决了这个问题:

NSDictionary *textAttributes = nil;
BOOL hasAttributedFormatter  = FALSE;
Run Code Online (Sandbox Code Playgroud)

然后得到下一个异常:

-[__NSCFString sizeWithTextStyle:]: unrecognized selector …
Run Code Online (Sandbox Code Playgroud)

core-plot ios7 xcode5

2
推荐指数
1
解决办法
2271
查看次数

Core Plot和Xcode 5.1 - 如何将Core Plot转换为ARC?

我刚刚安装了Xcode 5.1,发现它肯定需要项目使用ARC.我明白了

error: garbage collection is no longer supported
Run Code Online (Sandbox Code Playgroud)

在尝试编译Core Plot(版本1.4)时.出于好奇,我告诉Xcode将Core Plot转换为ARC.但它失败了

ARC forbids Objective-C objects in struct
Run Code Online (Sandbox Code Playgroud)

在文件中CPTPlatformSpecificFunctions.m.我不想潜入Core Plot并试图解决这个或类似的错误.是否有我忽略的编译器设置?或者是否会有很快使用ARC的Core Plot版本?谢谢,德克

core-plot automatic-ref-counting xcode5.1

2
推荐指数
1
解决办法
1985
查看次数