Skip to content

Latest commit

 

History

History
318 lines (238 loc) · 12.9 KB

File metadata and controls

318 lines (238 loc) · 12.9 KB

Classes

Spectroplot

The main Spectroplot class.

EasyCloning

An example easy template cloning class.

Functions

loadUrl(url, [fileLoader])Object

Load data from a URL.

Typedefs

CustomWindowFObject

Custom Window function.

RGB : Array.<number>

RGB triplet.

FileLoader : function

This callback is used to load file data.

Spectroplot

The main Spectroplot class.

Kind: global class

new Spectroplot(options)

Initialize a new Spectroplot.

Param Type Default Description
options Object
[options.fftN] number 512 FFT width, powers of 2 only
[options.width] number 3000 canvas width in px
[options.height] number 512 canvas height in px, 0 = auto
[options.zoom] number 1 Zoom factor
[options.windowF] WindowF | CustomWindowF blackmanHarris Window name or custom function
[options.gain] number 6 Gain in dB
[options.range] number 30 Range in dB
[options.cmap] Cmap | Array.<RGB> cube1 Color map name or custom map
[options.ampHeight] number 0 Amp bar height in px, 0 = off
[options.minmaxHeight] number 20 MinMax bar height in px, 0 = off
[options.channelMode] string | Boolean false Mode 'I/Q' (false) or 'L/R' (true)
[options.dbfsWidth] number 60 dbfs width in px
[options.dbfsHeight] number 0 0 = auto: height + timeHeight
[options.freqWidth] number 40 Freq width in px
[options.timeHeight] number 20 Time height in px
[options.rampHeight] number 0 Color ramp height in px, 0 = auto
[options.rampTop] number 10 Color ramp top offset in px
[options.rampWidth] number 15 Color ramp width in px
[options.histWidth] number 100 Histogram width in px
[options.histLeft] number 55 Histogramm left offset in px
options.parent string | Object Container element or selector
[options.renderInfo] string | Object Info element or selector
[options.theme] string | Object Theme name or options, see setTheme

spectroplot.enableGuides()

Enables mouse-over guide drawing.

Kind: instance method of Spectroplot

spectroplot.disableGuides()

Disables mouse-over guide drawing.

Kind: instance method of Spectroplot

spectroplot.enableButtons()

Hooks up common button elements to the setter functions.

Kind: instance method of Spectroplot

spectroplot.setTheme(options)

Set a color theme.

Kind: instance method of Spectroplot

Param Type Default Description
options string | Object Theme name or theme options
[options.histoStroke] string "#b0b" Histogram line color
[options.histoFill] string "rgba(187,0,187,0.2)" Histogram fill color
[options.histoLine] number 2 Histogram line width
[options.dbfsStroke] string "#999" FS-Histogram line color
[options.dbfsFill] string "rgba(153,153,153,0.2)" FS-Histogram fill color
[options.dbfsLine] number 2 FS-Histogram line width
[options.rampFill] string "#666" Color ramp text color
[options.freqLabelFill] string "#333" Freq label text color
[options.freqMinorFill] string "#CCC" Freq minor tick color
[options.freqMajorFill] string "#666" Freq major tick color
[options.freqMarkeFill] string "#F00" Freq marker tick color
[options.timeLabelFill] string "#333" Time label text color
[options.timeMinorFill] string "#CCC" Time minor tick color
[options.timeMajorFill] string "#666" Time major tick color
[options.guidesBgFill] string "rgba(0,0,0,0.3)" Guides background color
[options.guidesDragFill] string "rgba(0,0,0,0.3)" Guides drag color
[options.guidesHairStroke] string "#fff" Guides hair color
[options.guidesInfoBgFill] string "rgba(255,255,255,0.8)" Guides info background color
[options.guidesInfoTextFill] string "#666" Guides info text color

spectroplot.destroy()

Release all event handlers and resources.

Kind: instance method of Spectroplot

spectroplot.setOption(opt, value) ⇒ Promise

Set an option on the Spectroplot to some value.

Kind: instance method of Spectroplot
Returns: Promise - A promise that resolves when the redrawing is complete

Param Type Description
opt string Option name, see new
value Object The new value for the option

spectroplot.setOptions(opts) ⇒ Promise

Set a number of options on the Spectroplot to some values.

Kind: instance method of Spectroplot
Returns: Promise - A promise that resolves when the redrawing is complete

Param Type Description
opts Object A key/value object of options to set, see new

spectroplot.setData(filedata) ⇒ Promise

Set new data on the Spectroplot.

Kind: instance method of Spectroplot
Returns: Promise - A promise that resolves when the redrawing is complete

Param Type Description
filedata string | Object A URL string or File data object of { fileBuffer: ArrayBuffer, name: string, size: number, type: string }

spectroplot.drawHistograms()

Prints color histogram.

Kind: instance method of Spectroplot

EasyCloning

An example easy template cloning class.

Kind: global class

new EasyCloning(elementOrSelector, [dataUrl])

Initialize a new EasyCloning.

Param Type Description
elementOrSelector Object | string Parent element or selector
[dataUrl] string URL to load data from

Example

new EasyCloning('#spectros', document.location.hash.substring(1))

        

easyCloning.cloneLoader([filedata])

Load data into a new clone.

Kind: instance method of EasyCloning

Param Type Description
[filedata] Object data object to load

easyCloning.loadUrl([dataUrl])

Load data from a URL.

Kind: instance method of EasyCloning

Param Type Description
[dataUrl] string URL to load data from

WindowF : enum

Predefined Window functions.

Kind: global enum
Read only: true
Properties

Name Type Default Description
rectangular string "rectangular" Rectangular window function
bartlett string "bartlett" Bartlett window function
hamming string "hamming" Hamming window function
hann string "hann" Hann window function
blackman string "blackman" Blackman window function
blackmanHarris string "blackmanHarris" Blackman - Harris window function

Cmap : enum

Predefined Color maps.

Kind: global enum
Read only: true
Properties

Name Type Default Description
cube1 string "cube1" Cube1 color map
viridis string "viridis" Viridis color map
plasma string "plasma" Plasma color map
inferno string "inferno" Inferno color map
magma string "magma" Magma color map
hot string "hot" Hot color map
afmhot string "afmhot" Afmhot color map
gist_heat string "gist_heat" Gist heat color map
naive string "naive" Naive color map
parabola string "parabola" Parabola color map
sox string "sox" Sox color map
grayscale string "grayscale" Gray color map
roentgen string "roentgen" Röntgen color map
phosphor string "phosphor" Phosphor color map

loadUrl(url, [fileLoader]) ⇒ Object

Load data from a URL.

Kind: global function
Returns: Object - File info object

Param Type Description
url string URL to load data from
[fileLoader] FileLoader Callback for File info object

CustomWindowF ⇒ Object

Custom Window function.

Kind: global typedef

Param Type Description
n number FFT width

RGB : Array.<number>

RGB triplet.

Kind: global typedef

FileLoader : function

This callback is used to load file data.

Kind: global typedef

Param Type Description
fileinfo Object File info object