Browse Source

Add donut.radius.inner option

pull/452/head
Masayuki Tanaka 10 years ago
parent
commit
1a8d59b602
  1. 13
      c3.js
  2. 6
      c3.min.js
  3. 3
      htdocs/samples/chart_donut.html

13
c3.js

@ -282,6 +282,7 @@
var __donut_label_show = getConfig(['donut', 'label', 'show'], true),
__donut_label_format = getConfig(['donut', 'label', 'format']),
__donut_label_threshold = getConfig(['donut', 'label', 'threshold'], 0.05),
__donut_radius_inner = getConfig(['donut', 'radius', 'inner']),
__donut_sort = getConfig(['donut', 'sort'], true),
__donut_expand = getConfig(['donut', 'expand'], true),
__donut_title = getConfig(['donut', 'title'], "");
@ -533,7 +534,17 @@
radiusExpanded = Math.min(arcWidth, arcHeight) / 2;
radius = radiusExpanded * 0.95;
innerRadiusRatio = __gauge_width ? (radius - __gauge_width) / radius : 0.6;
innerRadius = hasDonutType(c3.data.targets) || hasGaugeType(c3.data.targets) ? radius * innerRadiusRatio : 0;
if (hasDonutType(c3.data.targets) || hasGaugeType(c3.data.targets)) {
if (typeof __donut_radius_inner === 'function') {
innerRadius = __donut_radius_inner(radius, innerRadiusRatio);
} else if (__donut_radius_inner) {
innerRadius = __donut_radius_inner;
} else {
innerRadius = radius * innerRadiusRatio;
}
} else {
innerRadius = 0;
}
}
function getSvgLeft() {
var leftAxisClass = __axis_rotated ? CLASS.axisX : CLASS.axisY,

6
c3.min.js vendored

File diff suppressed because one or more lines are too long

3
htdocs/samples/chart_donut.html

@ -36,6 +36,9 @@
// format: function (d, ratio) { return ""; }
},
title: "Iris Petal Width",
radius: {
inner: 60
}
}
});

Loading…
Cancel
Save