如何在 OxyPlot 中获得所有颜色? [英] How I can get all colors in OxyPlot?

查看:34
本文介绍了如何在 OxyPlot 中获得所有颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题.我在 WPF、C# 中使用 OxyPlot.我需要将所有颜色设置为 MarkerType 和 MarkerStroke 系列.我如何获得所有颜色?

I have a one question. I use OxyPlot in WPF, C#. I need to have all colors to MarkerType and MarkerStroke for series. How I can get all colors?

推荐答案

Green、IndianRed 等是静态 OxyColors 类中的静态字段.使用 阅读所有问题

Green, IndianRed, etc are static fields in static OxyColors class. use reflection to read all of them

var colors = typeof(OxyColors)
             .GetFields(BindingFlags.Static | BindingFlags.Public)
             .Where(f => f.FieldType == typeof(OxyColor))
             .Select(f => f.GetValue(null))
             .Cast<OxyColor>()
             .ToList();

这篇关于如何在 OxyPlot 中获得所有颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆