This namespage is maintained for legacy implementations only (not using web components). New implementations should use functionality included in the web components (stxUI.js)
A widget for managing chart colors and themes. The dialog functionality assumes that color picker
divs have been set up with a class that matches one of the stx chart configuration classes (such as stx_candle_up)
The classMapping determines which classes are mapped to each color picker. If null then apply to the container itself.
See the following tutorial if you wish to programatically create custom color themes: Custom Color Themes
Members
-
<static> builtInThemes :Object
-
List of built in themes. Override this with your built in themes.
Type:
- Object
-
<static> classMapping :Object
-
Determines which underlying classes are overridden by each of the dialog swatches a user can change.
Type:
- Object
Methods
-
<static> createTheme(stx)
-
Convert colors from an existing chart into a theme object
Parameters:
Name Type Description stxobject The chart object
Returns:
The theme object
- Type
- Object
-
<static> deleteTheme(stx, theme)
-
Delete a custom theme by name.
Parameters:
Name Type Description stxobject The chart object
themestring The name of the theme
-
<static> destroy()
-
Clears out the ThemeManager, eliminating all references to stx objects. To destroy the complete chart and related UI use STX.destroy
-
<static> enableBuiltInTheme(stx, theme)
-
Enables a built in theme. Built in themes are CSS files.
Parameters:
Name Type Description stxobject The chart object
themestring The theme name
-
<static> enableTheme(stx, theme)
-
Enables a specific theme. Custom themes are objects that contain color choices on top of a base theme (CSS File).
Parameters:
Name Type Description stxobject The chart object
themestring The theme name
-
<static> initialize(stx, cb)
-
Basic initialization of ThemeManager values. Use this to set stx and cb as opposed to STX.ThemeManager.themesToMenu, in the event you do not wish to use the automatic themes menu generation.
Parameters:
Name Type Description stxobject a chart
cbfunction A callback method for storing the themes (i.e. to localStorage)
-
<static> loadBuiltInTheme(stx, theme, cb)
-
Loads a built in theme by dynamically linking the CSS that defines that theme.
Parameters:
Name Type Description stxobject The chart object
themestring The theme to load. Pass null to remove the current built in theme.
cbfunction Callback function when theme is successfully loaded
-
<static> populateDialog(id, stx)
-
Populate a dialog with the existing colors from a chart.
Parameters:
Name Type Description idstring Name of the theme dialog
stxobject The chart object
-
<static> saveTheme(name, stx)
-
Save a theme by name. Optional callback function when finished of fc(str) where str is a stringified version of the themes that can be used for saving to a server or to local storage
Parameters:
Name Type Description namestring The name of the theme
stxobject The chart object
-
<static> setThemes(obj, stx)
-
Sets themes from a serialized object
Parameters:
Name Type Description objobject Serialized themes
stxobject The chart object
-
<static> themesToMenu(el, el2, stx, cb)
-
Construct a menu from available themes
Parameters:
Name Type Description elobject The menu element where custom themes will be added
el2object The menu element where built-in themes will be added
stxobject a chart
cbfunction A callback method for storing the themes (i.e. to localStorage)