1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 'use strict';
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: BI Dashboard
- *| (C) Copyright IBM Corp. 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define(['./VisQueryPostProcessor', 'underscore'], function (VisQueryPostprocessor, _) {
- 'use strict';
- /**
- * This Class does Query result response post-processing for extracting and overwriting the axis label with the autobin caption correctly
- **/
- var PostprocessorClass = VisQueryPostprocessor.extend({
- /**
- * @Constructor
- * @param {Object} options
- */
- init: function init(options) {
- PostprocessorClass.inherited('init', this, arguments);
- this.mappingAPI = options.mappingAPI;
- this.slotAPI = this.mappingAPI.getSlotAPIs()[0];
- this.visAPI = options.visAPI;
- this.dataItems = this._queryResultData.dataItems;
- },
- /**
- * Rewrites the axis label for the non-cont/non measure slot axis
- * and corrects it to be the correct auto bin caption
- * if autobinning is turned on
- *
- * @return {QueryResultData}
- */
- _processData: function _processData() {
- var _this = this;
- _.each(this.dataItems, function (dataItem, key, memo) {
- // check if non-cont/measure
- if (dataItem.items && dataItem.items.length) {
- _.each(dataItem.itemClass.h, function (h) {
- var curItemId = h.u; // this is datasetName.label, used for finding
- var newLabel = _this.slotAPI.getAutobinCaption(curItemId);
- if (newLabel) {
- h.d = newLabel;
- }
- });
- }
- memo[key] = dataItem;
- });
- //Process Done
- return this._queryResultData;
- }
- });
- return PostprocessorClass;
- });
- //# sourceMappingURL=PostProcessAutobinningAxisLabels.js.map
|