How do I set the DefaultFont for a custom font in OxyPlot?

I am using OxyPlot in WPF application for simple plotting LineSeries

. I also defined Roboto as the default font for my application. However mine PlotView

does not use this font, but uses its default Segoe UI font.

PlotModel

offers a property DefaultFont

to change this font. This property does not accept FontFamily

, only a string. So if I try to change the font by typing in the name FontFamily

that is installed on my system, it works:

var model = new PlotModel
{
     DefaultFont = "Verdana"
};

      

If I try to do the same with Roboto, it doesn't:

var model = new PlotModel
{
     DefaultFont = "./Resources/Roboto/#Roboto"
};

      

or

var model = new PlotModel
{
     DefaultFont = "/MyNamespace;component/Resources/Roboto/#Roboto"
};

      

What am I missing here? Is there any other way to do this?

Note: This is my first question, please tell me what I can improve in the future.

+3


source to share





All Articles