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

Message ListMessage List     Post MessagePost Message

  (PHP) Black background in somes cases
Posted by Laurent on May-30-2012 17:47
Hello,

I used the tried version of Chart Director to draw graphs that appear into a webpage or
that are used into document (generated with another library).

It appear that some time, but with no logic (I can just reload the page to make it
disappear), every text is written over a black background. Graphs are OK, but titles et
legends are on a black background ; title are in blue but legends in black, so it is
unreadable.

There is no logic to this problem, as the page reloading just correct it. So in my opinion the
problem come either from Apache (I use Xampp) or from Windows (serveur 2008- I checked
system and application logs but couldn't find anything anormal).

Did any one already see this problem or has a solution ?

  Re: (PHP) Black background in somes cases
Posted by Peter Kwan on May-31-2012 02:30
Hi Laurent,

If this happens, please try your best to save the chart image as a file (right click on the chart image, then select "Save Picture As"). Another method is to try to drag the image to the desktop. If the browser does not attempt to reload the image from the server, you may be able to save the faulty image. Please provide me with the image for analysis.

Also, in your charting code, is the background color hard coded, or is it in a variable? If the color is in a variable, for testing, you may consider to change it to hard coded values such as 0xffffff. This avoids the uncertainty that the variables are not set correctly. Also, note that in PHP, 0xffffff is different from "0xffffff" (with quotes). The former is a number, while the latter is a text string. If "0xffffff" (with quotes) is used as the color, sometimes PHP will interpret it as 0, which is black.

Another issue we have seen that may cause inaccurate colors (though not to the extent to changing the text to black text on black backgrouind) is due to the 256 color limitation of GIF. As GIF only supports 256 colors, if the chart contains more than 256 colors, ChartDirector must adjust some colors to reduce the image to 256 colors, causing color inaccuracy.

It is known that multi-threaed PHP is unstable. Historically, multi-threaded PHP is used on Windows due to performance reasons. (Windows is not efficient with forking, so threading must be used.) A few years ago, Zend (the company that develops PHP) finally supports the FastCGI method, and with this method, single-threaded PHP can have a similar performance level as multi-threaded PHP, but more stable. That's why there is now both thread-safe and non-thread-safe PHP available for download. Also, Zend's own server offerings always use single-threaded PHP on Windows.

From my understanding, Xampp uses multi-threaded PHP (because it has always been using multi-threaded PHP since long time ago). I am not sure if this could cause the problem, but for trouble-shooting, you may consider to switch to non-thread-safe PHP using FastCGI as the PHP/Server interface method.

Regards
Peter Kwan

  Re: (PHP) Black background in somes cases
Posted by Laurent on May-31-2012 18:37
Hi,

We tried another solution for now (it is not possible to change Xampp by now...). We
noticed that our text backgrounds were transparent, so we tried at first to fix it as totally
white. We are now generating pictures to check if the problem accures again...

We will keep you informed, anyway thanks for your help !