@domoinc/base-widget

BaseWidget - Domo Widget

Stats

StarsIssuesVersionUpdatedCreatedSize
@domoinc/base-widget
1.7.15 years ago6 years agoMinified + gzip package size for @domoinc/base-widget in KB

Readme

BaseWidget

This widget doesn't do anything by it self but it contains all the "base" features that our widgets need. This widget should be "extended" to do anything that you need it to do. It does require attachment to an svg selection and uses our Notifier widget.

Config

this._config = {
      height: {
        name: 'Chart Height',
        description: 'Height of the chart.',
        category: 'Dimensions',
        type: 'number',
        value: 250,
        units: 'px'
      },
      width: {
        name: 'Chart Width',
        description: 'Width of the chart.',
        category: 'Dimensions',
        type: 'number',
        value: 250,
        units: 'px'
      },
      shouldValidate: {
        description: 'Flag for turning off data validation.',
        type: 'boolean',
        value: true
      },
      updateSizeableConfigs: {
        description: 'Flag for turning off the mimic of illustrator\'s scale functionality.',
        type: 'boolean',
        value: true
      }
};

Data Definition

// This should be set in the "extended" chart.
_Chart._dataDefinition = {};

Base Functions

  /**
   * Sets one or many of the data definition properties for the chart
   * @param  {object} obj Contains data definiton objects you would like to set or update.
   * @return {object}     Returns the chart for chainability.
   */
  dataDefinition: function (obj) {...},


  /**
   * This will get or set any of the chart's configuration options defined
   * in the 'chart._config' object.
   * @param  {String or Object}   item        If string, it will return the value for that config item.
   *
   * If object, it will update that config item with set value.
   * @param  {String or Number}   [value]     The value to update config item with.
   * @return {object}                         The chart to preserve chainability.
   */
  config: function (item, value) {...},


  /**
   * This will get or set any of the chart's accessors defined
   * in the 'chart._dataDefinition' object.
   * @param  {String or Object}   item        If string, it will return the function for that accessor item. If object, it will update that accessor with set function.
   * @param  {function}           [value]     The function to update accessor item with.
   * @return {object}                         The chart to preserve chainability.
   */
  accessors: function (item, value) {...},


  /**
   * Shorthand for config getter/setter
   */
  c: function (item, value) {...},


  /**
   * Shorthand for accessor getter function
   */
  a: function (item, value) {...},


  /**
   * Visits each config element.
   * If a config element has a size function it will update that configs value
   * with the returned result of its size function.
   */
  updateSizeableConfigs: function () {...},


  /**
   * Takes a theme obj and applies it to the widget's config elements.
   *
   * @param themeObj {Object} {"name": "Dark Bold", "domoDefinedTheme": true, "config": { gaugeFillPrimaryColor: '#1C5CAE'} };
   */
  applyTheme: function (themeObj) {...}

Create Widget

This widget doesn't do anything (by itself) so it does not have a createWidget.js file.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.