同一LineSeries的多色标记 - OxyPlot

时间:2015-07-23 23:53:26

标签: c# oxyplot

是否可以为(XY轴)值中的范围设置不同的标记样式?例如。标记样式在这里以钢蓝色显示,我可以在15以上和13以下标记显示另一种颜色吗?

显示:

enter image description here

1 个答案:

答案 0 :(得分:1)

Oxyplot同时具有TwoColorLineSeriesThreeColorLineSeries

以下是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