ICC-Profile
view release on metacpan or search on metacpan
lib/ICC/Javascripts/rgraph/RGraph.svg.rose.js view on Meta::CPAN
// Now loop thru the data
for (var i=0,seq=0; i<this.data.length; ++i,++seq) {
var radians = (this.data[i][1] / total) * RG.SVG.TRIG.TWOPI,
end = start + radians;
// Get the exploded distance
var explosion = this.getExploded({
index: i,
start: start - RG.SVG.TRIG.HALFPI,
end: end - RG.SVG.TRIG.HALFPI
});
// A stacked non-equi-angular segment
if (typeof this.data[i][0] === 'object' && !RG.SVG.isNull(this.data[i][0])) {
// Loop thru the set of values for this segment
for (var j=0,sum=0; j<this.data[i][0].length; ++j,++seq) {
sum += this.data[i][0][j];
// First segment in the stack or not?
if (j === 0) {
var prevRadius = 0,
radius = (sum / this.scale.max) * this.radius;
var arcPath = RG.SVG.TRIG.getArcPath2({
cx: this.centerx + explosion[0],
cy: this.centery + explosion[1],
r: radius,
start: start + prop.margin + prop.segmentsAngleOffset,
end: end - prop.margin + prop.segmentsAngleOffset,
anticlockwise: false
});
var arcPath2 = '';
} else {
var prevRadius = radius, // The previous iterations radius
radius = (sum / this.scale.max) * this.radius;
var arcPath = RG.SVG.TRIG.getArcPath2({
cx: this.centerx + explosion[0],
cy: this.centery + explosion[1],
r: radius,
start: start + prop.margin + prop.segmentsAngleOffset,
end: end - prop.margin + prop.segmentsAngleOffset,
anticlockwise: false
});
var arcPath2 = RG.SVG.TRIG.getArcPath2({
cx: this.centerx + explosion[0],
cy: this.centery + explosion[1],
r: prevRadius,
start: end - prop.margin + prop.segmentsAngleOffset,
end: start + prop.margin + prop.segmentsAngleOffset,
anticlockwise: true
});
}
var path = RG.SVG.create({
svg: this.svg,
type: 'path',
parent: group,
attr: {
d: '{1} {2} z'.format(
arcPath,
arcPath2
),
fill: prop.colorsSequential ? prop.colors[seq] : prop.colors[j],
'fill-opacity': prop.colorsOpacity,
stroke: prop.strokestyle,
'stroke-width': prop.linewidth,
'data-tooltip': (!RG.SVG.isNull(prop.tooltips) && prop.tooltips.length) ? prop.tooltips[i] : '',
'data-centerx': this.centerx + explosion[0],
'data-centery': this.centery + explosion[1],
'data-index': '[{1},{2}]'.format(i, j),
'data-value': this.data[i][0][j],
'data-start-angle': start,
'data-end-angle': end,
'data-radius': radius,
'data-radius-inner': prevRadius,
'data-sequential': seq
}
});
// Add the segment to the angles array
this.angles.push({
object: this,
element: path,
index: i,
cx: this.centerx + explosion[0],
cy: this.centery + explosion[1],
start: start,
end: end,
radius: radius,
'radius-inner': prevRadius,
( run in 0.420 second using v1.01-cache-2.11-cpan-71847e10f99 )