VIPRFormatter.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * Licensed Materials - Property of IBM
  5. * IBM Business Analytics (C) Copyright IBM Corp. 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define(['../../../util/DashboardFormatter'], function (Formatter) {
  9. // implements IFormatter
  10. var VIPRFormatter = function () {
  11. function VIPRFormatter(slotIndex, dataItemIndex, context) {
  12. _classCallCheck(this, VIPRFormatter);
  13. if (context.index.dataItemFormats !== undefined) {
  14. this._format = context.index.dataItemFormats[dataItemIndex];
  15. } else {
  16. var slot = context.dataset.slots[slotIndex];
  17. var dataItem = slot.getDataItemList()[dataItemIndex];
  18. this._format = dataItem.getFormat();
  19. }
  20. }
  21. VIPRFormatter.prototype.getFormat = function getFormat() {
  22. return this._format;
  23. };
  24. VIPRFormatter.prototype.format = function format(value) {
  25. return Formatter.format(value, this._format);
  26. };
  27. return VIPRFormatter;
  28. }();
  29. return VIPRFormatter;
  30. });
  31. //# sourceMappingURL=VIPRFormatter.js.map