ICC-Profile
view release on metacpan or search on metacpan
lib/ICC/Javascripts/rgraph/RGraph.svg.rose.js view on Meta::CPAN
});
}
// Draw the zero label
var str = RG.SVG.numberFormat({
object: this,
num: this.scale.min.toFixed(prop.scaleDecimals),
prepend: prop.scaleUnitsPre,
append: prop.scaleUnitsPost,
point: prop.scalePoint,
thousand: prop.scaleThousand,
formatter: prop.scaleFormatter
});
RG.SVG.text({
object: this,
svg: this.svg,
parent: this.svg.all,
tag: 'labels.scale',
text: str,
size: prop.scaleSize || prop.textSize - 2,
x: this.centerx,
y: this.centery,
halign: 'center',
valign: 'center',
background: 'rgba(255,255,255,0.7)',
padding: 2,
color: prop.scaleColor || prop.textColor,
bold: typeof prop.scaleBold === 'boolean' ? prop.scaleBold : prop.textBold,
italic: typeof prop.scaleItalic === 'boolean' ? prop.scaleItalic : prop.textItalic,
font: prop.scaleFont || prop.textFont
});
}
// Used further down
var halign;
// Set a default size for the labels
if (typeof prop.labelsSize !== 'number') {
prop.labelsSize = prop.textSize + 4;
}
// Draw the circular labels if necessary
for (var i=0; i<prop.labels.length; ++i) {
if (prop.variant === 'non-equi-angular') {
var angle = ((this.angles2[i][0].end - this.angles2[i][0].start) / 2) + this.angles2[i][0].start - RG.SVG.TRIG.HALFPI;
} else {
var angle = (((RG.SVG.TRIG.TWOPI / prop.labels.length)) * i) - RG.SVG.TRIG.HALFPI + prop.labelsAngleOffset + (RG.SVG.TRIG.TWOPI / (2 * prop.labels.length));
}
var endpoint = RG.SVG.TRIG.getRadiusEndPoint({
r: this.radius + prop.labelsRadialMargin,
angle: angle
});
// Accommodate the explosion for the label
var explosion = this.getExploded({
index: i,
start: this.angles2[i][0].start - RG.SVG.TRIG.HALFPI,
end: this.angles2[i][0].end - RG.SVG.TRIG.HALFPI
});
endpoint[0] += this.centerx + explosion[0];
endpoint[1] += this.centery + explosion[1];
// Do the alignment based on which quadrant the label is in
if (ma.round(endpoint[0]) > this.centerx) {
halign = 'left';
} else if (ma.round(endpoint[0]) === this.centerx) {
halign = 'center';
} else {
halign = 'right';
}
RG.SVG.text({
object: this,
svg: this.svg,
parent: this.svg.all,
tag: 'labels',
text: typeof prop.labels[i] === 'string' ? prop.labels[i] : '',
size: prop.labelsSize,
x: endpoint[0],
y: endpoint[1],
halign: halign,
valign: 'center',
background: 'rgba(255,255,255,0.7)',
padding:2,
color: prop.labelsColor || prop.textColor,
bold: typeof prop.labelsBold === 'boolean' ? prop.labelsBold : prop.textBold,
italic: typeof prop.labelsItalic === 'boolean' ? prop.labelsItalic : prop.textItalic,
font: prop.labelsFont || prop.textFont
});
}
};
/**
* This function can be used to highlight a segment on the chart
*
* @param object circle The circle to highlight
*/
this.highlight = function (path)
{
var path = path.getAttribute('d');
var highlight = RG.SVG.create({
svg: this.svg,
parent: this.svg.all,
type: 'path',
attr: {
d: path,
fill: prop.highlightFill,
stroke: prop.highlightStroke,
'stroke-width': prop.highlightLinewidth
},
style: {
pointerEvents: 'none'
}
});
if (prop.tooltipsEvent === 'mousemove') {
highlight.addEventListener('mouseout', function (e)
{
highlight.parentNode.removeChild(highlight);
RG.SVG.hideTooltip();
RG.SVG.REG.set('highlight', null);
}, false);
}
// Store the highlight rect in the registry so
// it can be cleared later
RG.SVG.REG.set('highlight', highlight);
};
( run in 1.571 second using v1.01-cache-2.11-cpan-524268b4103 )