|
Circle Shape in Imagemap |
Posted by Mark on Nov-09-2013 04:39 |
|
Hi,
I use a scatterLayer with Chart.CircleShape, size 8. But my
scatterLayer.getHTMLImageMap() gives something like the following:
<area shape="rect" coords="3,13,13,23" ...>
If the data is a "point" type, why is a "rect" used instead of a "circle" of size 8?? Is there
something I can set to get chartDirector to output a circle shape in the imagemap instead
of a rectangle??
Mark |
Re: Circle Shape in Imagemap |
Posted by Peter Kwan on Nov-12-2013 00:59 |
|
Hi Mark,
Unluckily, ChartDirector cannot output image maps with circular shapes. In fact, for many symbols, ChartDirector will not trace out their exact shapes, but will simply use their bounding box as the hot spot region. For example, the image map for a star shaped icon or other custom icons will probably be a rectangle as well.
If you need a circular hot spot, the only method I can think of is to modify the image map created by ChartDirector. You may write some code (which hopefully would not be long) to modify:
shape="rect" coords="a,b,c,d"
to
shape="circle" coords="x,y,z"
there x = (a + c) / 2, y = (b + d) / 2, and z = abs(c - a) * 3 / 8
If your chart has many types of hot spots, you may set a flag <area> tag for the hot spots that should be circular, so that your code can easily find those <area> tags and modify only them. To set a flag, you may use Layer.setHTMLImageMap to set a special attribute in the "extraAttr" field (eg. like "isC='1'"). Then in your code, you just need to look for the text pattern "isC='1'" to locate the area tags.
Regards
Peter Kwan |
|