Methods

This section describes the methods exposed by the DevExpress.viz namespace.

currentPalette(paletteName)

Changes the current palette for all data visualization widgets on the page.

Module: viz/palette
Export: currentPalette
Parameters:
paletteName: String
The palette name.

Only the widgets created after calling this method use the new palette. Refresh the styling settings in other widgets using the DevExpress.viz.refreshTheme() method.

See Also

currentTheme(platform, colorScheme)

Changes the current theme for all data visualization widgets on the page. The color scheme is defined separately.

Module: viz/themes
Export: currentTheme
Parameters:
platform: String
The platform name or "generic".
colorScheme: String
The color scheme: "light" or "dark".

Only the widgets created after calling this method use the new theme. Refresh the styling settings in other widgets using the DevExpress.viz.refreshTheme() method.

See Also

currentTheme(theme)

Changes the current theme for all data visualization widgets on the page.

Module: viz/themes
Export: currentTheme
Parameters:
theme: String
The new theme's name.

Only the widgets created after calling this method use the new palette. Refresh the styling settings in other widgets using the DevExpress.viz.refreshTheme() method.

See Also

exportFromMarkup(markup, options)

Allows you to export widgets using their SVG markup.

Module: viz/export
Export: exportFromMarkup
Parameters:
markup: String
The SVG markup of the widgets you need to export.
options: Object
Export options. Can contain the following fields:
  • fileName - the name of the file to be saved.
  • format - the file's format.
    Accepted Values: 'PNG' | 'PDF' | 'JPEG' | 'SVG' | 'GIF'
  • height - the SVG block's height in pixels.
    This field is required.
  • width - the SVG block's width in pixels.
    This field is required.
  • backgroundColor - the color that fills transparent regions.
  • proxyUrl - the URL of a server-side proxy required for export in IE9 and Safari on Mac OS.
    For details, refer to the proxyUrl option of any widget.

getMarkup(widgetInstances)

Gets the SVG markup of specific widgets for their subsequent export.

Module: viz/export
Export: getMarkup
Parameters:
widgetInstances: Array
The instances of the widgets whose markup should be returned.
Return Value: String
The widgets' SVG markup. Pass it to the exportFromMarkup(markup, options) method to export the widgets.
See Also

getPalette(paletteName)

Obtains the color sets of a predefined or registered palette.

Module: viz/palette
Export: getPalette
Parameters:
paletteName: String
The palette name.
Return Value: Object
The palette settings.

The returned value is an object of the following structure.

JavaScript
{
    simpleSet: ['#60a69f', '#78b6d9', '#6682bb', '#a37182', '#eeba69'], // for "Chart", "PieChart" and "BarGauge" 
    indicatingSet: ['#90ba58', '#eeba69', '#a37182'], // for "Chart", "PieChart" and "BarGauge"
    gradientSet: ['#78b6d9', '#eeba69'] // for "VectorMap"
};

The built-in palettes are listed in the Appearance Customization topic.

refreshPaths()

The method to be called every time the active entry in the browser history is modified without reloading the current page.

Module: viz/utils
Export: refreshPaths

Each data visualization widget addresses its inner elements by their URLs. Those URLs break when the active history entry is modified without reloading the current page (see Adding and modifying history entries). As a result, some widget elements may get mixed up or disappear completely. To fix the URLs, call the refreshPaths() method right after the history entry modification, and in the onpopstate event handler or, if you use a routing library, in its counterpart.

JavaScript
window.history.pushState({ foo: "bar" }, "title", "?foo=bar");
DevExpress.viz.refreshPaths();

window.onpopstate = function(event) {
    DevExpress.viz.refreshPaths();
}

The problem with broken URLs may also emerge if the page uses a path modifying HTML tag; for example, <base> or <iframe>. To resolve it, set the pathModified option of the widget to true.

refreshTheme()

Refreshes the current theme and palette in all data visualization widgets on the page.

Module: viz/themes
Export: refreshTheme

registerPalette(paletteName, palette)

Registers a new palette.

Module: viz/palette
Export: registerPalette
Parameters:
paletteName: String
The new palette name.
palette: Object
The new palette settings.

The palette settings is an object of the following structure.

JavaScript
{
    simpleSet: ['#60a69f', '#78b6d9', '#6682bb', '#a37182', '#eeba69'], // for "Chart", "PieChart" and "BarGauge" 
    indicatingSet: ['#90ba58', '#eeba69', '#a37182'], // for "CircularGauge" and "LinearGauge"
    gradientSet: ['#78b6d9', '#eeba69'] // for "VectorMap"
};

registerTheme(customTheme, baseTheme)

Registers a new theme based on the existing one.

Module: viz/themes
Export: registerTheme
Parameters:
customTheme: Object
The new theme settings.
baseTheme: String
The base theme name.

For details on how to customize a theme, refer to the Appearance Customization article.