gpt4 book ai didi

ios - 在 iOS 的 CorePlot 图表上画一条虚线

转载 作者:行者123 更新时间:2023-11-28 20:00:25 29 4
gpt4 key购买 nike

如何使用 core plot plot 在图形上绘制虚线,该线用于轴的最大和最小范围。

在AndroidPlot中,ValueMarker用于在图形上绘制最大和最小水平线。

请帮我解决这个问题。

谢谢

最佳答案

这就是我在这种情况下使用的:

@property (nonatomic, retain) CPTScatterPlot *myLine;
@property (nonatomic, retain) CPTGraph *graph;

-(void) configureHorizontalLine
{
// 1 - Create plot space
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *) self.graph.defaultPlotSpace;

// 2 - Create the plot
self.myLine = [[CPTScatterPlot alloc] init];
self.myLine.dataSource = self;
self.myLine.identifier = @"myLine";

CPTColor *myPlotColor = [CPTColor redColor];
[self.graph addPlot:self.myLine toPlotSpace:plotSpace];

// 3 - Create styles
CPTMutableLineStyle *myPlotLineStyle = [self.myLine.dataLineStyle mutableCopy];

myPlotLineStyle.dashPattern=[NSArray arrayWithObjects:[NSDecimalNumber numberWithInt:3],[NSDecimalNumber numberWithInt:3],nil]; //dashed line

myPlotLineStyle.lineWidth = 1;
myPlotLineStyle.lineColor = myPlotColor;
self.myLine.dataLineStyle = myPlotLineStyle;
}

此外,在 CPTPlotDataSource 方法中,您必须执行以下检查以识别线图:

if ([[plot identifier] isEqual:@"myLine"])

关于ios - 在 iOS 的 CorePlot 图表上画一条虚线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24404776/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com