UNPKG

@netdata/charts

Version:

Netdata frontend SDK and chart utilities

25 lines (24 loc) 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _units = require("../../helpers/units"); var _default = exports["default"] = function _default(chart) { return chart.getUnitSign = function () { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, dimensionId = _ref.dimensionId, _ref$long = _ref["long"], _long = _ref$long === void 0 ? false : _ref$long, _ref$key = _ref.key, key = _ref$key === void 0 ? "units" : _ref$key, _ref$withoutConversio = _ref.withoutConversion, withoutConversion = _ref$withoutConversio === void 0 ? false : _ref$withoutConversio; var _chart$getUnitAttribu = chart.getUnitAttributes(dimensionId, key), base = _chart$getUnitAttribu.base, prefix = _chart$getUnitAttribu.prefix, unit = _chart$getUnitAttribu.unit; if (withoutConversion) return (0, _units.getUnitConfig)(unit).name; return (0, _units.getUnitsString)((0, _units.getUnitConfig)(base || unit), prefix, base, _long); }; };