VIPRData.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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, 2020
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. define(['underscore', './VIPRDecoratable', './VIPRDataSet'], function (_, VIPRDecoratable, VIPRDataSet) {
  11. var VIPRData = function (_VIPRDecoratable) {
  12. _inherits(VIPRData, _VIPRDecoratable);
  13. /**
  14. * @param {Object[]} queryResults
  15. */
  16. function VIPRData(queryResults, visualization, hideAggTypeInAxisLabels, content) {
  17. _classCallCheck(this, VIPRData);
  18. var _this = _possibleConstructorReturn(this, _VIPRDecoratable.call(this));
  19. _this.context = {
  20. version: 0,
  21. VIPRData: _this,
  22. hideAggTypeInAxisLabels: hideAggTypeInAxisLabels
  23. };
  24. _this._aVIPRDataSets = [];
  25. var mappedSlots = visualization.getSlots().getMappedSlotList();
  26. var datasetIds = visualization.getDefinition().getDatasetList().map(function (dataset) {
  27. return dataset.id;
  28. });
  29. _.each(datasetIds, function (datasetId) {
  30. var slots = _.filter(mappedSlots, function (slot) {
  31. return slot.getDefinition().getDatasetIdList().indexOf(datasetId) !== -1;
  32. });
  33. var queryResult = queryResults.getResult(datasetId);
  34. if (queryResult) {
  35. var minmaxResult = queryResults.getResult(datasetId, queryResults.QUERY_RESULT_TYPE.MINMAX);
  36. if (minmaxResult) {
  37. this.context.minmaxResult = minmaxResult;
  38. }
  39. this._aVIPRDataSets.push(new VIPRDataSet(datasetId, queryResult, slots, this.context, content));
  40. } else {
  41. this._aVIPRDataSets.push(null);
  42. }
  43. }.bind(_this));
  44. return _this;
  45. }
  46. VIPRData.prototype.getDataSetAt = function getDataSetAt(index) {
  47. return this._aVIPRDataSets[index];
  48. };
  49. VIPRData.prototype.getDataSetCount = function getDataSetCount() {
  50. return this._aVIPRDataSets.length;
  51. };
  52. VIPRData.prototype.getDecorationsVersion = function getDecorationsVersion() {
  53. return this.context.version;
  54. };
  55. return VIPRData;
  56. }(VIPRDecoratable);
  57. return VIPRData;
  58. });
  59. //# sourceMappingURL=VIPRData.js.map