Commit 6b276cd7 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix conflict

parents fc658310 6ba6ce89
...@@ -249,6 +249,7 @@ ...@@ -249,6 +249,7 @@
// pie // pie
var __pie_label_show = getConfig(['pie', 'label', 'show'], true), var __pie_label_show = getConfig(['pie', 'label', 'show'], true),
__pie_label_format = getConfig(['pie', 'label', 'format']), __pie_label_format = getConfig(['pie', 'label', 'format']),
__pie_label_threshold = getConfig(['pie', 'label', 'threshold'], 0.05),
__pie_expand = getConfig(['pie', 'expand'], true), __pie_expand = getConfig(['pie', 'expand'], true),
__pie_onclick = getConfig(['pie', 'onclick'], function () {}), __pie_onclick = getConfig(['pie', 'onclick'], function () {}),
__pie_onmouseover = getConfig(['pie', 'onmouseover'], function () {}), __pie_onmouseover = getConfig(['pie', 'onmouseover'], function () {}),
...@@ -268,6 +269,7 @@ ...@@ -268,6 +269,7 @@
// donut // donut
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_expand = getConfig(['donut', 'expand'], true), __donut_expand = getConfig(['donut', 'expand'], true),
__donut_title = getConfig(['donut', 'title'], ""), __donut_title = getConfig(['donut', 'title'], ""),
__donut_onclick = getConfig(['donut', 'onclick'], function () {}), __donut_onclick = getConfig(['donut', 'onclick'], function () {}),
...@@ -1044,10 +1046,11 @@ ...@@ -1044,10 +1046,11 @@
} }
function textForArcLabel(d) { function textForArcLabel(d) {
var updated, value, ratio, format; var updated, value, ratio, format;
if (! shouldShowArcLable()) { return ""; } if (! shouldShowArcLabel()) { return ""; }
updated = updateAngle(d); updated = updateAngle(d);
value = updated ? updated.value : null; value = updated ? updated.value : null;
ratio = getArcRatio(updated); ratio = getArcRatio(updated);
if (! meetsArcLabelThreshold(ratio)) { return ""; }
format = getArcLabelFormat(); format = getArcLabelFormat();
return format ? format(value, ratio) : defaultArcValueFormat(value, ratio); return format ? format(value, ratio) : defaultArcValueFormat(value, ratio);
} }
...@@ -1080,7 +1083,7 @@ ...@@ -1080,7 +1083,7 @@
svg.selectAll('.' + CLASS.arc) svg.selectAll('.' + CLASS.arc)
.style("opacity", 1); .style("opacity", 1);
} }
function shouldShowArcLable() { function shouldShowArcLabel() {
var shouldShow = true; var shouldShow = true;
if (hasDonutType(c3.data.targets)) { if (hasDonutType(c3.data.targets)) {
shouldShow = __donut_label_show; shouldShow = __donut_label_show;
...@@ -1090,6 +1093,10 @@ ...@@ -1090,6 +1093,10 @@
// when gauge, always true // when gauge, always true
return shouldShow; return shouldShow;
} }
function meetsArcLabelThreshold(ratio) {
var threshold = hasDonutType(c3.data.targets) ? __donut_label_threshold : __pie_label_threshold;
return ratio >= threshold;
}
function getArcLabelFormat() { function getArcLabelFormat() {
var format = __pie_label_format; var format = __pie_label_format;
if (hasGaugeType(c3.data.targets)) { if (hasGaugeType(c3.data.targets)) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment