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

Message ListMessage List     Post MessagePost Message

  Problem contour chart
Posted by Nico on Jul-11-2013 03:41
Attachments:
Hi,

Sorry for my bad English, I use google for the traduction. I put the French translation
below.

I have a problem in the creating of contour charts in PHP with the library but I do not
know how to fix it. You can view my problem on the picture join to this message.

When there are large differences in values ​​between 3 points, the regularity of the
interpolation and coloration does not happen and it appears triangles and lines. This is
not
beautiful ... Is this normal?

Thank you in advance for your help.

Regards.

Nico.

####?French #####
Bonjour,
D?sol? pour mon mauvais anglais, j'utilise Google pour la traduction.
J'ai un probl?me dans ma cr?ation de contour charts en PHP avec la librairie
ChartDirector,
mais je ne sais pas comment le r?soudre. Vous pouvez voir mon probl?me sur l'image
jointe ? ce message.
Quand il y a de grandes diff?rences de valeurs entre 3 points, la r?gularit? de
l'interpolation et de la coloration ne se fait pas bien et des triangles et lignes deviennent
visibles. Ce n'est pas esth?tique ... Est-ce normal ?
Merci d'avance pour votre aide.
Au revoir.
Nico.
photo.PNG

  Re: Problem contour chart
Posted by Peter Kwan on Jul-12-2013 02:54
Hi Nico,

What you see is normal if you are using "smooth interpolation" (the default).

Consider the two points "27 and 21.5" near the center of the chart. They are close together, but the values are very different. So they create a steep slope. In smooth interpolation, the slope will be assumed to continue to the right and left sides. So to the right of 21.5, the interpolation may estimate it as 16. Therefore it may create a cold spot to the right of 21.5, and the temperature can suddenly change from hot to cold.

For your case, as you are not plotting the "contours", may be you can consider to use "linear interpolation", like:

$myContourLayer->setSmoothInterpolation(false);

In "interpolation", the slope will not be assumed to continue to the right or left, and so it avoid the cold spot.

Regards
Peter Kwan

  Re: Problem contour chart
Posted by Nico on Jul-12-2013 03:57
Hi Peter,

Thank you for your response.

I just tested my script and the problem of "cold spot" is solved, thank you.

However, it still appears the lines between my points and the gradient is not linear, is this normal or a solution is possible with a library function?

Here is my script:

$c = new XYChart($largeur, $hauteur);
$c->setPlotArea(0, 0, ($largeur - 1), ($hauteur - 1), -1, -1, -1, 0, 0);

$layer = $c->addContourLayer($dataX, $dataY, $dataZ);

$layer->setContourColor(Transparent);
$layer->setSmoothInterpolation(false);
//$layer->setZBounds(min($dataZ), max($dataZ));

$cAxis = $layer->setColorAxis($largeur, $hauteur, Left, 370, Right);
$cAxis->setBoundingBox(0xdcb2ff, 0x444444);

$cAxis->setLinearScale($min, $max, $precision);

$cAxis->setReverse(true);

$cAxis->setColorGradient($gradient, $array_color, -1, -1);

$c->makeChart("/tmp/trace_carte2.png");

If I want include "$layer->setZBounds(min($dataZ), max($dataZ));", I could solve my problem ? (Because my script give an error if I put this line for test ... :()

I hope not too much to ask ...

Thank you very much.

Regards.

  Re: Problem contour chart
Posted by Nico on Jul-12-2013 04:06
My error : Fatal error: unknown method ContourLayer.setZBounds in /var/www/lib/ChartDirector/lib/phpchartdir.php on line 2381.

Regards.

Nico.

  Re: Problem contour chart
Posted by Peter Kwan on Jul-13-2013 00:44
Hi Nico,

For the issue with setZBounds, are you sure you are using ChartDirector 5.1? In particular, is the "phpchartdir.php" you are using from ChartDirector 5.1 or 5.1.1?

Sometimes people copies "phpchartdir.php" to their own script directory. So when they upgrade the ChartDirector to 5.1, they forgot to copy the new "phpchartdir.php" to their own script directory again. In this case, the new APIs in ChartDirector 5.1 will not be found.

Regards
Peter Kwan