|
Image map on donut chart appears not to respect the donut width |
Posted by Matt Hoskins on Oct-08-2014 14:48 |
|
Hi,
I'm using getHTMLImageMap on a PieChart which has had setDonutSize called on it. Unfortunately the polygon areas in the image map do not respect the width element of the setDonutSize call - they cover the pie segments as if setPieSize had been called instead (i.e. they are full circle segments). I've attached a screenshot where I've used a javascript plugin to draw lines on a canvas to illustrate the image map polygons.
Unless I'm missing something, I would guess this is a bug?
A work around for some use cases would be to mask off the inside with another area in the image map, but for my purposes that wouldn't be sufficient - I really need the image map for the donut to only cover the donut area.
Regards,
Matt
|
Re: Image map on donut chart appears not to respect the donut width |
Posted by Peter Kwan on Oct-08-2014 23:51 |
|
Hi Matt,
This is by design.
ChartDirector image maps are designed for the purpose of providing tooltips and clickable
hot spots. It is often not an accurate representation of the object, but should be sufficient
for the purpose of tooltips and hot spots. For the donut chart, apart from the center, you
can see the border of the image map is a polygon instead of an arc. For 3D donuts, the
image map also will not include the 3D "height" of the donut.
Would you mind to clarify how would you like to use the image map? Do you want draw a
border based on it? For simple case such as a non-3D non-exploded pie chart, you can
calculate the position very easily with your own code. I can write an example for you if you
can inform me your programming language. It would be more complicated if the chart is in
3D and with sectors exploded in various ways.
Regards
Peter Kwan |
Re: Image map on donut chart appears not to respect the donut width |
Posted by Matt Hoskins on Oct-09-2014 01:09 |
|
Hi Peter,
I use a 3rd party tooltip javascript library which includes image map area support for calculating positions of tooltips and it was putting them wildly outside the drawn donut segments even for small ones which is how I noticed something wasn't working as I'd expected!
Actually on reflection I don't think that tooltip library's automatic positioning would be very useful even if ChartDirector did draw the areas to more closely match the donut sections as its calculation for "center" just uses the bounding rectangle of the polygon area so for larger donut segments it would position outside the drawn area anyway.
A crude but workable solution I can use is if I loop over the chart "Sector" objects and build up the image map using getImageCoor and getLabelCoor, using ids to correlate them, and then tell the javascript library to use the sector's corresponding label as the element to position the tooltip by if hovering over the segment (and mask off the inside of the donut). Not the tidiest solution but saves me having to do any geometry myself as I'm a bit rusty at it
Anyway thanks for your reply, and also generally for ChartDirector - it's a great product made very easy to work with thanks to the copious useful examples in the documentation!
Matt |
|