New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When export svg, the background of part of legends is black #1470
Comments
i found reason in svg plain text, there is a tag <clipPath id="cl_d">
<rect width="800" height="400" />
</clipPath> and there also have tag <g clip-path="url(#cl_d)" fill="none">
<path d="M649.764 270.225L649.764 129.77 ....."
</g> all you need is to find what |
here is my script for fix this bug, and it need thrid lib call var path = @"CartesianStraight.svg";
SvgDocument svgDocument = SvgDocument.Open(path);
var svgSizeElement = svgDocument.Children.First() as SvgRectangle;
var width = svgSizeElement.Width.Value;
var height = svgSizeElement.Height.Value;
var svgID = "";
foreach (var element in svgDocument.Children)
{
if (element is SvgClipPath clip_path)
{
if (clip_path.Children.First() is SvgRectangle rect && svgID=="")
{
if (rect.Width.Value == width && rect.Height.Value == height)
{
svgID = clip_path.ID;
}
}
}
if (element is SvgGroup g)
{
var str = g.ClipPath.ToString();
if (str.Contains(svgID))
{
g.Fill = new SvgColourServer(System.Drawing.Color.Transparent);
}
}
}
svgDocument.Write(@"1234Cartesian.svg"); |
Hello @dumbnessrf could you provide what's behind it could help me with my issue: https://github.com/beto-rodriguez/LiveCharts2/issues/1469 Thanks |
actually, it just some kind of plain data, the data type is Series = new LineSeries<int>[] { };
var temp = new List<LineSeries<int>>();
foreach (var d in PeriodTrendParams)
{
temp.Add(new LineSeries<int>
{
Values = new ObservableCollection<int>(d.PeriodParams.Select(d => d.LogsCount)),
Fill = new SolidColorPaint(GetColorByLevel(d.Level)), // mark
Name = d.Level.ToString(),
Stroke = null,
GeometryFill = null,
GeometryStroke = null
});
}
Series = temp.ToArray(); |
Hi @dumbnessrf thanks very much for your fast reply. So in this case what I don't get is what's exactly inside or do you just write zeros into the collection before 40minutes? |
just write zeros into that collection |
worked fine with zeros. Meanwhile my issue was also answered, it works also with x and y: https://livecharts.dev/docs/maui/2.0.0-rc2/samples.lines.xy#specify-both-x-and-y |
when i try to convert chart to svg file, i met some issues that my legends part become black, but it render well in the UI
in the ui
thanks if any (๑→ܫ←)
The text was updated successfully, but these errors were encountered: