Commit 0cf1c6de authored by Masayuki Tanaka's avatar Masayuki Tanaka

Add pie.expand and donut.expand option - #153

parent 602f3775
......@@ -224,6 +224,7 @@
// pie
var __pie_label_show = getConfig(['pie', 'label', 'show'], true),
__pie_label_format = getConfig(['pie', 'label', 'format']),
__pie_expand = getConfig(['pie', 'expand'], true),
__pie_onclick = getConfig(['pie', 'onclick'], function () {}),
__pie_onmouseover = getConfig(['pie', 'onmouseover'], function () {}),
__pie_onmouseout = getConfig(['pie', 'onmouseout'], function () {});
......@@ -231,6 +232,7 @@
// donut
var __donut_label_show = getConfig(['donut', 'label', 'show'], true),
__donut_label_format = getConfig(['donut', 'label', 'format']),
__donut_expand = getConfig(['donut', 'expand'], true),
__donut_title = getConfig(['donut', 'title'], ""),
__donut_onclick = getConfig(['donut', 'onclick'], function () {}),
__donut_onmouseover = getConfig(['donut', 'onmouseover'], function () {}),
......@@ -1047,6 +1049,8 @@
function expandArc(id, withoutFadeOut) {
var target = svg.selectAll('.' + CLASS.chartArc + selectorTarget(id)),
noneTargets = svg.selectAll('.' + CLASS.arc).filter(function (data) { return data.data.id !== id; });
if (shouldExpand(id)) {
target.selectAll('path')
.transition().duration(50)
.attr("d", svgArcExpanded)
......@@ -1057,6 +1061,7 @@
// callback here
}
});
}
if (!withoutFadeOut) {
noneTargets.style("opacity", 0.3);
}
......@@ -1982,6 +1987,10 @@
return isBarType(d) || isLineType(d) ? d.values : [];
}
function shouldExpand(id) {
return (isDonutType(id) && __donut_expand) || (isPieType(id) && __pie_expand);
}
//-- Color --//
function generateColor(colors, pattern, callback) {
......
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