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.
71 lines
1.7 KiB
71 lines
1.7 KiB
import { |
|
CLASS, |
|
isValue, |
|
isFunction, |
|
isString, |
|
isUndefined, |
|
isDefined, |
|
ceil10, |
|
asHalfPixel, |
|
diffDomain, |
|
isEmpty, |
|
notEmpty, |
|
getOption, |
|
hasValue, |
|
sanitise, |
|
getPathBox, |
|
ChartInternal |
|
} from '../chartinternal.js'; |
|
|
|
const show = function (targetIds, options) { |
|
let $$ = this.internal, targets; |
|
|
|
targetIds = $$.mapToTargetIds(targetIds); |
|
options = options || {}; |
|
|
|
$$.removeHiddenTargetIds(targetIds); |
|
targets = $$.svg.selectAll($$.selectorTargets(targetIds)); |
|
|
|
targets.transition() |
|
.style('opacity', 1, 'important') |
|
.call($$.endall, () => { |
|
targets.style('opacity', null).style('opacity', 1); |
|
}); |
|
|
|
if (options.withLegend) { |
|
$$.showLegend(targetIds); |
|
} |
|
|
|
$$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true }); |
|
}; |
|
|
|
const hide = function (targetIds, options) { |
|
let $$ = this.internal, targets; |
|
|
|
targetIds = $$.mapToTargetIds(targetIds); |
|
options = options || {}; |
|
|
|
$$.addHiddenTargetIds(targetIds); |
|
targets = $$.svg.selectAll($$.selectorTargets(targetIds)); |
|
|
|
targets.transition() |
|
.style('opacity', 0, 'important') |
|
.call($$.endall, () => { |
|
targets.style('opacity', null).style('opacity', 0); |
|
}); |
|
|
|
if (options.withLegend) { |
|
$$.hideLegend(targetIds); |
|
} |
|
|
|
$$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true }); |
|
}; |
|
|
|
const toggle = function (targetIds, options) { |
|
let that = this, $$ = this.internal; |
|
$$.mapToTargetIds(targetIds).forEach((targetId) => { |
|
$$.isTargetToShow(targetId) ? that.hide(targetId, options) : that.show(targetId, options); |
|
}); |
|
}; |
|
|
|
export { show, hide, toggle };
|
|
|