|
|
@ -87,15 +87,18 @@ c3_chart_internal_fn.getArc = function (d, withoutUpdate, force) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c3_chart_internal_fn.transformForArcLabel = function (d) { |
|
|
|
c3_chart_internal_fn.transformForArcLabel = function (d) { |
|
|
|
var $$ = this, |
|
|
|
var $$ = this, config = $$.config, |
|
|
|
updated = $$.updateAngle(d), c, x, y, h, ratio, translate = ""; |
|
|
|
updated = $$.updateAngle(d), c, x, y, h, ratio, translate = ""; |
|
|
|
if (updated && !$$.hasType('gauge')) { |
|
|
|
if (updated && !$$.hasType('gauge')) { |
|
|
|
c = this.svgArc.centroid(updated); |
|
|
|
c = this.svgArc.centroid(updated); |
|
|
|
x = isNaN(c[0]) ? 0 : c[0]; |
|
|
|
x = isNaN(c[0]) ? 0 : c[0]; |
|
|
|
y = isNaN(c[1]) ? 0 : c[1]; |
|
|
|
y = isNaN(c[1]) ? 0 : c[1]; |
|
|
|
h = Math.sqrt(x * x + y * y); |
|
|
|
h = Math.sqrt(x * x + y * y); |
|
|
|
// TODO: ratio should be an option?
|
|
|
|
if (config.pie_label_ratio) { |
|
|
|
ratio = $$.radius && h ? (36 / $$.radius > 0.375 ? 1.175 - 36 / $$.radius : 0.8) * $$.radius / h : 0; |
|
|
|
ratio = isFunction(config.pie_label_ratio) ? config.pie_label_ratio(d, $$.radius, h) : config.pie_label_ratio; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ratio = $$.radius && h ? (36 / $$.radius > 0.375 ? 1.175 - 36 / $$.radius : 0.8) * $$.radius / h : 0; |
|
|
|
|
|
|
|
} |
|
|
|
translate = "translate(" + (x * ratio) + ',' + (y * ratio) + ")"; |
|
|
|
translate = "translate(" + (x * ratio) + ',' + (y * ratio) + ")"; |
|
|
|
} |
|
|
|
} |
|
|
|
return translate; |
|
|
|
return translate; |
|
|
|