UNPKG

@netdata/charts

Version:

Netdata frontend SDK and chart utilities

19 lines 934 B
import { getUnitConfig, getUnitsString } from "../../helpers/units"; export default (function (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 getUnitConfig(unit).name; return getUnitsString(getUnitConfig(base || unit), prefix, base, _long); }; });