highcharts
Version:
JavaScript charting framework
108 lines (107 loc) • 3.43 kB
JavaScript
/* *
*
* (c) 2014-2021 Highsoft AS
*
* Authors: Jon Arild Nygard / Oystein Moseng
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import DrawPointMixin from '../../Mixins/DrawPoint.js';
import SeriesRegistry from '../../Core/Series/SeriesRegistry.js';
var Point = SeriesRegistry.series.prototype.pointClass, _a = SeriesRegistry.seriesTypes, PiePoint = _a.pie.prototype.pointClass, ScatterPoint = _a.scatter.prototype.pointClass;
import U from '../../Core/Utilities.js';
var extend = U.extend, isNumber = U.isNumber, pick = U.pick;
/* *
*
* Class
*
* */
var TreemapPoint = /** @class */ (function (_super) {
__extends(TreemapPoint, _super);
function TreemapPoint() {
/* *
*
* Properties
*
* */
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.name = void 0;
_this.node = void 0;
_this.options = void 0;
_this.series = void 0;
_this.value = void 0;
return _this;
/* eslint-enable valid-jsdoc */
}
/* *
*
* Functions
*
* */
/* eslint-disable valid-jsdoc */
TreemapPoint.prototype.getClassName = function () {
var className = Point.prototype.getClassName.call(this), series = this.series, options = series.options;
// Above the current level
if (this.node.level <= series.nodeMap[series.rootNode].level) {
className += ' highcharts-above-level';
}
else if (!this.node.isLeaf &&
!pick(options.interactByLeaf, !options.allowTraversingTree)) {
className += ' highcharts-internal-node-interactive';
}
else if (!this.node.isLeaf) {
className += ' highcharts-internal-node';
}
return className;
};
/**
* A tree point is valid if it has han id too, assume it may be a parent
* item.
*
* @private
* @function Highcharts.Point#isValid
*/
TreemapPoint.prototype.isValid = function () {
return Boolean(this.id || isNumber(this.value));
};
TreemapPoint.prototype.setState = function (state) {
Point.prototype.setState.call(this, state);
// Graphic does not exist when point is not visible.
if (this.graphic) {
this.graphic.attr({
zIndex: state === 'hover' ? 1 : 0
});
}
};
TreemapPoint.prototype.shouldDraw = function () {
return isNumber(this.plotY) && this.y !== null;
};
return TreemapPoint;
}(ScatterPoint));
extend(TreemapPoint.prototype, {
draw: DrawPointMixin.drawPoint,
setVisible: PiePoint.prototype.setVisible
});
/* *
*
* Default Export
*
* */
export default TreemapPoint;