|
SVG MultiChart cross-browser issue? |
Posted by Claudio Weber Abramo on Aug-03-2013 06:55 |
|
Dear Peter:
Attached you'll find a bit of test code that creates a MultiChart with two charts added to it. The output is in SVG.
The graphs include DataSymbols.
The graph renders as expected in Firefox 22.0 for Windows. However, in IExplorer 10 and in Gecko browsers (Safari 5.1 and Chrome 28.0) a stray DataSymbol shows up.
In IExplorer the rogue symbol appears next to the y axis.
In the Gecko browsers the result of the intrusion is quite spectacular.
Is there something I am missing here?
Thank you.
|
Re: SVG MultiChart cross-browser issue? |
Posted by Peter Kwan on Aug-06-2013 00:50 |
|
Hi Claudio,
I have tried your script myself. It does not produce any issue in my case. I have attached a screen from my Chrome browser for your reference.
Please make sure you are using the latest version of ChartDirector (5.1.1).
If the above still cannot solve the problem, is it possible to save the SVG output of ChartDirector to a file, and also provide a screen shot of what you see? I will try to use your exact SVG output and compare to the SVG output in my case to see if there is any difference.
Regards
Peter Kwan
|
Re: SVG MultiChart cross-browser issue? |
Posted by Claudio Weber Abramo on Aug-06-2013 02:20 |
|
Dear Peter:
We were using version 5.0.3. Just upgraded to 5.1.
Same results. Please see the attached images. The first is IE10 and the second the result in Gecko browsers.
Thanks for your time.
|
Re: SVG MultiChart cross-browser issue? |
Posted by Claudio Weber Abramo on Aug-06-2013 02:38 |
|
Oops, sorry for having referred to Gecko browsers in previous messages. I meant Webkit.
In Gecko browsers the problem doesn't appear.
In any case, I've just ascertained that the reported behaviour manifests itself in a Windows 7 platform, but not in a Windows Vista machine. I didn't test in Macintoshes. |
Re: SVG MultiChart cross-browser issue? |
Posted by Claudio Weber Abramo on Aug-06-2013 02:44 |
|
Just tested with Mac Safari. The problem appears there as well. |
Re: SVG MultiChart cross-browser issue? |
Posted by Peter Kwan on Aug-06-2013 02:50 |
|
Hi Claudio Weber Abramo,
Is it possible to provide a copy of the SVG produced by ChartDirector? In Google Chrome, you may choose "Save page as" to save a copy.
Also, I have modified your "stray_circle.php" to include the ChartDirector version number in the chart title. May be you can use my modified version. For the latest version of ChartDirector, the chart title should be "Version = 5010001" (meaning 5.1.1).
Regards
Peter Kwan
stray_circle.php |
---|
<?php
require_once('../lib/phpchartdir.php');
$years = array(2002,2004,2006,2008);
$data[0] = array(10,NoValue,60,40);
$data[1] = array(60,30,10,80);
$colours = array(0=>0x900000,1=>0x009090);
$m = new MultiChart(320, 240);
// Not setting VectorOutput here produces a PNG image without the extra circle
$m->addTitle("Version = " . dechex(getVersion()));
$m->enableVectorOutput();
// ==============================================================================
for($n=0;$n<=1;$n++){
$c[$n] = new XYChart(320,125,Transparent);
$c[$n]->enableVectorOutput();
$c[$n]->setPlotArea(20, 10, 280, 80, Transparent, Transparent, Transparent, Transparent);
$c[$n]->xAxis->setColors(0x505050);
$c[$n]->xAxis->setLabels($years);
$c[$n]->xAxis->setLabelStyle('',9,0x909090);
$c[$n]->yAxis->setColors(0x505050);
$c[$n]->yAxis->setLabelStyle('',1,0xffffff);
$layer = $c[$n]->addSplineLayer();
$dataSetObj = $layer->addDataSet($data[$n], $colours[$n]);
// offending bit =============================================================
$dataSetObj->setDataSymbol(CircleSymbol,11,$colours[$n],Transparent);
// ===========================================================================
$layer->setLineWidth(2);
$layer->setDataLabelFormat('{value|0.}');
$col = $layer->setDataLabelStyle(' ',7,0x505050);
$col->setMargin2(0,0,0,5);
if($n == 1) $disp = 20;
else $disp = 125;
$m->addChart(0, $disp, $c[$n]);
}
$out = $m->makeChart2(SVG);
header("Content-type: image/svg+xml");
print($out);
?>
|
| |
Re: SVG MultiChart cross-browser issue? |
Posted by Claudio Weber Abramo on Aug-06-2013 03:07 |
|
Dear Peter:
It seems that the weird effect is caused by the presence, in the SVG output, of the following object:
<symbol id='g110' viewBox='0 0 320 125' preserveAspectRatio='none'>
</symbol>
which surrounds the graph's actual objects (which of course includes other symbol objects (the circles) that should appear).
The stray object's viewBox takes the dimensions from the XYChart.
Editing out the extra <symbol etc. > eliminates the problem. |
Re: SVG MultiChart cross-browser issue? |
Posted by Claudio Weber Abramo on Aug-06-2013 03:20 |
|
The version reported is 5.0.3, although I've just upgraded it. How come?
I am taking the libraries directly from the new version installation (not using any environment path).
Is there anywhere else where the new version info shoul be registered?
There you have the SVG (simplified):
<?xml version='1.0' encoding='UTF-8' standalone='no'?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 20010904//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'><svg viewBox='0 0 320 240' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xml:space='preserve'><g font-family='Arial' font-size='11px' fill='none' fill-rule='evenodd' stroke-linecap='square'><rect id='b129' x='0' y='0' width='320' height='240'/><use xlink:href='#b129' fill='#ffffff'/><symbol id='g110' viewBox='0 0 320 125' preserveAspectRatio='none'><g font-family='Arial' font-size='11px' fill='none' fill-rule='evenodd' stroke-linecap='square'><rect id='b128' x='0' y='0' width='320' height='125'/><use xlink:href='#b128'/><symbol id='g111' viewBox='0 0 11 11' preserveAspectRatio='none'><g font-family='Arial' font-size='11px' fill='none' fill-rule='evenodd' stroke-linecap='square'><path id='b112' stroke-linecap='butt' d='M5.5,0.5 A5,5 0 0 1 5.5,10.5 A5,5 0 0 1 5.5,0.5 Z'/><use xlink:href='#b112' fill='#900000'/></g></symbol><use x='155' y='45' width='11' height='11' xlink:href='#g111'/><text id='b113'><tspan style='font:9px Arial;' x='155' y='39'>10</tspan></text><use xlink:href='#b113' fill='#505050'/><line id='b114' x1='20.5' y1='90.5' x2='20.5' y2='10.5'/><use xlink:href='#b114' stroke='#505050'/><line id='b115' x1='16.5' y1='90.5' x2='19.5' y2='90.5'/><use xlink:href='#b115' stroke='#505050'/><text id='b116'><tspan style='font:1px Arial;' x='15' y='91'>0</tspan></text><use xlink:href='#b116' fill='#ffffff'/><line id='b117' x1='16.5' y1='70.5' x2='19.5' y2='70.5'/><use xlink:href='#b117' stroke='#505050'/><text id='b118'><tspan style='font:1px Arial;' x='15' y='71'>5</tspan></text><use xlink:href='#b118' fill='#ffffff'/><line id='b119' x1='16.5' y1='50.5' x2='19.5' y2='50.5'/><use xlink:href='#b119' stroke='#505050'/><text id='b120'><tspan style='font:1px Arial;' x='14' y='51'>10</tspan></text><use xlink:href='#b120' fill='#ffffff'/><line id='b121' x1='16.5' y1='30.5' x2='19.5' y2='30.5'/><use xlink:href='#b121' stroke='#505050'/><text id='b122'><tspan style='font:1px Arial;' x='14' y='31'>15</tspan></text><use xlink:href='#b122' fill='#ffffff'/><line id='b123' x1='16.5' y1='10.5' x2='19.5' y2='10.5'/><use xlink:href='#b123' stroke='#505050'/><text id='b124'><tspan style='font:1px Arial;' x='14' y='11'>20</tspan></text><use xlink:href='#b124' fill='#ffffff'/><line id='b125' x1='20.5' y1='90.5' x2='300.5' y2='90.5'/><use xlink:href='#b125' stroke='#505050'/><line id='b126' x1='160.5' y1='94.5' x2='160.5' y2='91.5'/><use xlink:href='#b126' stroke='#505050'/><text id='b127'><tspan style='font:12px Arial;' x='149' y='106'>2002</tspan></text><use xlink:href='#b127' fill='#909090'/></g></symbol><use x='0' y='125' width='320' height='125' xlink:href='#g110'/></g></svg> |
Re: SVG MultiChart cross-browser issue? |
Posted by Claudio Weber Abramo on Aug-06-2013 05:37 |
|
Dear Peter:
As I mentioned before, we've installed a freshly downloaded ChartDirector (Linux x86_64) and put the requisite DLLs and stuff into the PHP extensions directory.
chartdirector.ini was checked and is pointing to the correct location.
Apache was restarted.
Nothing changed. In particular, the Version being reported is still 5000003.
Upon comparing the files, the new phpchartdir530.dll is identical to the old one. |
Re: SVG MultiChart cross-browser issue? |
Posted by Peter Kwan on Aug-06-2013 20:12 |
|
Hi Claudio,
1. Please use phpinfo to confirm the exact location of your PHP extension directory. Normally, this directory is configured in "php.ini" (not "chartdirector.ini").
2. Please copy "all files" from "ChartDirector/lib" to your PHP extension directory. In particular, make sure you have copied "libchartdir.so", which should be of 4295960 bytes. The "phpchartdir530.dll" is just the interface between PHP and ChartDirector. The actual ChartDirector is in "libchartdir.so"
3. You may want to double-check to make sure there are no other "libchartdir.so" in your system. Sometimes, the dynamic linker may look for certain system directories (such as "/usr/lib" or "/usr/lib64") for the shared objects. So if there is an older version of "libchartdir.so" in these special directories, the dynamic linker may link to this older version instead of the version in the PHP extension directory.
4. Restart Apache
I seemed to remember a similar problem in an older version of ChartDirector, that's why I asked you to upgrade. Now you mentioned about the <symbol>, I can fully remember the issue now.
This issue is caused by a bug in WebKit (or more accurately, by a SVG library used by WebKit). The same SVG library may also be used in other products, so the issue may appear in other products as well. See the following thread for the explanation, and a test case to demonstrate the bug in the WebKit SVG library.
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1320882458#N1320974006
We know of many browser SVG bugs, and we try to work around all of those bugs. So in later versions of ChartDirector, we have modified the ChartDirector SVG output to work around this issue. The latest ChartDirector version therefore should not trigger this issue.
Regards
Peter Kwan |
Re: SVG MultiChart cross-browser issue? |
Posted by Claudio Weber Abramo on Aug-06-2013 23:43 |
|
Dear Peter:
We've done all that since the inception.
It turned out that yesterday Apache was not restarted.
Today it was restarted and now the new version is running and the problem disappeared.
Thanks. |
|