Search code examples
c#wpfxamloxyplot

Change axis textcolor in OxyPlot for WPF


I like OxyPlot solution but I have one problem here.
Does anybody know how to change axis text color in WPF? In OxyPlot.dll there is Axis.TextColor property but this property is not present in OxyPlot.Wpf.dll. I don't know why. Is there some way, how I can achieve this?

Image from OxyPlots example browser

EDIT:
I tried to change every axis color property I was able to find (TicklineColor, MajorGridlineColor, MinorGridlineColor, ExtraGridlineColor, AxislineColor, TitleColor) without any luck.

EDIT2:
As @Jamleck wants I added XAML.

<Color x:Key="MyColor">#ffffff</Color>
<Style x:Key="ResultPlotStyle" TargetType="oxy:PlotView">
    <Setter Property="Margin" Value="10" />
    <Setter Property="Background" Value="#1f1f1f" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="BorderBrush" Value="Transparent" />
    <Setter Property="PlotAreaBorderColor" Value="{StaticResource MyColor}" />
    <Setter Property="PlotAreaBorderThickness" Value="1 1 1 1" />
    <Setter Property="TextColor" Value="{StaticResource MyColor}" />
</Style>

<Style x:Key="ResultAxisStyle" TargetType="oxy:LinearAxis">
    <Setter Property="TicklineColor" Value="{StaticResource MyColor}" />
    <Setter Property="MajorGridlineColor" Value="{StaticResource MyColor}" />
    <Setter Property="MinorGridlineColor" Value="{StaticResource MyColor}" />
    <Setter Property="ExtraGridlineColor" Value="{StaticResource MyColor}" />
    <Setter Property="AxislineColor" Value="{StaticResource MyColor}" />
    <Setter Property="TitleColor" Value="{StaticResource MyColor}" />
    <Setter Property="TextColor" Value="{StaticResource MyColor}" />
    <Setter Property="TickStyle" Value="None" />
</Style>

<Style x:Key="ResultLeftAxisStyle" TargetType="oxy:LinearAxis" BasedOn="{StaticResource ResultAxisStyle}">
    <Setter Property="PositionAtZeroCrossing" Value="True" />
</Style>

<Style x:Key="ResultBottomAxisStyle" TargetType="oxy:LinearAxis" BasedOn="{StaticResource ResultAxisStyle}">
    <Setter Property="TickStyle" Value="Crossing" />
</Style>

Solution

  • So in this time this property is just not implemeted in WPF version of OxyPlot yet. It clarifies why I was not able to edit this setting. As objo from developers team answered to my question, it is covered in this issue item.
    So if I want this functionality in these days already I have to implement it to OxyPlot by myself.