Sigma Computing Plugins provides an API for third-party applications add
additional functionality into an existing Sigma workbook.
Plugins are built using Sigma’s Plugin API. This API communicates data and
interaction events between a Sigma workbook and the plugin. Plugins are hosted
by their developer and rendered in an iframe in Sigma.
To test your plugin in Sigma Plugin Dev Playground, you must:
Have an Admin, Creator or Explorer account type
Have Can Edit permission on the work
Be in the workbook’s Edit mode
To test a development version of a registered plugin, you must:
Have either:
An Admin account type
A custom account type that supports plugin developer feature permissions
Have "can edit" permission on the workbook
Be in the workbook’s Edit mode
Your plugin must be a Javascript-based project and run in the browser.
Getting Started
Installation
Provided you have already followed the steps to create a plugin and a plugin
development environment, you can install @sigmacomputing/plugin using one of
the following commands
yarn add @sigmacomputing/plugin
# or
npm install @sigmacomputing/plugin
If you have yet to set up your development environment, follow one of the setup
guides below
Create a Development Project
At Sigma, we use React for all of our frontend development. This was taken into
consideration when building Sigma’s Plugin feature.
While you are not required to use React for your plugin, it must be written in
Javascript and React is recommended. We support both a standard Javascript API
and a React Hooks API.
Create a Project with React
Open your terminal and navigate to the directory you want to create your
project in.
Create your new project. We recommend using Facebook’s
create-react-app.
npx create-react-app <my-cool-plugin>
Navigate to the project's main directory.
cd <my-cool-plugin>
Use your package manager to install Sigma’s plugin library. We recommend
using yarn.
yarn add @sigmacomputing/plugin
Spin up your local development server.
yarn && yarn start
Start developing:
Get started with Sigma’s Plugin APIs.
Test your plugin directly in a Sigma workbook using the Sigma Plugin Dev
Playground.
Plugin developers should have access to a special plugin called Sigma Plugin Dev
Playground. This plugin is available from any workbook and points to
http://localhost:3000, by default.
If you cannot find this plugin, or would like a development playground with an
alternative default host, please contact your Organization Admin with a request
to Register a Plugin with its production URL set to your preferred development
URL.
Note: If you followed our recommendations under
#create-a-development-project, enter the
following command in your terminal:
yarn && yarn start
Create/open a workbook.
In the workbook header, click Edit.
Click the + button in the sidebar, to open the workbook’s ADD NEW panel.
Select the PLUGINS element type, located under UI ELEMENTS.
The editor panel will show you a list of available plugins. Select Sigma
Plugin Dev Playground.
Your new plugin element will appear on the page.
Note:
The editor panel will only display content if you have configured your plugin
using Sigma’s plugin Configuration API.
Likewise, the element will only display content if your plugin is configured to display content.
If you change a plugin's configuration options, input values will need to be
re-added in the editor panel.
Now what?
You can refresh your plugin as you make changes to its code. This option is
available from the element’s menu.
You are responsible for hosting your plugin. Learn more.
A plugin can be configured with any number of configuration fields. Each field
type has its own configuration options. Each field type is also guaranteed to
have the following options:
name : string - the name of the field
type : string - the field type
label : string (optional) - a display name for the field
A configurable workbook interaction to interact with other charts within your workbook
Action Trigger
A configurable action trigger to trigger actions in other elements within your workbook
Action Effect
A configurable action effect that can be triggered by other elements within your workbook
PluginInstance
interfacePluginInstance<T> {
sigmaEnv: 'author' | 'viewer' | 'explorer';
config: {
/**
* Getter for entire Plugin Config
*/get(): Partial<T> | undefined;
/**
* Performs a shallow merge between current config and passed in config
*/set(config: Partial<T>): void;
/**
* Getter for key within plugin config
*/
getKey<K extends keyof T>(key: K): Pick<T, K>;
/**
* Assigns key value pair within plugin
*/
setKey<K extends keyof T>(key: K, value: Pick<T, K>): void;
/**
* Subscriber for Plugin Config
*/subscribe(listener: (arg0: T) =>void): Unsubscriber;
/**
* Set possible options for plugin config
*/configureEditorPanel(options: CustomPluginConfigOptions[]): void;
/**
* Gets a static image of a workbook variable
*/getVariable(configId: string): WorkbookVariable;
/**
* Setter for workbook variable passed in
*/setVariable(configId: string, ...values: unknown[]): void;
/**
* Getter for interaction selection state
*/getInteraction(configId: string): WorkbookSelection[];
/**
* Setter for interaction selection state
*/setInteraction(
configId: string,
elementId: string,
selection: WorkbookSelection[],
): void;
/**
* Triggers an action based on the provided action trigger ID
*/triggerAction(configId: string): void;
/**
* Registers an effect with the provided action effect ID
*/registerEffect(configId: string, effect: Function): void;
/**
* Overrider function for Config Ready state
*/setLoadingState(ready: boolean): void;
/**
* Allows users to subscribe to changes in the passed in variable
*/subscribeToWorkbookVariable(
configId: string,
callback: (input: WorkbookVariable) =>void,
): Unsubscriber;
/**
* @deprecated Use Action API instead
* Allows users to subscribe to changes in the passed in interaction ID
*/subscribeToWorkbookInteraction(
configId: string,
callback: (input: WorkbookSelection[]) =>void,
): Unsubscriber;
};
elements: {
/**
* Getter for Column Data by parent sheet ID
*/getElementColumns(configId: string): Promise<WbElementColumns>;
/**
* Subscriber to changes in column data by ID
*/subscribeToElementColumns(
configId: string,
callback: (cols: WbElementColumns) =>void,
): Unsubscriber;
/**
* Subscriber for the data within a given sheet
*/subscribeToElementData(
configId: string,
callback: (data: WbElementData) =>void,
): Unsubscriber;
};
/**
* Destroys plugin instance and removes all subscribers
*/destroy(): void;
}
Framework Agnostic API
client
The client is a pre-initialized plugin instance. You can use this instance
directly or create your own instance using initialize
A context provider your plugin that enables all of the other React API hooks.
You should wrap your plugin with this provider if your want to use the plugin
hook API.
Provides the latest data values from the corresponding sheet (initially 25000), and provides a
callback for fetching more data in chunks of 25000 values.
configId : string - The config ID corresponding to the action effect
effect : Function - The function to be called when the effect is triggered
useConfig()
Returns the workbook element’s current configuration. If a key is provided, only
the associated configuration is returned.
functionuseConfig(key?: string): any;
Arguments
key : string (optional) - The name of a key within the associated
PluginConfigOptions object
Examples
Sigma’s development team has created a set of example plugins, listed below.
All of our example plugins are hosted and can be added to your organization. To
view / add an example plugin to your organization, follow the steps to register
a plugin using its Production URL, listed below.
Note: For additional instructions, visit the README file located in the main directory of any given example plugin.
Host Your Plugin
As a plugin developer, you are responsible for hosting your plugin(s). If you’re
new to hosting your own projects, here are a few popular hosting platforms you
can get started with:
We welcome contributions to @sigmacomputing/plugin!
🐛 Issues, 📥 Pull requests and 🌟 Stars are always welcome.
Read our contributing
guide to
get started.
yarn format
Format your code to match the sigmacomputing style guide
yarn test
Check if the unit tests all pass
You can also run the tests in --watch mode with yarn test:watch
FAQs
Sigma Computing Plugin Client API
The npm package @sigmacomputing/plugin receives a total of 10,989 weekly downloads. As such, @sigmacomputing/plugin popularity was classified as popular.
We found that @sigmacomputing/plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 0 open source maintainers collaborating on the project.
Package last updated on 25 Sep 2024
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Malicious Go packages are impersonating popular libraries to install hidden loader malware on Linux and macOS, targeting developers with obfuscated payloads.
Bybit's $1.46B hack by North Korea's Lazarus Group pushes 2025 crypto losses to $1.6B in just two months, already surpassing all of 2024's $1.49B total.
OpenSSF has published OSPS Baseline, an initiative designed to establish a minimum set of security-related best practices for open source software projects.