TeeChart 7.11 SVG generation doesn't handle special XML characters in labels correctly. These characters are &, <, >, " and '. These characters has special meaning in XML and break the validity of outputted XML as they are not properly encoded.
Entity codings should be used to replace these special characters.
There also appears to be inconsistency in background gradient handling - the direction is turned to opposite in SVG view.
Bug in SVG generation
Hi ToniK,
Yes, those are two bugs in our wish-list. I cannot think in a workaround for the gradient bug, but for special characters you can check the text before it's written to svg stream and replace literal chars like <, > %, &,... with their ascii char code.
You can use a method like the following:
Yes, those are two bugs in our wish-list. I cannot think in a workaround for the gradient bug, but for special characters you can check the text before it's written to svg stream and replace literal chars like <, > %, &,... with their ascii char code.
You can use a method like the following:
Code: Select all
Function TForm1.VerifySpecial(S:String):String;
const NOTAllowedSVGChars=['!'..'/',':'..'@','['..'`','{'..'~'];
var t : Integer;
begin
result:='';
for t:=1 to Length(S) do
if {$IFDEF CLR}AnsiChar{$ENDIF}(S[t]) in NOTAllowedSVGChars then
result:=result+'&#'+IntToStr(Ord(S[t]))+';'
else
result:=result+S[t]
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Is there any timeframe for a proper fix to the 7.x version?Yes, those are two bugs in our wish-list.
These and number of other issues in the SVG generation make it all but useless.
The workaround is good as such, but does not work well enough as most of the characters in question should be encoded with appropriate character entities and not as codes.
Hi ToniK,
I'm afraid I can't tell you when it will be fixed for now. Please be aware at this forum for new releases announcements and what's being implemented/fixed on each release.
Also note that since I'm working with v8 beta, I'm not sure if you need to include the same characters than me in your NOTAllowedSVGChars list to be encoded, and thats why I've included "all the strange characters" in the sample. I suggest you to modify it as you need.
I'm afraid I can't tell you when it will be fixed for now. Please be aware at this forum for new releases announcements and what's being implemented/fixed on each release.
Also note that since I'm working with v8 beta, I'm not sure if you need to include the same characters than me in your NOTAllowedSVGChars list to be encoded, and thats why I've included "all the strange characters" in the sample. I suggest you to modify it as you need.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
We fixed the XML generation by editing TeeChart source code in TeeSVGCanvas unit. We changed VerifySpecial function to take care of those XML special characters. Below is our implementation:
and AllowedSVGChars definition was slightly changed too:
Gradient problem we fixed by changing gradient tag generation in GradientTrasform-function to following:
Code above probably don't take account all possible gradient directions but is sufficient for our needs.
Please, could you review these modifications? It would be great if you could include these in coming(?) TeeChart 7 releases. We also have couple of other issues with TeeChart but I'll report them in some other thread.
Code: Select all
for t := 1 to Length(S) do
if {$IFDEF CLR}AnsiChar{$ENDIF}(S[t]) in AllowedSVGChars then
result := result + S[t]
else
case {$IFDEF CLR}AnsiChar{$ENDIF}(S[t]) of
'&' : result := result + '&';
'<' : result := result + '<';
'>' : result := result + '>';
'"' : result := result + '"';
'''' : result := result + ''';
else
result := result + '&#' + IntToStr(Ord(S[t])) + ';';
end;
Code: Select all
AllowedSVGChars = ['!'..'z'] - ['&', '<', '>', '"', ''''];
Code: Select all
Case Direction of
gdTopBottom : result:=' x1="0%" y1="100%" x2="0%" y2="0%" ';
gdBottomTop : result:=' x1="0%" y1="0%" x2="0%" y2="100%" ';
gdLeftRight : result:=' x1="0%" y1="0%" x2="100%" y2="0%" ';
gdRightLeft : result:=' x1="100%" y1="0%" x2="0%" y2="0%" ';
end;
Please, could you review these modifications? It would be great if you could include these in coming(?) TeeChart 7 releases. We also have couple of other issues with TeeChart but I'll report them in some other thread.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Tonik,
Thank you very much for your suggestions. They seem fine to us (although < is still interpreted as &) and we will try to include them TeeChart v8, which is the version we are currently working in.
Ideally, the following map could be used (for all non digit or letter chars):
http://tlt.its.psu.edu/suggestions/inte ... ehtml.html
Thank you very much for your suggestions. They seem fine to us (although < is still interpreted as &) and we will try to include them TeeChart v8, which is the version we are currently working in.
Ideally, the following map could be used (for all non digit or letter chars):
http://tlt.its.psu.edu/suggestions/inte ... ehtml.html
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Actually, you cannot use those entity names in XML (like SVG but not HTML) since they are not defined by default. Only mentioned five are built-in XML. See Wikipedia article about HTML and XML entity names:Ideally, the following map could be used (for all non digit or letter chars):
http://tlt.its.psu.edu/suggestions/inte ... ehtml.html
http://en.wikipedia.org/wiki/List_of_XM ... references
We also noticed that labels are always horizontal in SVG. Rotation angle is discarded completely in SVG generation. Generally rotated labels are mislocated in TChart, if angle is not multiple of 45 degrees. Are you planning any fixes to these problems in TeeChart 8?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Tonik,
Thanks for the information. We will try to implement char support for 6 xml defined entities.
Thanks for the information. We will try to implement char support for 6 xml defined entities.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |