Recent

Author Topic: SVG export flawed for line series.  (Read 3818 times)

jwdietrich

  • Hero Member
  • *****
  • Posts: 1271
    • formatio reticularis
SVG export flawed for line series.
« on: March 03, 2013, 06:59:52 pm »
SVG versions of line series charts are faulty when created by the SVG drawer. They don't match the screen representation and in concrete, they are in black and white only and contain undesired filled regions.

See the attached demo file for reference.
« Last Edit: March 03, 2013, 07:02:16 pm by jwdietrich »
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 4.2.0 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

jwdietrich

  • Hero Member
  • *****
  • Posts: 1271
    • formatio reticularis
Re: SVG export flawed for line series.
« Reply #1 on: March 03, 2013, 07:05:04 pm »
I have reported this bug at http://bugs.freepascal.org/view.php?id=23982. This report also contains a screenshot that the SVG version should resemble and a demo application.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 4.2.0 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

wp

  • Hero Member
  • *****
  • Posts: 13352
Re: SVG export flawed for line series.
« Reply #2 on: March 04, 2013, 05:11:15 pm »
I could fix the issue in your demo in the following way:
  • In TADrawerSVG, procedure TSVGDrawer.PolyLine, replace the string mask of the WriteFmt method by '<polyline points="%s" style="fill:none; %s"/>'. The "fill:none" avoids closing the polygon, and the formerly present "stroke" results in an improper statement because the "stroke" is additionally added by the StyleStroke method.
  • In TASeries, procedure TLineSeries.DrawSingleLineInStack, subprocedure DrawLines, replace "ADrawer.Pen := LinePen" by "ADrawer.SetParams(LinePen.Style, LinePen.Color)".This modification passes the line color to the drawer correctly.
See also your BugTracker report for a patch.

Unfortunately, Ask seems to be quite busy these days, but I am sure that this patch will soon be added to the official version.
« Last Edit: March 04, 2013, 05:25:01 pm by wp »

jwdietrich

  • Hero Member
  • *****
  • Posts: 1271
    • formatio reticularis
Re: SVG export flawed for line series.
« Reply #3 on: March 05, 2013, 02:36:39 am »
Thank you for providing this interesting information. It will help to fix an old bug in one of my applications.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 4.2.0 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

jwdietrich

  • Hero Member
  • *****
  • Posts: 1271
    • formatio reticularis
Re: SVG export flawed for line series.
« Reply #4 on: June 18, 2014, 08:33:03 pm »
Thanks for fixing this issue. :)
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 4.2.0 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

 

TinyPortal © 2005-2018