Skip to content

Commit

Permalink
Dim elements outside of Tooltip.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderby committed Mar 28, 2017
1 parent b3c9005 commit 5668c01
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions less/tauCharts.less
Expand Up @@ -269,6 +269,7 @@
}
/* Bar */
&__bar {
opacity: 0.7;
shape-rendering: geometricPrecision;
stroke-opacity: 0.5;
stroke-width: 1;
Expand Down
13 changes: 13 additions & 0 deletions plugins/tooltip.js
Expand Up @@ -184,6 +184,7 @@
window.addEventListener('click', this._outerClickHandler, true);
tooltipNode.classList.add('stuck');
this._setTargetEventsEnabled(false);
this._accentFocus(state.highlight.data);
this._tooltip.updateSize();
} else {
window.removeEventListener('click', this._outerClickHandler, true);
Expand Down Expand Up @@ -323,6 +324,18 @@
return meta.label;
},

_accentFocus: function (data) {
var filter = function (d) {
return (d === data);
};
this._chart
.select(function () {
return true;
}).forEach(function (unit) {
unit.fire('highlight', filter);
});
},

_removeFocus: function () {
var filter = function () {
return null;
Expand Down
1 change: 0 additions & 1 deletion src/elements/element.interval.js
Expand Up @@ -120,7 +120,6 @@ const Interval = {
const createFilter = ((data, falsy) => ((row) => row === data ? true : falsy));
node.on('highlight', (sender, filter) => this.highlight(filter));
node.on('data-hover', ((sender, e) => this.highlight(createFilter(e.data, null))));
node.on('data-click', ((sender, e) => this.highlight(createFilter(e.data, e.data ? false : null))));
},

draw() {
Expand Down
1 change: 0 additions & 1 deletion src/elements/element.path.base.js
Expand Up @@ -150,7 +150,6 @@ const BasePath = {
node.on('highlight-data-points', (sender, filter) => this.highlightDataPoints(filter));
if (config.guide.showAnchors !== 'never') {
node.on('data-hover', ((sender, e) => this.highlightDataPoints(createFilter(e.data, null))));
node.on('data-click', ((sender, e) => this.highlight(createFilter(e.data, e.data ? false : null))));
}
},

Expand Down
1 change: 0 additions & 1 deletion src/elements/element.point.js
Expand Up @@ -102,7 +102,6 @@ const Point = {
const createFilter = ((data, falsy) => ((row) => row === data ? true : falsy));
node.on('highlight', (sender, filter) => this.highlight(filter));
node.on('data-hover', ((sender, e) => this.highlight(createFilter(e.data, null))));
node.on('data-click', ((sender, e) => this.highlight(createFilter(e.data, e.data ? false : null))));
},

draw() {
Expand Down

0 comments on commit 5668c01

Please sign in to comment.