|
NoValue and showInfo |
Posted by Berno Deggelmann on Jan-27-2011 17:22 |
|
Dear Sir,
I am quite new with Chartdirector.
First question is about the NoValue -Value.
I get my data from a mysql table and while putting it in an array translate certain values to NoValue. That works fine but creates a side Effect:
If there is only one NoValue in the array, the showInfo doesnt showup any more, I found nothing so far in the forum ... do you have an idea ?
Second question is about the trigger of Show info:
For the moment I create with
$layer = $c->addAreaLayer();
$layer->addDataSet($wert, 0xeeee66aa, "");
a rectangular area, so I do not have to follow the lines to get information in the show info table. This is not very elegant I think
Is there any possibility to make the whole or a partof the plotarea sensitiv to cursor movements ?
code is attached
sincerely
Berno Deggelmann
|
Re: NoValue and showInfo |
Posted by Peter Kwan on Jan-28-2011 01:22 |
|
Hi Berno,
It is hard to diagnose your code without running your code and seeing the output.
If the showInfo does nothing, the first thing is to look for any error message. If there is an Javascript error in the code, IE should show up an icon in the status bar informing you of a Javascript error. For FireFox, you can open the error console to see if there are any Javascript error.
Note that NoValue is not formatted to a number in Javascript. ChartDirector currently just format it to an empty string. For your current code, the onmouseover is:
onmouseover='showInfo(\\"{xLabel}\\", {field0}, {field1}, {field2}, {field3});'
You can see that the above code is invalid as according to Javascript syntax if any of the {fieldN} is not a number. You may consider to enclose them in quotes (just like the {xLabel}. In Javascript syntax, if something is enclosed in quotes, the code is legal even if the enclosed content is not a number.
If the above is in fact the cause of the problem, you should see them as Javascript errors in your browser.
For making "the whole or a partof the plotarea sensitive to cursor movements", the area is always sensitive to mouse movements. You may simply handle the standard onmouseover event of the chart image. There is no need to use any ChartDirector features and no need to use any image map. See:
https://developer.mozilla.org/en/DOM/element.onmouseover
When the mouse is over the image, you may easily compute the nearest x-label position. (In your chart, the x-labels are evenly spread on your x-axis, and your code already knows the x-axis end-points, which is the left and right edge of the plot area.) Then you can retrieve the other data you want to display and display them.
Hope this can help.
Regards
Peter Kwan |
Re: NoValue and showInfo |
Posted by Berno Deggelmann on Feb-01-2011 17:09 |
|
Dear Sir,
thank you very much. My Problems are solved.
I am not really a coder and pretty new in Javascript and Chartdirector, most of my work for the time is PHP together with MYSQL , so please forgive me the inconvenience if I ask you some questions in the future, which are not direct connected to Chartdirector itself. This because, for the time, it is hard for me to distinguish ...
If you kindly push me in the right direction I will be grateful.
sincerely
Berno Deggelmann |
|