VIPRCatContDataItem.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5. /**
  6. * Licensed Materials - Property of IBM
  7. * IBM Business Analytics (C) Copyright IBM Corp. 2019
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. define(['underscore', './VIPRCatDataItem', './VIPRFormatter'], function (_, VIPRCatDataItem, VIPRFormatter) {
  11. // implements ICatDataItem based on a continuous data item
  12. var VIPRCatContDataItem = function (_VIPRCatDataItem) {
  13. _inherits(VIPRCatContDataItem, _VIPRCatDataItem);
  14. function VIPRCatContDataItem(resultItem, context) {
  15. _classCallCheck(this, VIPRCatContDataItem);
  16. var _this = _possibleConstructorReturn(this, _VIPRCatDataItem.call(this, resultItem, context));
  17. _this.formatter = new VIPRFormatter(_this.context.index.dataitem, 0, _this.context);
  18. _this.postProcessing();
  19. return _this;
  20. }
  21. VIPRCatContDataItem.prototype.getType = function getType() {
  22. return 'cont';
  23. };
  24. VIPRCatContDataItem.prototype.getFormatter = function getFormatter() {
  25. return this.formatter;
  26. };
  27. VIPRCatContDataItem.prototype.postProcessing = function postProcessing() {
  28. var index = this.context.index.dataitem;
  29. var subType = this.dataset.slots[index].getDefinition().getSubType();
  30. if (subType && subType === 'latitude' || subType === 'longitude') {
  31. for (var _index = 0; _index < this.resultItem.getRowCount(); _index++) {
  32. var row = this.resultItem.getValue(_index);
  33. if (row[0].hasOwnProperty('label') && row[0].hasOwnProperty('value') && row[0].label !== row[0].value) {
  34. row[0].value = row[0].label;
  35. }
  36. }
  37. }
  38. };
  39. VIPRCatContDataItem.prototype.getItemClass = function getItemClass() {
  40. return null;
  41. };
  42. VIPRCatContDataItem.prototype.getDomain = function getDomain() {
  43. return null;
  44. };
  45. return VIPRCatContDataItem;
  46. }(VIPRCatDataItem);
  47. return VIPRCatContDataItem;
  48. });
  49. //# sourceMappingURL=VIPRCatContDataItem.js.map