|
|
@ -515,7 +515,7 @@ |
|
|
|
function updateRadius() { |
|
|
|
function updateRadius() { |
|
|
|
radiusExpanded = Math.min(arcWidth, arcHeight) / 2; |
|
|
|
radiusExpanded = Math.min(arcWidth, arcHeight) / 2; |
|
|
|
radius = radiusExpanded * 0.95; |
|
|
|
radius = radiusExpanded * 0.95; |
|
|
|
var innerRadiusRatio = __gauge_width ? ((radius-__gauge_width)/radius) : 0.6; |
|
|
|
var innerRadiusRatio = __gauge_width ? ((radius - __gauge_width) / radius) : 0.6; |
|
|
|
innerRadius = hasDonutType(c3.data.targets) || hasGaugeType(c3.data.targets) ? radius * innerRadiusRatio : 0; |
|
|
|
innerRadius = hasDonutType(c3.data.targets) || hasGaugeType(c3.data.targets) ? radius * innerRadiusRatio : 0; |
|
|
|
} |
|
|
|
} |
|
|
|
function getSvgLeft() { |
|
|
|
function getSvgLeft() { |
|
|
@ -991,14 +991,16 @@ |
|
|
|
d = t; |
|
|
|
d = t; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (isNaN(d.endAngle)) d.endAngle = d.startAngle; |
|
|
|
if (isNaN(d.endAngle)) { |
|
|
|
|
|
|
|
d.endAngle = d.startAngle; |
|
|
|
|
|
|
|
} |
|
|
|
if (isGaugeType(d.data)) { |
|
|
|
if (isGaugeType(d.data)) { |
|
|
|
var sA = d.startAngle, eA = d.endAngle; |
|
|
|
var sA = d.startAngle, eA = d.endAngle; |
|
|
|
var gMin = __gauge_min, gMax = __gauge_max, |
|
|
|
var gMin = __gauge_min, gMax = __gauge_max, |
|
|
|
gF = Math.abs(gMin)+gMax, fA = Math.abs(sA)+eA, |
|
|
|
gF = Math.abs(gMin) + gMax, fA = Math.abs(sA) + eA, |
|
|
|
aTic = (Math.PI)/gF; |
|
|
|
aTic = (Math.PI) / gF; |
|
|
|
d.startAngle = (-1*(Math.PI/2))+(aTic*Math.abs(gMin)); |
|
|
|
d.startAngle = (-1 * (Math.PI / 2)) + (aTic * Math.abs(gMin)); |
|
|
|
d.endAngle = d.startAngle+(aTic*( (d.value > gMax) ? gMax : d.value )); |
|
|
|
d.endAngle = d.startAngle + (aTic * ((d.value > gMax) ? gMax : d.value )); |
|
|
|
} |
|
|
|
} |
|
|
|
return found ? d : null; |
|
|
|
return found ? d : null; |
|
|
|
} |
|
|
|
} |
|
|
@ -1034,7 +1036,7 @@ |
|
|
|
h = Math.sqrt(x * x + y * y); |
|
|
|
h = Math.sqrt(x * x + y * y); |
|
|
|
// TODO: ratio should be an option?
|
|
|
|
// TODO: ratio should be an option?
|
|
|
|
ratio = (36 / radius > 0.375 ? 1.175 - 36 / radius : 0.8) * radius / h; |
|
|
|
ratio = (36 / radius > 0.375 ? 1.175 - 36 / radius : 0.8) * radius / h; |
|
|
|
translate = __gauge_style == 'arc' ? "translate(1,1)" : "translate(" + (x * ratio) + ',' + (y * ratio) + ")"; |
|
|
|
translate = __gauge_style === 'arc' ? "translate(1,1)" : "translate(" + (x * ratio) + ',' + (y * ratio) + ")"; |
|
|
|
} |
|
|
|
} |
|
|
|
return translate; |
|
|
|
return translate; |
|
|
|
} |
|
|
|
} |
|
|
@ -1957,9 +1959,9 @@ |
|
|
|
function circleX(d) { |
|
|
|
function circleX(d) { |
|
|
|
return d.x || d.x === 0 ? x(d.x) : null; |
|
|
|
return d.x || d.x === 0 ? x(d.x) : null; |
|
|
|
} |
|
|
|
} |
|
|
|
function circleY(d,i) { |
|
|
|
function circleY(d, i) { |
|
|
|
var lineIndices = getLineIndices(), getPoint = generateGetLinePoint(lineIndices); |
|
|
|
var lineIndices = getLineIndices(), getPoint = generateGetLinePoint(lineIndices); |
|
|
|
if (__data_groups.length > 0) { var point = getPoint(d,i); return point[0][1]; } |
|
|
|
if (__data_groups.length > 0) { var point = getPoint(d, i); return point[0][1]; } |
|
|
|
return getYScale(d.id)(d.value); |
|
|
|
return getYScale(d.id)(d.value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2253,8 +2255,8 @@ |
|
|
|
levels = _values; |
|
|
|
levels = _values; |
|
|
|
|
|
|
|
|
|
|
|
return function (value) { |
|
|
|
return function (value) { |
|
|
|
for (var a=1; a<levels.length; a++) { |
|
|
|
for (var a = 1; a < levels.length; a++) { |
|
|
|
if (levels[0] === 'percentage' && ((value/__gauge_max)*100) < levels[a]) { |
|
|
|
if (levels[0] === 'percentage' && ((value / __gauge_max) * 100) < levels[a]) { |
|
|
|
return colors[a-1]; |
|
|
|
return colors[a-1]; |
|
|
|
} |
|
|
|
} |
|
|
|
if (levels[0] === 'whole' && value < levels[a]) { |
|
|
|
if (levels[0] === 'whole' && value < levels[a]) { |
|
|
|