c# - 相同 LineSeries 的多色标记 - OxyPlot

标签 c# oxyplot

是否可以为(XY 轴)值之间的范围使用不同的标记样式?例如。标记样式在这里显示为钢蓝色,我可以让标记高于 15 和低于 13 以显示另一种颜色吗?

显示:

enter image description here

最佳答案

Oxyplot 有一个TwoColorLineSeries 和一个ThreeColorLineSeries

这是一个使用 ThreeColorLineSeries

的例子
public class MainViewModel
{
    public MainViewModel()
    {
        Model = new PlotModel
        {
            Title = "Colouring example"
        };

        var series = new ThreeColorLineSeries();

        // Random data
        var rand = new Random();
        var x = 0;
        while (x < 50)
        {
            series.Points.Add(new DataPoint(x, rand.Next(0, 20)));
            x+=1;
        }

        // Colour limits
        series.LimitHi = 14;
        series.LimitLo = 7;

        // Colours
        series.Color = OxyColor.FromRgb(255,0,0);
        series.ColorHi = OxyColor.FromRgb(0,255,0);
        series.ColorLo = OxyColor.FromRgb(0,0,255);

        Model.Series.Add(series);
    }


    public PlotModel Model { get; set; }
}

ThreeColorLineSeries example with random data

关于c# - 相同 LineSeries 的多色标记 - OxyPlot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31600012/

相关文章:

c# - 使用局部 View 的 MVC 4 验证

c# - UAC 和 WinForms

c# - 更改 Oxyplot 轴线颜色

c# - RecyclerView 中的 OxyPlot -MVVMCross Xamarin.Android

c# - 如何防止氧图在一个轴上缩放?

c# - 添加 OxyPlot PointAnnotation

c# - 如何在 C# 中使用 EmailAddressAttribute 验证字符串列表?

c# - 根据属性名称数组创建对象的子集

c# - 设置最大内存使用 C#

c# - 如何增加 Oxyplot 中轴的绘图区域?