我在我的一个iPhone项目中使用核心情节.是否可以更改饼图中所选切片的颜色(使用CPPieChartDataSource,CPPieChartDelegate)?
我在iPhone应用程序中使用Core-Plot作为趋势图,但还没有找到如何自定义背景.我可以使用内置主题创建主题,如kCPPlainWhiteTheme,但我该如何更改它们?还是创建一个新的?
我基本上需要做的是使背景透明.
编辑/更新
我测试了这段代码,但它似乎不起作用:
//CPTheme *theme = [CPTheme themeNamed:kCPPlainWhiteTheme];
CPTheme *theme = [[CPTheme alloc]init];
chartTrend5 = (CPXYGraph *)[theme newGraph];
chartView.hostedGraph = chartTrend5;
chartTrend5.paddingLeft = 0.0;
chartTrend5.paddingTop = 0.0;
chartTrend5.paddingRight = 0.0;
chartTrend5.paddingBottom = 0.0;
chartTrend5.fill = nil;
chartTrend5.borderLineStyle = nil;
chartView.hostedGraph.fill = nil;
chartTrend5PlotSpace = (CPXYPlotSpace *)chartTrend5.defaultPlotSpace;
chartTrend5PlotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(0)
length:CPDecimalFromFloat(5)];
// range is 0-125, but since the frame heights is 90,
// we need to convert the points to this adjusted scale. The factor is 0.72 => (90/125) …Run Code Online (Sandbox Code Playgroud) 我正在使用这里的说明将Core Plot集成到我的iOS Xcode 5项目中,并且没有任何问题.
我尝试使用静态库安装,但似乎这是指1.4,因为没有目录调用,CorePlotHeaders但如果我尝试使用1.4我遇到运行时问题.
然后我尝试CorePlot-CocoaTouch.xcodeproj按照从属项目安装中的描述拖动它,但这只会复制它,就好像它是一个文件而不是整个项目.
是否有更多当前使用它作为静态库的说明或如何将项目错误地复制到我的项目中?
我在简单的条形图应用程序,使用Coreplot开发此应用程序,然后我尝试实现条形图,但我得到的问题发现在
[__NSCFConstantString sizeWithTextStyle:]: unrecognized selector sent to instance 0x7fb4c'
First throw call stack:
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?请帮我
提前致谢
我试过这个:
Viewcontroller.h
#import <UIKit/UIKit.h>
#import "CorePlot-CocoaTouch.h"
@interface GraphViewController : UIViewController <CPTPlotDataSource>
{
CPTXYGraph *barChart;
NSTimer *timer;
NSMutableArray *samples;
}
-(void) getGraphValues;
@end
Run Code Online (Sandbox Code Playgroud)
Viewcontroller.m
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor=[UIColor whiteColor];
self.title = @"Sample";
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
[self.navigationController setNavigationBarHidden:NO];
[self getGraphValues];
double xAxisLength = [samples count];
barChart = [[CPTXYGraph alloc] initWithFrame:CGRectMake(0, 0, 320, 380)];
barChart.plotAreaFrame.borderLineStyle = nil;
barChart.plotAreaFrame.cornerRadius = 0.0f;
barChart.paddingLeft = 0.0f;
barChart.paddingRight …Run Code Online (Sandbox Code Playgroud) 我正在使用CorePlot在我的macOS应用程序中绘制一个简单的线图.
CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:CGRectZero];
CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme];
[newGraph applyTheme:theme];
self.graph = newGraph;
self.hostView.hostedGraph = newGraph;
newGraph.plotAreaFrame.paddingTop = 10.0;
newGraph.plotAreaFrame.paddingBottom = 30.0;
newGraph.plotAreaFrame.paddingLeft = 40.0;
newGraph.plotAreaFrame.paddingRight = 10.0;
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)newGraph.defaultPlotSpace;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@(1.0) length:[NSNumber numberWithUnsignedInteger:[dataArray count]-1]];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@102.0];
plotSpace.allowsUserInteraction = YES;
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)newGraph.axisSet;
CPTXYAxis *x = axisSet.xAxis;
//x.majorIntervalLength = @1;
x.majorIntervalLength = [NSNumber numberWithInt:numberOfIntervalsX];
x.orthogonalPosition = @(0);
x.minorTicksPerInterval = 0;
x.labelOffset = 0;
CPTXYAxis *y = …Run Code Online (Sandbox Code Playgroud) 我正在使用核心情节在iPhone上编写股票图表应用程序.我应该使用什么样的图表来绘制体积图?由于我还需要将价格图表叠加到交易量表上,我该怎么做呢?
这是一个供参考的图片(我决不会尝试重新实现股票图表功能,只是想创建一个简单的图表,其中卷信息覆盖在价格图表上):
例如http://www.imagechicken.com/uploads/1264166887000577000.png
谢谢!
我想让我的用户在CPXYGraph中滚动.我有一个CPXYGraph作为CPHostingLayer的一部分,就像在教程中一样.我启用了allowUserInteraction,这很酷并且允许滚动.但我不想让我的用户滚动到'无限',它似乎允许 - 你可以继续拖动数据在绘图上的位置越来越远.
如何约束这个以便用户只能在某个范围内滚动?
我还启用了maskToBorder,并将outerBorderPath和innerBorderPath设置为一个非常小的东西,但我没有看到任何变化,所以我不确定它们应该如何工作.
我无法设置maskingPath和subLayerMaskingPath,因为它们似乎只是只读(没有设置器),尽管我觉得这两个属性可能就是我想要的.
有人遇到过这种情况吗?如果有人可以发光,会很高兴.谢谢!
所以我构建了一个从Xcode编译并运行良好的应用程序.现在我想将它分发给其他人,以便他们可以使用它.我该怎么做?
我认为它就像归档它一样简单,然后将其作为.pkg或应用程序共享.但每当我打开应用程序时,它都会崩溃,并显示以下消息:
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Symbol not found: _OBJC_CLASS_$_CPTBorderedLayer
Referenced from: /Users/USER/Desktop/StoreMon.app/Contents/MacOS/
StoreMon
Expected in: /Library/Frameworks/CorePlot.framework/Versions/A/
CorePlot
in /Users/USER/Desktop/StoreMon.app/Contents/MacOS/StoreMon
Run Code Online (Sandbox Code Playgroud)
我正在使用Core Plot框架.
本_CPTBorderedLayer类是框架的一部分.如何正确地将此框架打包到我的应用程序中?
我正在编写一个应用程序,其中我有两个y轴和一个x轴的图形.左侧y轴的范围从0到20所以有20个majorTick轴.右y轴的范围从0到10,所以我想要左y轴标记为每个替代majorTickAxis.
这是我的代码片段
//code
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace;
float xmax=10.0;
float xmin=0.0;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(xmin) length:CPTDecimalFromFloat(xmax-xmin)];
float ymax=20.0;
float ymin=0.0;
float ymax2=10.0;
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(ymin) length:CPTDecimalFromFloat(ymax-ymin)];
// Grid line styles
CPTMutableLineStyle *majorGridLineStyle = [CPTMutableLineStyle lineStyle];
majorGridLineStyle.lineWidth = 0.75;
majorGridLineStyle.lineColor = [[CPTColor whiteColor] colorWithAlphaComponent:0.75];
CPTMutableLineStyle *minorGridLineStyle = [CPTMutableLineStyle lineStyle];
minorGridLineStyle.lineWidth = 0.25;
minorGridLineStyle.lineColor = [[CPTColor whiteColor] colorWithAlphaComponent:0.1];
CPTMutableLineStyle *redLineStyle = [CPTMutableLineStyle lineStyle];
redLineStyle.lineWidth = 2.0;
redLineStyle.lineColor = [[CPTColor redColor] colorWithAlphaComponent:0.5];
CPTMutableLineStyle *greenLineStyle = [CPTMutableLineStyle lineStyle];
greenLineStyle.lineWidth = 2.0;
greenLineStyle.lineColor …Run Code Online (Sandbox Code Playgroud) 我有一个图表,在默认绘图空间上绘制了Y轴和X轴以及主绘图,然后我有辅助绘图的单独绘图空间,每个绘图空间都有自己的Y轴(所有绘图的X轴都相同) .
我正在实现按钮来打开和关闭辅助图,我希望这基本上包括整个绘图空间(绘图,自定义y轴和自定义y轴的标签).对于绘图空间似乎没有任何"隐藏"属性,并且绘图和轴都具有"隐藏"属性,将这些设置为"是"会使轴标签可见.
我猜一种方法可能是从图中完全删除绘图空间和绘图,但这感觉不直观.