Search code examples
c#wpfoxyplot

Oxyplot - hide intermediate axes values


enter image description here

enter image description here

Hi All, I am using oxyplot for my WPF application, I wish to show a graph like this. is there a way I can hide the values on the axes like 50/100/150. I also need final values like 255, but what I see from the usage, the Oxyplot ends up showing me 250 instead of 255 and 200 instead of 255 due to space constraint.

Is there a way I can achieve the desired result in pic1.

I am following the source code from this location.

https://oxyplot.readthedocs.io/en/master/getting-started/hello-wpf-xaml.html


Solution

  • You can set MajorStep of LinearAxis to 255.

    Example:

    <oxy:Plot Title="{Binding Title}">
        <oxy:Plot.Axes>
            <oxy:LinearAxis Position="Left" 
                 MajorGridlineStyle="None" MinorGridlineStyle="None" 
                 MajorStep="255" TickStyle="None" Minimum="0" Maximum="255" />
            <oxy:LinearAxis Position="Bottom" 
                 MajorGridlineStyle="None" MinorGridlineStyle="None" 
                 MajorStep="255" TickStyle="None" Minimum="0" Maximum="255" />
        </oxy:Plot.Axes>
        <oxy:Plot.Series>
            <oxy:LineSeries ItemsSource="{Binding Points}"/>
        </oxy:Plot.Series>
    </oxy:Plot>
    

    Result:

    enter image description here