Skip to content

SVG: XML contains duplicated content #4436

@sunefred

Description

@sunefred

Issue:

I am using ScottPlot to render plots in PDFs using QuestPdf. I was confused why the render time in QuestPdf was so much higher than expected - until I noticed that the SVG produced by GetSvgXml and GetSvgHtml is duplicated fives times! That is, it contains the initial svg element and then the content is repeated five times

<?xml version="1.0" encoding="utf-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="300">
    <rect fill="white" width="400" height="300"/>
    ...
    <rect fill="white" width="400" height="300"/>
    ...
    <rect fill="white" width="400" height="300"/>
    ...
    <rect fill="white" width="400" height="300"/>
    ...
    <rect fill="white" width="400" height="300"/>
    ...
</svg>

ScottPlot Version:

5.0.43

Code Sample:

using ScottPlot;

var plt = new Plot();
var svgString = plt.GetSvgXml(400, 300);

Console.WriteLine(svgString);

The repeated content overlays each other perfectly, so it is not visually noticeable. You have to inspect the SVG output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help WantedScott won't do this soon, but PRs from the community are welcome!⚠️ HIGH PRIORITY

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions