OGeek|极客世界-中国程序员成长平台

标题: ios - Xamarin.iOS,OxyPlot 如何将 UIColor 转换为 OxyColor [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 11:53
标题: ios - Xamarin.iOS,OxyPlot 如何将 UIColor 转换为 OxyColor

我正在使用 OxyPlot 在 xamarin.ios 项目中绘制条形图。我必须更改条形图的条形颜色,它似乎只需要 OxyColor,而且我正在从后端获取#code。

series.Items.Add(new ColumnItem() { Value = Double.Parse(graph.valueList[i]), Color = OxyColors.Green });

如何将十六进制代码更改为 OxyColor。甚至 UIColor 到 OxyColor?



Best Answer-推荐答案


OxyColor有一个Parse方法,字符串格式为“#FFFFFF00”或“255,200,180,50”

即:

OxyColor.Parse("#FFFF0000")
OxyColor.Parse("#FF0000")
OxyColor.Parse("255,0,0")
OxyColor.Parse("255,255,0,0")

引用:https://github.com/oxyplot/oxyplot/blob/4db3c45a2acc86b7b11816462cb4f2850c709a11/Source/OxyPlot/Rendering/OxyColor.cs

关于ios - Xamarin.iOS,OxyPlot 如何将 UIColor 转换为 OxyColor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38950470/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4