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

Message ListMessage List     Post MessagePost Message

  NoValue: Weird results in PHP?
Posted by Charles on Apr-01-2011 07:14
When I use NoValue to fill an array in PHP, I get strange values.

Code:
if(isset($filteredData[$stage]['HOTLOTS']))
$scatterHeightArray[$key] = max($bar1Data[$key], $bar2Data[$key]);
[**] else $scatterHeightArray[$key] =  cd.NoValue;

[...]

$scatterLayer = $chart->addScatterLayer(NULL, $scatterHeightArray);



[**] is the line of code in question.


Here is an array snippet when I use:
else $scatterHeightArray[$key] =  cd.NoValue;

[17] => cd1.7E+308
[18] => cd1.7E+308
[19] => 67
[20] => cd1.7E+308
[21] => cd1.7E+308

"cd1.7E+308" is not a valid number.

Now when I use:
else $scatterHeightArray[$key] =  $chart.NoValue;
    [17] => Object id #21.7E+308
    [18] => Object id #21.7E+308
    [19] => 67
    [20] => Object id #21.7E+308
    [21] => Object id #21.7E+308

Why is NoValue an object? I would think it would just be defined as a double.


Finally, when I type the number in manually:
  else $scatterHeightArray[$key] =  1.7E+308;

Then the array works and the appropriate values are skipped.

Most of the examples seem to use NoValue in this way, such as thread ID # 1133914883
which has the line "dataY1[i] = Chart.NoValue;", but the PHP documentation has no
sample code in NoValue's documentation, so as far as I know I am using it wrong.

  Re: NoValue: Weird results in PHP?
Posted by Peter Kwan on Apr-01-2011 23:28
Hi Charles,

In PHP, the NoValue constant is just represented as NoValue. For example:

$scatterHeightArray[$key] =  NoValue;

(In PHP, the "." means string concatenation. cd means a constant called cd. If there is no such constant, traditionally PHP will assume it is a text string "cd". So cd.NoValue means the text string "cd", concatenate with the NoValue constant to become another text string.)

The "Missing Data Point" sample code is an example that uses NoValue. May be you can use it as a reference.

Hope this can help.

Regards
Peter Kwan

  Re: NoValue: Weird results in PHP?
Posted by Charles on Apr-01-2011 23:44
Thanks, Peter, that works. In retrospect, the problem was fairly obvious.
My confusion was from switching between different languages fairly rapidly.