123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- '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<DataSourceAPI>}
- */
- 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
|