gpt4 book ai didi

ios - CorePlot 轴上的水平梯度

转载 作者:行者123 更新时间:2023-11-29 03:07:13 24 4
gpt4 key购买 nike

我正在尝试在 CorePlot 中的 y 轴上创建水平渐变:

CPTGradient *axisGradient = [CPTGradient gradientWithBeginningColor:[CPTColor redColor] endingColor:[CPTColor yellowColor]];
axisGradient.angle = 180.f;

CPTMutableLineStyle *axisStyle = [y.axisLineStyle mutableCopy];
axisStyle.lineWidth = 6.f;
axisStyle.lineGradient = axisGradient;

y.axisLineStyle = axisStyle;

无论我设置什么渐变角度,渐变都是垂直的。有人有什么想法吗?

最佳答案

对于水平渐变你可以使用

CPTColor *areaColorStart       = [CPTColor colorWithComponentRed:0.74 green:0.78 blue:0.82 alpha:1];
CPTColor *areaColorEnd = [CPTColor colorWithComponentRed:0.9 green:0.91 blue:0.92 alpha:.2];
CPTGradient *areaGradient1 = [CPTGradient gradientWithBeginningColor:areaColorStart endingColor:areaColorEnd];
areaGradient1.angle = 0.0f;
CPTFill *areaGradientFill = [CPTFill fillWithGradient:areaGradient1];
plot.areaFill = areaGradientFill;
plot.areaBaseValue = CPTDecimalFromFloat(yRange);

希望对您有所帮助。

关于ios - CorePlot 轴上的水平梯度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22624838/

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