|
Boxwhisker with x marks |
Posted by aldy on Dec-14-2011 14:51 |
|
Hi Peter,
I'd like to make a chart that is the same as attached but i got a problem in drawing the red x marks. I first draw the boxwhisker using setlabels in the x-axis then added scatter layers to draw the x-marks but the result is that the x-marks will only draw under the first x-axis label, it is not distributed throughout the x-axis. I followed the array data structure from your samples. Maybe I missed something here. I'm using PHP. Pls help.
this is the code i used to add the scatter layers:
for($i = 0; $i < sizeof($this->outliersData); ++$i) {
$outlierObj = $c->addScatterLayer("", $this->outliersData[$i], "", Cross2Shape(0.1), 12);
$outlierObj->setBorderColor($this->outlierColor);
}
Regards.
|
Re: Boxwhisker with x marks |
Posted by Peter Kwan on Dec-15-2011 02:28 |
|
Hi aldy,
In your case, each of your scatter layer only have 1 point, with the x-coordinate unspecified (and therefore assumed to be 0). As the x-coordinate is always 0, so the symbol is always at the first x-position.
Instead, the code should be:
$outlierObj = $c->addScatterLayer(null, $this->outliersData, "", Cross2Shape(0.1), 12);
$outlierObj->setBorderColor($this->outlierColor);
Hope this can help.
Regards
Peter Kwan |
Re: Boxwhisker with x marks |
Posted by aldy on Dec-15-2011 10:33 |
|
Thanks a lot Peter. |
Re: Boxwhisker with x marks |
Posted by aldy on Dec-15-2011 17:37 |
|
Hi Peter, follow up question. The red marks seem to be plotted at the very bottom even
though I assigned a NoValue to them. Any idea why this is happening. Pls see attached
chart.
Regards.
|
Re: Boxwhisker with x marks |
Posted by Peter Kwan on Dec-16-2011 08:44 |
|
Hi aldy,
The red marks are plotted at y = 0. The most probable reason is because the coordinate is 0.
Would you mind exactly how does your code use NoValue? In PHP, the syntax of the missing value is NoValue, not "NoValue" (there should be no quotes). Also, NoValue is a ChartDirector constant defined in "phpchartdir.php". It should only be used after including "phpchartdir.php".
(I have seen a case in which a developer gets the data from a separate module which does not include "phpchartdir.php", and so NoValue does not work. According to PHP syntax, an undefined constant or a text string that cannot be converted to a number should be treated as 0 in numeric context. So any undefined NoValue or the text string "NoValue" will be equivalent to 0.)
To check exactly what your code is using, you may replace your chart title with:
$c->addTitle(join("=", $myData), "arial.ttf", 8);
In this way, you can see your data on the chart title, and it can help to determine if NoValue is used. The NoValue should appear as 1.7E+308 in the title.
If you need further help, would you mind to inform me the full charting part of your code, and also the chart with $c->addTitle(join("=", $myData), "arial.ttf", 8);?
Regards
Peter Kwan |
Re: Boxwhisker with x marks |
Posted by aldy on Dec-16-2011 13:55 |
|
Thanks Peter, I prepared the data in the different module, thats probably the reason. |
|