Browse Source

Add donut.width and remove donut.radius.inner

pull/452/head
Masayuki Tanaka 10 years ago
parent
commit
fb34590979
  1. 18
      c3.js
  2. 4
      c3.min.js
  3. 4
      htdocs/samples/chart_donut.html

18
c3.js

@ -282,7 +282,7 @@
var __donut_label_show = getConfig(['donut', 'label', 'show'], true), var __donut_label_show = getConfig(['donut', 'label', 'show'], true),
__donut_label_format = getConfig(['donut', 'label', 'format']), __donut_label_format = getConfig(['donut', 'label', 'format']),
__donut_label_threshold = getConfig(['donut', 'label', 'threshold'], 0.05), __donut_label_threshold = getConfig(['donut', 'label', 'threshold'], 0.05),
__donut_radius_inner = getConfig(['donut', 'radius', 'inner']), __donut_width = getConfig(['donut', 'width']),
__donut_sort = getConfig(['donut', 'sort'], true), __donut_sort = getConfig(['donut', 'sort'], true),
__donut_expand = getConfig(['donut', 'expand'], true), __donut_expand = getConfig(['donut', 'expand'], true),
__donut_title = getConfig(['donut', 'title'], ""); __donut_title = getConfig(['donut', 'title'], "");
@ -530,21 +530,11 @@
.attr("y2", __axis_rotated ? -10 : height); .attr("y2", __axis_rotated ? -10 : height);
} }
function updateRadius() { function updateRadius() {
var innerRadiusRatio; var innerRadiusRatio, w = __gauge_width || __donut_width;
radiusExpanded = Math.min(arcWidth, arcHeight) / 2; radiusExpanded = Math.min(arcWidth, arcHeight) / 2;
radius = radiusExpanded * 0.95; radius = radiusExpanded * 0.95;
innerRadiusRatio = __gauge_width ? (radius - __gauge_width) / radius : 0.6; innerRadiusRatio = w ? (radius - w) / radius : 0.6;
if (hasDonutType(c3.data.targets) || hasGaugeType(c3.data.targets)) { innerRadius = hasDonutType(c3.data.targets) || hasGaugeType(c3.data.targets) ? radius * innerRadiusRatio : 0;
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() { function getSvgLeft() {
var leftAxisClass = __axis_rotated ? CLASS.axisX : CLASS.axisY, var leftAxisClass = __axis_rotated ? CLASS.axisX : CLASS.axisY,

4
c3.min.js vendored

File diff suppressed because one or more lines are too long

4
htdocs/samples/chart_donut.html

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

Loading…
Cancel
Save