Bar chart x-axis labels overlapping
Steps to reproduce
- Bar chart with four legends
- Each bar has a label on the x-axis. The label has a \r\n to divide it into two lines
- Legends are located below the labels (BottomCenter)
- If the legend names are too long they are rendered into two lines
- This causes the x-axix labels undir each bar to overlap it's content e.g. if a x-axis label is "Testing \r\n Hello World" the label is rendered in two lines. However the "Hello World" part would overlap "Testing" in the first line.
Platform: Windows 10 .NET version: .NET 4.7.2
Expected behaviour
The x-axis two lines label should not overlap when the below legends are rendered in two lines.
Actual behaviour
The x-axis two lines label overlap when the below legends are rendered in two lines.

Is this WPF/Winforms or one of the exporters?
This looks like the sort of problems we get with the default SVG exporter (the solution generally to use a platform specific SVG Exporter e.g. OxyPlot.WindowsForms.SvgExporter).
Hi @VisualMelon we are using the SvgExporter to export to pdf.
Which SVG exporter specifically? If you are using OxyPlot.SvgExporter at the moment, can you use e.g. OxyPlot.WindowsForms.SvgExporter as indicated above? (it has better support for test measurement). If that doesn't help, then I'll take a closer look over the weekend when I have more time.
Thanks for your help. Yes, we are using OxyPlot.SvgExporter inside a .NET Web API and the logic is inside a netstandard2 library. So we can't use OxyPlot.WindowsForms.SvgExporter The client side application is an angular app.
OK, there probably won't be an easy solution then; the built-in SVG and PDF exporters doesn't have good font support, and we aren't really intending to work on them.
If you need this in a netstandard 2.0 library, then you could use the OxyPlot.SkiaSharp provision in the pre-release (which has a native though slightly less feature-complete (in terms of what OxyPlot needs) SVG exporter. Alternatively, it should be possible to use the ImageSharp provision for text measuring (I have some code lying around for this, but I can't remember how if it works).
It's been a long time since I buried my head in this stuff, if you are happy to bodge it slightly, you could override the built-in PdfRenderContext (which is the text-renderer used by OxyPlot.SvgExporter and inflate the text measurements somewhat.
(I'm happy to help with any of these options, time permitting)
Thanks for the information, we will probably just shorten the text to make it fit.
@doorman02 does throwing in an extra pair of \r\n help? (or is that excessive?)
@VisualMelon thanks that worked 👍
I will leave the bug open in case any work is needed.