if(i != 0) {
// 6 pixels away from bottom of the line
- paper.text(x + (axisYWidth / 2), Y + axisFontSize / 2 + 6, label).attr({
+ paper.text(x + (axisYWidth / 2), Y + axisFontSize / 2 + 6, Roo.util.Format.number(label, 0)).attr({
"font-size": axisFontSize,
"font-family": axisFont,
"font-weight": axisFontWeight,
* labelsize (number) : font size of the labels
* labelweight (string)(number) : font weight of the labels
* labelcolor (string) : font color of the labels
+ * showlabel (number) : only show label if the value >= 'showlabel'% of total
* legend (array) : legend
* legendpos (string) : position of the legend ('right' / 'bottom')
* legendkeyshape (string) : shape of the legend keys ('circle' / 'rect')
*/
function Piesectorchart(paper, width, height, cx, cy, r, values, opts) {
-
+
opts = opts || {};
var chartinst = this,
labelFont = opts.labelfont || "'Fontin Sans', Fontin-Sans, sans-serif",
labelSize = opts.labelsize || 18,
labelWeight = opts.labelweight || 'normal',
- labelColor = opts.labelcolor || '#FFFFFF';
+ labelColor = opts.labelcolor || '#FFFFFF',
+ showLabel = typeof(opts.showlabel) != 'undefined' ? opts.showlabel : 5; // default show label if value >= 5% of total
opts.barwidth = opts.barwidth || 80;
a -= 360 * values[i] / total;
// show the label only if the values >= 5% of total
- if(labels && values[i] / total >= 0.05) {
- var text = labels[i];
+ if(labels && values[i] / total >= (showLabel / 100)) {
+ var text = labels[values[i].origin];
if(text.indexOf('#qty#') !== -1) {
- text = text.replace('#qty#', Math.round(values[i]));
+ text = text.replace('#qty#', Roo.util.Format.number(Math.round(values[i]), 0));
}
if(text.indexOf('#%#') !== -1) {
var text = (values[i].others) ? opts.others : opts.legend[values[i].origin] || values[i];
if(text.indexOf('#qty#') !== -1) {
- text = text.replace('#qty#', Math.round(values[i]));
+ text = text.replace('#qty#', Roo.util.Format.number(Math.round(values[i]), 0));
}
if(text.indexOf('#%#') !== -1) {