Plugins
SigPlot can be extended to provide new capabilities using the plugin mechanism. Plugins can draw on the plot, they can add to the menu, and they can interact with mouse events. SigPlot comes with some standard plugins in the sigplot.plugins.js file, but you many contribute others. To load the standard plugins:
<script src="../sigplot.plugins.js"></script>
Currently the standard plugins include:
- Annotations - Draw text and images on the canvas
- Slider - Horizontal or vertical line that can be scrolled on the canvas or dragged by the user
- Accordion - Select a horizontal of vertical range between two sliders, useful for subband tuning
The annotation plugin behaves similar to the original SigPlot annotation mechanism. SigPlot annotations have two unique features:
- Annotations can be images or videos (basically anything supported by canvas drawImage)
- Annotations can be placed relative to the real coordinates
The slider plugin creates a horizontal or vertical bar that can be used to display the current position in the file. It also provides the ability for the user to "grab" the bar and slide it .. go ahead, give it a try.
A SigPlot plugin can be any JavaScript object, all methods are optional but here is a common plugin
MyPlugin = function(options) { // Contructor };
MyPlugin.prototype = {
init: function(plot) { // Called when the plugin is added to a plot }
dispose: function(plot) { // Called when removed from a plot }
refresh: function(plot { // Called when the plugin needs to redraw }
menu: // either an mx.menu compatible object or a function that returns one
};