Browse Source

refactor: refactor data methods (#2481)

pull/2489/head
Yoshiya Hinosawa 6 years ago committed by GitHub
parent
commit
0fde1b0320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      src/data.js
  2. 2
      src/interaction.js

22
src/data.js

@ -307,12 +307,24 @@ ChartInternal.prototype.getDataLabelLength = function (min, max, key) {
.remove();
return lengths;
};
/**
* Returns true if the given data point is not arc type, otherwise false.
* @param {Object} d The data point
* @return {boolean}
*/
ChartInternal.prototype.isNoneArc = function (d) {
return this.hasTarget(this.data.targets, d.id);
},
ChartInternal.prototype.isArc = function (d) {
return 'data' in d && this.hasTarget(this.data.targets, d.data.id);
};
return this.hasTarget(this.data.targets, d.id);
};
/**
* Returns true if the given data point is arc type, otherwise false.
* @param {Object} d The data point
* @return {boolean}
*/
ChartInternal.prototype.isArc = function (d) {
return 'data' in d && this.hasTarget(this.data.targets, d.data.id);
};
ChartInternal.prototype.findClosestFromTargets = function (targets, pos) {
var $$ = this,
candidates;

2
src/interaction.js

@ -68,7 +68,7 @@ ChartInternal.prototype.redrawEventRect = function () {
$$.mouseover = undefined;
}
if (! closest) {
if (!closest) {
mouseout();
return;
}

Loading…
Cancel
Save