mirror of https://github.com/masayuki0812/c3.git
Quite good looking graph derived from d3.js
http://c3js.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.8 KiB
51 lines
1.8 KiB
11 years ago
|
c3_chart_fn.focus = function (targetId) {
|
||
|
var $$ = this.internal,
|
||
|
candidates = $$.svg.selectAll($$.selectorTarget(targetId)),
|
||
|
candidatesForNoneArc = candidates.filter($$.isNoneArc.bind($$)),
|
||
|
candidatesForArc = candidates.filter($$.isArc.bind($$));
|
||
|
function focus(targets) {
|
||
|
$$.filterTargetsToShow(targets).transition().duration(100).style('opacity', 1);
|
||
|
}
|
||
|
this.revert();
|
||
|
this.defocus();
|
||
|
focus(candidatesForNoneArc.classed(CLASS[_focused], true));
|
||
|
focus(candidatesForArc);
|
||
|
if ($$.hasArcType()) {
|
||
|
$$.expandArc(targetId, true);
|
||
|
}
|
||
|
$$.toggleFocusLegend(targetId, true);
|
||
|
};
|
||
|
|
||
|
c3_chart_fn.defocus = function (targetId) {
|
||
|
var $$ = this.internal,
|
||
|
candidates = $$.svg.selectAll($$.selectorTarget(targetId)),
|
||
|
candidatesForNoneArc = candidates.filter($$.isNoneArc.bind($$)),
|
||
|
candidatesForArc = candidates.filter($$.isArc.bind($$));
|
||
|
function defocus(targets) {
|
||
|
$$.filterTargetsToShow(targets).transition().duration(100).style('opacity', 0.3);
|
||
|
}
|
||
|
this.revert();
|
||
|
defocus(candidatesForNoneArc.classed(CLASS[_focused], false));
|
||
|
defocus(candidatesForArc);
|
||
|
if ($$.hasArcType()) {
|
||
|
$$.unexpandArc(targetId);
|
||
|
}
|
||
|
$$.toggleFocusLegend(targetId, false);
|
||
|
};
|
||
|
|
||
|
c3_chart_fn.revert = function (targetId) {
|
||
|
var $$ = this.internal,
|
||
|
candidates = $$.svg.selectAll($$.selectorTarget(targetId)),
|
||
|
candidatesForNoneArc = candidates.filter($$.isNoneArc.bind($$)),
|
||
|
candidatesForArc = candidates.filter($$.isArc.bind($$));
|
||
|
function revert(targets) {
|
||
|
$$.filterTargetsToShow(targets).transition().duration(100).style('opacity', 1);
|
||
|
}
|
||
|
revert(candidatesForNoneArc.classed(CLASS[_focused], false));
|
||
|
revert(candidatesForArc);
|
||
|
if ($$.hasArcType()) {
|
||
|
$$.unexpandArc(targetId);
|
||
|
}
|
||
|
$$.revertLegend();
|
||
|
};
|