Skip to content

OxyPlot.ImageSharp not applying font width #2006

@IzStriker

Description

@IzStriker

Steps to reproduce

  1. Create a dotnet console app
  2. Copy the following code into the Program.cs.
using OxyPlot;
using OxyPlot.Series;
using OxyPlot.ImageSharp;

PlotModel normalModel = new PlotModel
{
    TitleFontWeight = FontWeights.Normal,
    Background = OxyColors.White,
    Series = {
        new PieSeries
        {
            InsideLabelFormat = "{1}",
            OutsideLabelFormat = "{1} {2:0}%",
            FontWeight = FontWeights.Normal,
            Slices =
            {
                new PieSlice("A", 10),
                new PieSlice("B", 20),
                new PieSlice("C", 30),
                new PieSlice("D", 40),
            }
        },
    },
};

PlotModel boldModel = new PlotModel
{
    TitleFontWeight = FontWeights.Bold,
    Background = OxyColors.White,
    Series = {
        new PieSeries
        {
            InsideLabelFormat = "{1}",
            OutsideLabelFormat = "{1} {2:0}%",
            FontWeight = FontWeights.Bold,
            Slices =
            {
                new PieSlice("A", 10),
                new PieSlice("B", 20),
                new PieSlice("C", 30),
                new PieSlice("D", 40),
            }
        },
    }
};


PngExporter.Export(normalModel, "normal.png", 600, 400);
PngExporter.Export(boldModel, "bold.png", 600, 400);
  1. View the two outputted images.

Platform:
.NET version:
6.0.201

Expected behaviour

The inner and outer labels of the pie chart inside "bold.png" should have thicker text than the inner and outer labels for the pie chart inside "normal.png".

Actual behaviour

The font-weight appears not to be applied to the labels of the pie chart inside bold.png.

Normal.png:
image

Bold.png:
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions