OxyPlot - removing the values of a LinearAxis and leaving only the title

3.3k Views Asked by At

I have multiple LinearAxis elements with different start and ending positions and min/max values. How do I hide the value numbers of those axes (for example, 0, 100, 200, etc) while keeping the titles (for example: Day 1, Day 2, etc)

For example, I'd like the numbers 0, 100 and 200 hidden enter image description here

2

There are 2 best solutions below

0
On

If XAML use this

<oxy:Plot.Axes>
    <oxy:LinearAxis Position="Left" TextColor = OxyColors.Transparent/>
</oxy:Plot.Axes>

If code

// Create a plot model
PlotModel = new PlotModel { Title = "Updating by task running on the UI thread" };
// Add the axes, note that MinimumPadding and AbsoluteMinimum should be set on the value axis.
PlotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, TextColor = OxyColors.Transparent});
0
On

If the labels 0, 100, 200 belong to one axis and the texts "Day One", ... to the other one you can set the colors of the labels of the first axis to transparent like this

axis.TextColor = OxyColors.Transparent;

Hope this helps.