ios - 如何在 Core Plot CPT ScatterPlot 中绘制不同的线条颜色
<p><p> <a href="/image/7wo8l.png" rel="noreferrer noopener nofollow"><img src="/image/7wo8l.png" alt="enter image description here"/></a> </p>
<p>目前,我可以使用 CPTScatterPlot 绘制这样的趋势图。<br/>
30个点和红线相互连接。</p>
<p>但我想在每个点之间使用不同的线条颜色。</p>
<p>这是我正在尝试的代码</p>
<pre><code> CPTXYGraph *graph = [ initWithFrame:self.frame];
self.hostedGraph = graph;
CPTScatterPlot *scatterPlot = [ initWithFrame:graph.bounds];
scatterPlot.dataSource = self;
;
CPTMutableLineStyle *lineStyle = ;
lineStyle.lineWidth = 1.0f;
lineStyle.lineColor = ;
scatterPlot.dataLineStyle = lineStyle;
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *) scatterPlot.plotSpace;
plotSpace.xRange = ;
plotSpace.yRange = - )];
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
CPTXYAxis *x = axisSet.xAxis;
CPTXYAxis *y = axisSet.yAxis;
x.orthogonalPosition = z;
x.labelingPolicy = CPTAxisLabelingPolicyNone;
y.orthogonalPosition = @0;
y.labelingPolicy = CPTAxisLabelingPolicyNone;
CPTMutableLineStyle *symbolLineStyle = ;
symbolLineStyle.lineColor = ;
symbolLineStyle.lineWidth = 1.0;
CPTPlotSymbol *plotSymbol = ;
plotSymbol.fill = ];
plotSymbol.lineStyle = symbolLineStyle;
plotSymbol.size = CGSizeMake(5.0, 5.0);
scatterPlot.plotSymbol = plotSymbol;
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您必须为此使用多个散点图。为每种不同的颜色使用一个。</p></p>
<p style="font-size: 20px;">关于ios - 如何在 Core Plot CPT ScatterPlot 中绘制不同的线条颜色,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/36171384/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/36171384/
</a>
</p>
页:
[1]