![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/libs/absol-full/dist/js/ |
Upload File : |
/*** module: node_modules/absol-vchart/src/ColumnChart.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _VCore = _interopRequireDefault(require("./VCore")); var _helper = require("./helper"); var _template = require("./template"); var _OOP = _interopRequireDefault(require("absol/src/HTML5/OOP")); var _VerticalChart = _interopRequireDefault(require("./VerticalChart")); var _ = _VCore.default._; var $ = _VCore.default.$; /*** * * @returns {VerticalChart} * @constructor */ function ColumnChart() { _VerticalChart.default.call(this); this.values = []; this.$columnCtn = _('gcontainer.vc-column-ctn'); this.$oxySpace.addChild(this.$columnCtn); if (!this.numberToString) this.numberToString = function (value) { return numberToString.apply(this, arguments); }; } ColumnChart.property = Object.assign({}, _VerticalChart.default.property); ColumnChart.eventHandler = Object.assign({}, _VerticalChart.default.eventHandler); _OOP.default.mixClass(ColumnChart, _VerticalChart.default); ColumnChart.tag = 'ColumnChart'.toLowerCase(); ColumnChart.render = function () { return _VerticalChart.default.render().addClass('vc-column-chart'); }; ColumnChart.prototype.dataKeys = _VerticalChart.default.prototype.dataKeys.concat(['values', 'oxColWidth']); ColumnChart.prototype.computeMinMax = function () { this.computedData.min = this.values.filter(_helper.isNumber).reduce(function (ac, cr) { return Math.min(ac, cr); }, 1000000000); this.computedData.max = this.values.filter(_helper.isNumber).reduce(function (ac, cr) { return Math.max(ac, cr); }, -1000000000); }; ColumnChart.prototype.createContent = function () { _VerticalChart.default.prototype.createContent.call(this); this._createColumns(); }; ColumnChart.prototype._createColumn = function (value, i, color) { var res = _('gcontainer.vc-column'); res.$rect = (0, _helper.rect)(-this.oxColWidth / 2, 0, this.oxColWidth, 10).addTo(res); if (value === 0) { res.addClass('vc-value-zero'); } res.$value = (0, _helper.text)(this.numberToString(value) + '', 0, 0).attr('text-anchor', 'middle').addTo(res); if (color) { res.$rect.addStyle('fill', color); } return res; }; ColumnChart.prototype._createColumns = function () { this.$columnCtn.clearChild(); this.$columnes = this.values.map(function (value, i) { return this._createColumn(value, i, this.columnColors && this.columnColors[i]).addTo(this.$columnCtn); }.bind(this)); }; ColumnChart.prototype.updateBodyPosition = function () { _VerticalChart.default.prototype.updateBodyPosition.call(this); this._updateColumnPosition(); }; ColumnChart.prototype._updateColumnPosition = function () { this.$columnes.forEach(function ($column, i) { if ((0, _helper.isNumber)(this.values[i])) { $column.removeStyle('display'); var height = this.mapOYValue(this.values[i]); // x: (i + 0.5) * this.oxSegmentLength - this.columnWidth / 2 $column.$rect.attr({ height: height, y: -height }); $column.$value.attr('y', -height - 4); $column.attr({ transform: (0, _template.translate)((i + 0.5) * this.computedData.oxSegmentLength, 0) }); } else { $column.addStyle('display', 'none'); } }.bind(this)); }; _VCore.default.install(ColumnChart); var _default = ColumnChart; exports.default = _default;