LATEST ARC CHART 1 - http://jsfiddle.net/NYEaX/699/ ***
I'm developing a set of arc charts.
^ this is the latest version I have.
My first problem - is that when a new set of data comes in - the animation appears flickery.
I am also interested in varying the inner-radius/outer-radius per segment.
Would I just provide a modulus on the i in the following code
getArc: function(){
var that = this;
var arc = d3.svg.arc()
.innerRadius(function(d, i){
return that.radius;
})
.outerRadius(function(d){
var maxHeight = 100;
var ratio = (d.height/maxHeight * 100)+that.radius;
return ratio;
})
.startAngle(function(d, i){
return d.startAngle;
})
.endAngle(function(d, i){
return d.endAngle;
});
return arc;
}
I've corrected the application.
I've managed to now create a shift on the various segments.

However, I am trying to now use the value of the segments to alter their length. So I am wanting to create an arc that looks like the picture example.
This is the latest example I've got.
and here is the code - I am unsure how to get the total length of all of the arcs to provide the correct length via startAngle/endAngle to complete the solution.
setData: function(data, isSorted){
var diameter = 2 * Math.PI * this.radius;
var localData = new Array();
var displacement = 0;
var oldBatchLength = 0;
var totalSum = 0;
$.each(data, function(index, value) {
$.each(value.segments, function( ri, va) {
totalSum+= va.height;
});
});
$.each(data, function(index, value) {
var riseLevels = value.segments;
//var riseLevelCount = riseLevels.length;
//var arcBatchLength = 2*Math.PI;
//var arcPartition = arcBatchLength/riseLevelCount;
$.each(riseLevels, function( ri, value ) {
if(oldBatchLength !=undefined){
displacement+=oldBatchLength;
}
var segmentValue = value.height;
//var ratio = value.height/totalSum;
var arcBatchLength = segmentValue;//ratio*2*Math.PI;
var arcPartition = arcBatchLength/totalSum;
var startAngle = (ri*arcPartition);
var endAngle = ((ri+1)*arcPartition);
if(index!=0){
startAngle+=displacement;
endAngle+=displacement;
}
riseLevels[ri]["startAngle"] = startAngle;
riseLevels[ri]["endAngle"] = endAngle;
riseLevels[ri]["index"] = ri;
oldBatchLength = arcBatchLength;
});
//oldBatchLength = arcBatchLength;
localData.push(riseLevels);
});
var finalArray = new Array();
$.each(localData, function(index, value) {
$.each(localData[index], function(i, v) {
finalArray.push(v);
});
});
console.log("finalArray", finalArray);
return finalArray;
}