Multi color Marker for same LineSeries - OxyPlot
Asked Answered
D

1

7

Is it possible to have a different marker style for ranges among (XY-Axis) values ? For example. The marker style is shown in steel blue color here, Can I have markers above 15 and below 13 to show another color ?

Display:

enter image description here

Donica answered 23/7, 2015 at 23:53 Comment(1)
With a TwoColorLineSeries should be possible to have 2 zones. If what you need are 3 zones ( x<13; 13<x<15; 15<x ) maybe you should check ScatterSeries...Troutman
S
3

Oxyplot has both a TwoColorLineSeries and a ThreeColorLineSeries

Here is an example with the 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

Speller answered 3/12, 2019 at 13:24 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.