Browse Source

Add same option to donuts

pull/1675/head
GermainBergeron 9 years ago committed by Ændrew Rininsland
parent
commit
2dc3d60211
  1. 4
      src/arc.js
  2. 1
      src/config.js

4
src/arc.js

@ -94,7 +94,9 @@ c3_chart_internal_fn.transformForArcLabel = function (d) {
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);
if (config.pie_label_ratio) { if ($$.hasType('donut') && config.donut_label_ratio) {
ratio = isFunction(config.donut_label_ratio) ? config.donut_label_ratio(d, $$.radius, h) : config.donut_label_ratio;
} else if ($$.hasType('pie') && config.pie_label_ratio) {
ratio = isFunction(config.pie_label_ratio) ? config.pie_label_ratio(d, $$.radius, h) : config.pie_label_ratio; ratio = isFunction(config.pie_label_ratio) ? config.pie_label_ratio(d, $$.radius, h) : config.pie_label_ratio;
} else { } else {
ratio = $$.radius && h ? (36 / $$.radius > 0.375 ? 1.175 - 36 / $$.radius : 0.8) * $$.radius / h : 0; ratio = $$.radius && h ? (36 / $$.radius > 0.375 ? 1.175 - 36 / $$.radius : 0.8) * $$.radius / h : 0;

1
src/config.js

@ -190,6 +190,7 @@ c3_chart_internal_fn.getDefaultConfig = function () {
donut_label_show: true, donut_label_show: true,
donut_label_format: undefined, donut_label_format: undefined,
donut_label_threshold: 0.05, donut_label_threshold: 0.05,
donut_label_ratio: undefined,
donut_width: undefined, donut_width: undefined,
donut_title: "", donut_title: "",
donut_expand: {}, donut_expand: {},

Loading…
Cancel
Save