ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  SVG corners
Posted by CLaudio Weber Abramo on Feb-18-2013 03:46
Attachments:
Dear Paul:

I've noticed that ChartDirector (PHP, version 5.0) SVG output produces a (very slight) imperfection when it comes to non-90 degrees line corners.

Namely, since the lines actually intersect in the corner, and since the line endings are square, the effect is a two-pronged "spike", rather than a clean corner.

The first attached PNG corresponds to a (highly enlarged) such corner. (The effect becomes more noticeable if an alpha value is used on the line colours -- the second PNG.)

Since the lines (and everything else) in SVG are vectors, perhaps ChartDirector could change the line endings from square to rounded by default.

(With rasterised outputs, pixel rendering by the browser take care of the problem, or so I imagine.)

Regards
SVGcorner.PNG
SVGcorner_with_transparency.PNG

  Re: SVG corners
Posted by Peter Kwan on Feb-19-2013 02:25
Hi Claudio,

The issue occurs because the two lines are drawn as two separate lines. Using round line caps can avoid the "spike", but still there is "double-drawing" of the intersection, which is visible if semi-transparent colors are used.

The ideal way to handle this is to draw the two lines as a "polyline". In this way, the SVG engine should join the line segments properly without double-drawing.

If I remembered correctly, ChartDirector should handle lines in line charts as polylines, as the "spikes" should not occur. However, because of the limitations of SVG, currently not all lines can be are handled as polylines. For example, SVG only supports polylines in which the entire polyline is of the same color and style. So if two line segments can be of different colors, ChartDirector can only draw them as two separate lines. SVG also cannot support line joinings in 3D. For example, in a 3D rectangle, the corner of a rectangle has 3 line segments meeting at a point, and there is no good way to handle this in SVG. (SVG is basically designed for 2D graphics.)

The line joining issue usually is visible only if the line segments are very thick (which hopefully is not common in real usage). Using round line caps in all line segments may avoid the joining problem in many cases, but we have yet to test them as they have other unexpected issues.

Regards
Peter Kwan

  Re: SVG corners
Posted by Claudio Weber Abramo on Feb-19-2013 03:06
Hi, Peter:

In fact, I've noticed the "spike" in rather small polar graphs grids with widths of 1 that, by mistake, were coloured with an alpha value.

From what you say, I gather that grids are not drawn as polylines (excepting perhaps when GridStyle is set to "false", ie, they are circles).

Well, thanks anyway.