| Page 1 of 1 | [ 3 posts ] |
|
Hello. I made a pie chart and wanted to make percentages show on tooltips.
I couldnt figure out if the "sum of all values" are available somewhere in the scope of the YUI chart so i ended up calculating it again. However I was wondering since that value is calculated for the pie chart to be drawn anyway, if it could be exposed somehow for usage in tooltips I ended up with something like this Code: $total_items = 0; foreach ($this->data_source as $i) $total_items += $i['value']; ... Code: markerLabelFunction: function(categoryItem, valueItem, itemIndex, series, seriesIndex) { return "<span style=\"text-decoration:underline\">" + categoryItem.value + "</span><br/><div style=\"margin-top:5px;font-weight:bold\">" + valueItem.value + " (" + Math.round(valueItem.value / '.$total_items.' * 100) + " %)</div>" } |
|
Hi Martin,
You are correct. The total should be available. Please file a ticket and I will take care of it. http://yuilibrary.com/projects/yui3/newticket Thanks, Tripp |
| Page 1 of 1 | [ 3 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group