Skip to main content

Pentaho+ documentation has moved!

The new product documentation portal is here. Check it out now at docs.hitachivantara.com

 

Hitachi Vantara Lumada and Pentaho Documentation

util

pentaho.visual. util

AMD Module

require(["pentaho/visual/util"], function(util) { /* code goes here */ });

The pentaho/visual/util contains utilities for dealing with visualizations.

Source: javascript/web/pentaho/visual/util.js, line 27

Methods

Name Description
classifyDom(domElement, vizTypeId, viewTypeId)

Marks a DOM element as the container element of a visualization.

getCssClasses(vizTypeId, viewTypeId) : string

Gets the CSS class names that should be added to a DOM element so that any themes associated with either the model or the view classes are applied to it.

getDefaultViewModule(vizTypeId, keyArgs) : pentaho.module.IMeta

Gets the module of the default view class of a visualization, given its identifier.

getModelAndDefaultViewClassesAsync(vizTypeId, keyArgs) : Promise.

Gets a promise for the model and default view classes, given a visualization type identifier.

Methods Details

classifyDom(domElement, vizTypeId, viewTypeId)

Marks a DOM element as the container element of a visualization.

Classes are added to the DOM element so that any themes associated with either the model or the view classes are applied to it.

For both the model and the view, the class names are applied by calling pentaho.theme.IService#classifyDomAsModule.

Source: javascript/web/pentaho/visual/util.js, line 138

Parameters:
Name Default Value Summary
domElement : HTMLElement

The DOM element.

vizTypeId : string
Optional

The identifier of the visualization type.

viewTypeId : string
Optional

The identifier of the view type.

See also: pentaho.theme.IService#classifyDomAsModule

getCssClasses(vizTypeId, viewTypeId) : string

Gets the CSS class names that should be added to a DOM element so that any themes associated with either the model or the view classes are applied to it.

For both the model and the view, the class names are obtained by calling pentaho.theme.IService#getModuleCssClasses.

Source: javascript/web/pentaho/visual/util.js, line 163

Parameters:
Name Default Value Summary
vizTypeId : string
Optional

The identifier of the visualization type.

viewTypeId : string
Optional

The identifier of the view type.

Returns:
Name Description
string

The CSS class names string.

See also: pentaho.theme.IService#getModuleCssClasses

getDefaultViewModule(vizTypeId, keyArgs) : pentaho.module.IMeta

Gets the module of the default view class of a visualization, given its identifier.

The default view class is determined by the pentaho.visual.DefaultViewAnnotation annotation associated to the visualization's model class.

This method is only reliable to determine the default view module if the pentaho.visual.DefaultViewAnnotation annotation can be got synchronously. This will be the case if the visualization type module has already been loaded (or prepared) or if the annotation has already been read asynchronously at least once.

Source: javascript/web/pentaho/visual/util.js, line 61

Parameters:
Name Default Value Summary
vizTypeId : string

The visualization identifier.

keyArgs : object
Optional

The keyword arguments object.

Parameters:
Name Default Value Summary
assertResult : boolean
Optional
true

Indicates that an error should be thrown if a default view is not defined or cannot be obtained synchronously for the given visualization.

inherit : boolean
Optional
false

Indicates that the pentaho.visual.DefaultViewAnnotation annotation can be obtained from an ancestor visualization type.

Returns:
Name Description
pentaho.module.IMeta | null

The module of the default view; null if not available.

Throws:
Name Description
pentaho.lang.ArgumentRequiredError

When vizTypeId is not specified.

pentaho.lang.OperationInvalidError

When keyArgs.assertResult is true and a default view is not defined or cannot be obtained synchronously for the given visualization.

getModelAndDefaultViewClassesAsync(vizTypeId, keyArgs) : Promise.

Gets a promise for the model and default view classes, given a visualization type identifier.

Source: javascript/web/pentaho/visual/util.js, line 92

Parameters:
Name Default Value Summary
vizTypeId : string

The identifier of the visualization type.

keyArgs : object
Optional

The keyword arguments object.

Parameters:
Name Default Value Summary
assertResult : boolean
Optional
true

Indicates that the promise should be rejected with an error if the specified visualization type is not annotated with a pentaho.visual.DefaultViewAnnotation annotation.

inherit : boolean
Optional
false

Indicates that the pentaho.visual.DefaultViewAnnotation annotation can be obtained from an ancestor visualization type.

Returns:
Name Description
Promise.

A promise that resolves to an object containing the model and default view classes, as well as the identifier of the view class.