|
Contour Layer |
Posted by Jorge Eduardo on Mar-30-2011 02:26 |
|
Hi Peter, I need to create heat map, with the layout over it, so the user can viasualize
the differeten areas placed over his actual location.
I'm using the code above, but don?t get the expected result wich must be a layot over a
heat map.
' Create a XYChart object of size 450 x 540 pixels
Set c = cd.XYChart(600, 600)
Call c.addTitle(" Densidad de Trafico", "ariali.ttf", 15)
Set plotarea= c.setPlotArea(65, 40, 500, 450, -1, -1, -1, &HFF000000 , -1)
Call c.xAxis().setTitle("X", "arialbi.ttf", 10)
Call c.yAxis().setTitle("Y", "arialbi.ttf", 10)
Call c.xAxis().setLabelStyle("arialbd.ttf")
Call c.yAxis().setLabelStyle("arialbd.ttf")
Call c.xAxis().setColors(cd.Transparent)
Call c.yAxis().setColors(cd.Transparent)
Call c.addScatterLayer(dataX, dataY, "", cd.Cross2Shape(0.2), 7, &H000000)
Set layer = c.addContourLayer(dataX, dataY, dataZ)
Call c.getPlotArea().moveGridBefore(layer)
Set cAxis = layer.setColorAxis(305, 530, cd.TopCenter, 330, cd.Top)
Call cAxis.setBoundingBox(cd.Transparent, cd.LineColor)
Call cAxis.setTitle("Densidad de Trafico", "arialbi.ttf", 10)
Call cAxis.setLabelStyle("arialbd.ttf")
Call cAxis.setLinearScale(0, 200, 50)
Call c.addText(c.getPlotArea().getLeftX() + c.getPlotArea().getWidth() / 2,
c.getPlotArea().getTopY() + c.getPlotArea().getHeight() / 2, "<*img=mapa_1.png*>",
"normal", 8, &H000000, cd.Center)
As usual, I?m plased to be adviced by your excellent support team.
Based on previous forum posts, I use this piece of code:
Call c.addText(c.getPlotArea().getLeftX() + c.getPlotArea().getWidth() / 2,
c.getPlotArea().getTopY() + c.getPlotArea().getHeight() / 2, "<*img=mapa_1.png*>",
"normal", 8, &H000000, cd.Center)
Also use a transparent image with I?m attaching.
The result I got is the image above. What I?m doing wrong?
Thanks in advance,
Jorge Eduardo
datelligence
|
Re: Contour Layer |
Posted by Peter Kwan on Mar-30-2011 03:12 |
|
Hi Jorge,
Are you writing an ASP web page, or is it a VB6 desktop program?
If it is a web page, the path mapa_1.png is almost certainly incorrect. Note that the path used in the <*img*> tag is the file system path (as it runs on the server side), which is not the same as the URL path used on the browser side.
A file system path is the path you use to access files. The root of the file system path is the root of the hard disk (not the root of the web document directory). For a relative path, it is relative to the current working directory (not the current URL directory). For IIS, the current working directory is the directory of the IIS executable (somewhere deep insider [windows/system32]). So "mapa_1.png" would mean an image map something deep insider the [windows/system32] directory.
If the "mapa_1.png" is a URL path, please use Server.MapPath to convert it to a file system path before passing it to ChartDirector. For example:
Call c.addText(c.getPlotArea().getLeftX() + c.getPlotArea().getWidth() / 2,
c.getPlotArea().getTopY() + c.getPlotArea().getHeight() / 2, "XXX <*img=" & Server.MapPath("mapa_1.png") & "*> YYY",
"normal", 8, &H000000, cd.Center)
For debugging purpose, I have also added the text "XXX" and "YYY". In case the image is not shown, the "XXX" and "YYY" can be used to confirm if the text box is in fact added and stays above the contour layer.
Hope this can help.
Regards
Peter Kwan |
Re: Contour Layer |
Posted by Jorge Eduardo on Mar-30-2011 07:55 |
|
Perfect. As usual, your advice is perfect. Thanks, it?s working as I expected. For the record, I?m working on .asp.
Thanks my friend,
Jorge Eduardo |
|