'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Business Analytics (C) Copyright IBM Corp. 2018, 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /** * @interface VisualizationAPI * @classdesc API class that is used to control visualizations. * @example content.getFeature('Visualization') */ define([], function () { var VisualizationAPI = function () { function VisualizationAPI() { _classCallCheck(this, VisualizationAPI); } /** * @description Registers a visualization event handler. * @function VisualizationAPI#on * @private * * @param {String} name Event name * @param {Function} name Event handler * @return Object that has a remove function that removes the event handler. */ VisualizationAPI.prototype.on = function on() {}; /** * @description Deregisters a visualization event handler. * @function VisualizationAPI#off * @private * * @param {String} name Event name * @param {Function} name Event handler * */ VisualizationAPI.prototype.off = function off() {}; /** * @description Returns the data source used by the visualization. * @function VisualizationAPI#getDataSource * @private * * @return DataSourceAPI */ VisualizationAPI.prototype.getDataSource = function getDataSource() {}; /** * @description Sets the data source to be used by the visualization. * @function VisualizationAPI#setDataSource * @private * * @param {String} datasourceId Unique data source identifier * @return {Promise} */ VisualizationAPI.prototype.setDataSource = function setDataSource() /* datasourceId */{}; /** * @description Gets an array of MetadataColumnAPI objects that are used in the visualization. * @function VisualizationAPI#getUsedMetadataColumnList * @private * * @return {MetadataColumnAPI[]} */ VisualizationAPI.prototype.getUsedMetadataColumnList = function getUsedMetadataColumnList() {}; /** * @description Returns the slots interface, which can be used to get and set information about the slots and data mappings in the visualization. * @function VisualizationAPI#getSlots * @public * * @return {SlotsAPI} Slots object * */ VisualizationAPI.prototype.getSlots = function getSlots() {}; /** * @description Returns the visulization type that is being used. * @function VisualizationAPI#getType * @public * * @returns {String} Type (e.g. Bar, Area, etc) * @example * // will return the string 'Bar' * visualization.getType() * */ VisualizationAPI.prototype.getType = function getType() {}; /** * @description Returns true if the widget matches the spec provided in the parameter. * We currently only support matches with a spec that has only a visId and localFilters. * Anything else will cause an error. * * @function VisualizationAPI#matches * @private * * @returns {{visId: String, localFilters: Object}} Spec object to match. For more info about the content, refer to the visualization specification * @example * * visualization.matches({ * "visId": "com.ibm.vis.rave2bundlecolumn", * "localFilters": [{ * "id": "banking.Business", * "columnId": "banking.Business", * "values": [ * { * "d": "Corporate Finance", * "u": "Corporate Finance" * }, * { * "d": "Retail Banking", * "u": "Retail Banking" * } * ], * "excludedValues": [], * "operator": "notin", * "type": null, * "binsLabel": "" * }, * { * "id": "banking.Year_", * "columnId": "banking.Year_", * "values": [ * { * "d": "2008", * "u": "2008" * }, * { * "d": "2009", * "u": "2009" * } * ], * "excludedValues": [], * "operator": "in", * "type": null, * "binsLabel": "Year" * }, * { * "id": "banking.Recovery_Amount_sum", * "columnId": "banking.Recovery_Amount", * "values": [ * { * "d": 31234327.54830128, * "u": 31234327.54830128 * }, * { * "d": 35389734.47129045, * "u": 35389734.47129045 * } * ], * "excludedValues": [], * "operator": "between", * "aggregationType": "sum", * "preOrPost": "post" * }] *}) * */ VisualizationAPI.prototype.matches = function matches() {}; /** * @description Returns the visualization definition. The definition describes various aspects of the visualization like name, slots, properties, etc. * @function VisualizationAPI#getDefinition * @private * * @returns {VisDefinitionAPI} vis defintion * */ VisualizationAPI.prototype.getDefinition = function getDefinition() {}; /** * @function Visualization#getSavedPrompts * @description Gets the API of SavedPrompts. * @private * * @return {SavedPromptsAPI} API of SavedPrompts */ VisualizationAPI.prototype.getSavedPrompts = function getSavedPrompts() {}; /** * @description Gets the local filters. * @function VisualizationAPI#getLocalFilters * * @returns {FiltersAPI} */ VisualizationAPI.prototype.getLocalFilters = function getLocalFilters() {}; /** * @description Sets the visualization type, where 'auto' will set the visualization to the recommended type. * @function VisualizationAPI#setType * @public * * @param {String} type For example: auto, Bar, Area, etc. * @param {SetOptions} options * * @todo - define the type enum (can be found in SmartsToVizMapping.js) */ VisualizationAPI.prototype.setType = function setType() /* type, options */{}; /** * @description Indicates whether the visualization type is locked or not. * An unlocked visualization type will use the recommender when new columns are added and the viz type might change as we add more columns. * A locked visualization type will always used the current visualization as we add new columns to the slots. * * @function VisualizationAPI#isTypeLocked * @private * * @param {Boolean} isTypeLocked * */ VisualizationAPI.prototype.isTypeLocked = function isTypeLocked() {}; /** * @description Locks the visualization. * An unlocked visualization type will use the recommender when new columns are added and the viz type might change as we add more columns. * A locked visualization type will always used the current visualization as we add new columns to the slots. * * @function VisualizationAPI#lockType * @private * * @param {SetOptions} Options * */ VisualizationAPI.prototype.lockType = function lockType() /* options */{}; /** * @description Unlocks the visualization. * An unlocked visualization type will use the recommender when new columns are added and the viz type might change as we add more columns. * A locked visualization type will always used the current visualization as we add new columns to the slots. * @function VisualizationAPI#unlockType * @private * * @param {SetOptions} Options * */ VisualizationAPI.prototype.unlockType = function unlockType() /* options */{}; // /** // * @description Returns the decorator object that can be used to decorate the data in the visualization. // * If the visualizatoin support multiple datasets and no view id is provided, then the decorator for the first dataset is returned. // * // * @function VisualizationAPI#getDecorator // * @private // * // * @param {String} [viewId] Data view id. If not provided, the decorator for the first data view is returned. // * // * @return {DecoratorAPI} decorator object // * // */ // getDecorator(/* dataViewId */) {} // /** // * @description Return a list of decorator object that can be used to decorate the data in the visualization. // * Each dataset will have its own decorator object. // * // * @function VisualizationAPI#getDecoratorList. // * @private // * // * @return {DecoratorAPI[]} decorator object // * // */ // getDecoratorList() {} /** * @description Returns true if hasUnavailableMetadataColumns references a column that is no longer available. * @function VisualizationAPI#hasUnavailableMetadataColumns * @public * * @returns {Boolean} */ VisualizationAPI.prototype.hasUnavailableMetadataColumns = function hasUnavailableMetadataColumns() {}; return VisualizationAPI; }(); /** * @description Enum for all supported DECORATIONS * @readonly * @enum {String} * @private * @constant * @memberOf VisualizationAPI */ VisualizationAPI.DECORATIONS = { HIGHLIGHT: 'highlight', SELECT: 'select', TOOLTIP: 'tooltip' }; return VisualizationAPI; }); //# sourceMappingURL=VisualizationAPI.js.map