Carga
Carga
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
/* *
|
||||
*
|
||||
* (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. !!!!!!!
|
||||
*
|
||||
* */
|
||||
'use strict';
|
||||
/* *
|
||||
*
|
||||
* Class
|
||||
*
|
||||
* */
|
||||
var TreemapAlgorithmGroup = /** @class */ (function () {
|
||||
/* *
|
||||
*
|
||||
* Constructor
|
||||
*
|
||||
* */
|
||||
function TreemapAlgorithmGroup(h, w, d, p) {
|
||||
this.height = h;
|
||||
this.width = w;
|
||||
this.plot = p;
|
||||
this.direction = d;
|
||||
this.startDirection = d;
|
||||
this.total = 0;
|
||||
this.nW = 0;
|
||||
this.lW = 0;
|
||||
this.nH = 0;
|
||||
this.lH = 0;
|
||||
this.elArr = [];
|
||||
this.lP = {
|
||||
total: 0,
|
||||
lH: 0,
|
||||
nH: 0,
|
||||
lW: 0,
|
||||
nW: 0,
|
||||
nR: 0,
|
||||
lR: 0,
|
||||
aspectRatio: function (w, h) {
|
||||
return Math.max((w / h), (h / w));
|
||||
}
|
||||
};
|
||||
}
|
||||
/* *
|
||||
*
|
||||
* Functions
|
||||
*
|
||||
* */
|
||||
/* eslint-disable valid-jsdoc */
|
||||
TreemapAlgorithmGroup.prototype.addElement = function (el) {
|
||||
this.lP.total = this.elArr[this.elArr.length - 1];
|
||||
this.total = this.total + el;
|
||||
if (this.direction === 0) {
|
||||
// Calculate last point old aspect ratio
|
||||
this.lW = this.nW;
|
||||
this.lP.lH = this.lP.total / this.lW;
|
||||
this.lP.lR = this.lP.aspectRatio(this.lW, this.lP.lH);
|
||||
// Calculate last point new aspect ratio
|
||||
this.nW = this.total / this.height;
|
||||
this.lP.nH = this.lP.total / this.nW;
|
||||
this.lP.nR = this.lP.aspectRatio(this.nW, this.lP.nH);
|
||||
}
|
||||
else {
|
||||
// Calculate last point old aspect ratio
|
||||
this.lH = this.nH;
|
||||
this.lP.lW = this.lP.total / this.lH;
|
||||
this.lP.lR = this.lP.aspectRatio(this.lP.lW, this.lH);
|
||||
// Calculate last point new aspect ratio
|
||||
this.nH = this.total / this.width;
|
||||
this.lP.nW = this.lP.total / this.nH;
|
||||
this.lP.nR = this.lP.aspectRatio(this.lP.nW, this.nH);
|
||||
}
|
||||
this.elArr.push(el);
|
||||
};
|
||||
TreemapAlgorithmGroup.prototype.reset = function () {
|
||||
this.nW = 0;
|
||||
this.lW = 0;
|
||||
this.elArr = [];
|
||||
this.total = 0;
|
||||
};
|
||||
return TreemapAlgorithmGroup;
|
||||
}());
|
||||
/* *
|
||||
*
|
||||
* Default Export
|
||||
*
|
||||
* */
|
||||
export default TreemapAlgorithmGroup;
|
||||
@@ -0,0 +1,58 @@
|
||||
/* *
|
||||
*
|
||||
* (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. !!!!!!!
|
||||
*
|
||||
* */
|
||||
'use strict';
|
||||
/* *
|
||||
*
|
||||
* Imports
|
||||
*
|
||||
* */
|
||||
import SeriesRegistry from '../../Core/Series/SeriesRegistry.js';
|
||||
var Series = SeriesRegistry.series;
|
||||
import TreemapUtilities from './TreemapUtilities.js';
|
||||
import U from '../../Core/Utilities.js';
|
||||
var addEvent = U.addEvent, extend = U.extend;
|
||||
/* *
|
||||
*
|
||||
* Composition
|
||||
*
|
||||
* */
|
||||
var treemapAxisDefaultValues = false;
|
||||
addEvent(Series, 'afterBindAxes', function () {
|
||||
// eslint-disable-next-line no-invalid-this
|
||||
var series = this, xAxis = series.xAxis, yAxis = series.yAxis, treeAxis;
|
||||
if (xAxis && yAxis) {
|
||||
if (series.is('treemap')) {
|
||||
treeAxis = {
|
||||
endOnTick: false,
|
||||
gridLineWidth: 0,
|
||||
lineWidth: 0,
|
||||
min: 0,
|
||||
// dataMin: 0,
|
||||
minPadding: 0,
|
||||
max: TreemapUtilities.AXIS_MAX,
|
||||
// dataMax: TreemapUtilities.AXIS_MAX,
|
||||
maxPadding: 0,
|
||||
startOnTick: false,
|
||||
title: void 0,
|
||||
tickPositions: []
|
||||
};
|
||||
extend(yAxis.options, treeAxis);
|
||||
extend(xAxis.options, treeAxis);
|
||||
treemapAxisDefaultValues = true;
|
||||
}
|
||||
else if (treemapAxisDefaultValues) {
|
||||
yAxis.setOptions(yAxis.userOptions);
|
||||
xAxis.setOptions(xAxis.userOptions);
|
||||
treemapAxisDefaultValues = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,111 @@
|
||||
/* *
|
||||
*
|
||||
* (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. !!!!!!!
|
||||
*
|
||||
* */
|
||||
'use strict';
|
||||
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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
import DPU from '../DrawPointUtilities.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.draw = function (params) {
|
||||
DPU.draw(this, params);
|
||||
};
|
||||
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 DPU.shouldDraw(this);
|
||||
};
|
||||
return TreemapPoint;
|
||||
}(ScatterPoint));
|
||||
extend(TreemapPoint.prototype, {
|
||||
setVisible: PiePoint.prototype.setVisible
|
||||
});
|
||||
/* *
|
||||
*
|
||||
* Default Export
|
||||
*
|
||||
* */
|
||||
export default TreemapPoint;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,65 @@
|
||||
/* *
|
||||
*
|
||||
* (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. !!!!!!!
|
||||
*
|
||||
* */
|
||||
'use strict';
|
||||
/* *
|
||||
*
|
||||
* Imports
|
||||
*
|
||||
* */
|
||||
import U from '../../Core/Utilities.js';
|
||||
var objectEach = U.objectEach;
|
||||
/* *
|
||||
*
|
||||
* Namespace
|
||||
*
|
||||
* */
|
||||
var TreemapUtilities;
|
||||
(function (TreemapUtilities) {
|
||||
TreemapUtilities.AXIS_MAX = 100;
|
||||
/* eslint-disable no-invalid-this, valid-jsdoc */
|
||||
/**
|
||||
* @todo Similar to eachObject, this function is likely redundant
|
||||
*/
|
||||
function isBoolean(x) {
|
||||
return typeof x === 'boolean';
|
||||
}
|
||||
TreemapUtilities.isBoolean = isBoolean;
|
||||
/**
|
||||
* @todo Similar to recursive, this function is likely redundant
|
||||
*/
|
||||
function eachObject(list, func, context) {
|
||||
context = context || this;
|
||||
objectEach(list, function (val, key) {
|
||||
func.call(context, val, key, list);
|
||||
});
|
||||
}
|
||||
TreemapUtilities.eachObject = eachObject;
|
||||
/**
|
||||
* @todo find correct name for this function.
|
||||
* @todo Similar to reduce, this function is likely redundant
|
||||
*/
|
||||
function recursive(item, func, context) {
|
||||
if (context === void 0) { context = this; }
|
||||
var next;
|
||||
next = func.call(context, item);
|
||||
if (next !== false) {
|
||||
recursive(next, func, context);
|
||||
}
|
||||
}
|
||||
TreemapUtilities.recursive = recursive;
|
||||
})(TreemapUtilities || (TreemapUtilities = {}));
|
||||
/* *
|
||||
*
|
||||
* Default Export
|
||||
*
|
||||
* */
|
||||
export default TreemapUtilities;
|
||||
Reference in New Issue
Block a user