oxyplot / oxyplot

A cross-platform plotting library for .NET
https://oxyplot.github.io/
MIT License
3.3k stars 963 forks source link

Superscript / subscript format is not support for text assignment in Annotations #1570

Open sushi19921992 opened 4 years ago

sushi19921992 commented 4 years ago

Oxyplot.Wpf v1.0.0

Trying to add a subscript to my custom text annotation in the following format:

 newModel.Annotations.Add(new CustomTextAnnotation()
        {
            Text = "H_{2}O\r\nC₁",
            X = 110,
            Y = 10,
            Font = fontUsed.Source,
            FontSize = 12,
            TextColor = areaAndTextColour
        });

However, sadly it doesn't seem like OxyPlot supports "TeX" type subscripting in this way - can this be added/made as an improvement?

sushi19921992 commented 4 years ago

I've found a way of changing the CustomTextAnnotation class to do "DrawMathText" instead of "DrawMultilineText", however, I haven't got multiple lines of Math text working. Does someone know if this is possible?

Jonarw commented 4 years ago

As far as I'm aware there is no built-in way to do this. You could override the Render(...) method on your CustomTextAnnotation and call DrawMathText(...) for each line you would like to render.