VisualDescriptor class

A Power BI visual within a page

Properties

layout

The visual layout: position, size and visibility.

name

The visual name

page

The parent Power BI page that contains this visual

title

The visual title

type

The visual type

Methods

clone(ICloneVisualRequest)

Clone existing visual to a new instance.

exportData(ExportDataType, number)

Exports Visual data. Can export up to 30K rows.

getFilters()

Gets all visual level filters of the current visual.

visual.getFilters()
 .then(filters => { ... });
getSlicerState()

Get slicer state. Works only for visuals of type slicer.

visual.getSlicerState()
 .then(state => { ... });
getSmartNarrativeInsights()

Get insights for single visual

visual.getSmartNarrativeInsights();
moveVisual(number, number, number)

Updates the position of a visual.

visual.moveVisual(x, y, z)
  .catch(error => { ... });
removeFilters()

Removes all filters from the current visual.

visual.removeFilters();
resizeVisual(number, number)

Resize a visual.

visual.resizeVisual(width, height)
  .catch(error => { ... });
setFilters(IFilter[])

Sets the filters on the current visual to 'filters'.

visual.setFilters(filters);
  .catch(errors => { ... });
setSlicerState(ISlicerState)

Set slicer state. Works only for visuals of type slicer.

setVisualDisplayState(VisualContainerDisplayMode)

Updates the display state of a visual.

visual.setVisualDisplayState(displayState)
  .catch(error => { ... });
sortBy(ISortByVisualRequest)

Sort a visual by dataField and direction.

updateFilters(FiltersOperations, IFilter[])

Update the filters for the current visual according to the operation: Add, replace all, replace by target or remove.

visual.updateFilters(FiltersOperations.Add, filters)
  .catch(errors => { ... });

Property Details

layout

The visual layout: position, size and visibility.

layout: IVisualLayout

Property Value

name

The visual name

name: string

Property Value

string

page

The parent Power BI page that contains this visual

page: IPageNode

Property Value

title

The visual title

title: string

Property Value

string

type

The visual type

type: string

Property Value

string

Method Details

clone(ICloneVisualRequest)

Clone existing visual to a new instance.

function clone(request?: ICloneVisualRequest): Promise<ICloneVisualResponse>

Parameters

Returns

exportData(ExportDataType, number)

Exports Visual data. Can export up to 30K rows.

function exportData(exportDataType?: ExportDataType, rows?: number): Promise<IExportDataResult>

Parameters

exportDataType
ExportDataType
rows

number

Returns

getFilters()

Gets all visual level filters of the current visual.

visual.getFilters()
 .then(filters => { ... });
function getFilters(): Promise<IFilter[]>

Returns

Promise<IFilter[]>

getSlicerState()

Get slicer state. Works only for visuals of type slicer.

visual.getSlicerState()
 .then(state => { ... });
function getSlicerState(): Promise<ISlicerState>

Returns

Promise<ISlicerState>

getSmartNarrativeInsights()

Get insights for single visual

visual.getSmartNarrativeInsights();
function getSmartNarrativeInsights(): Promise<ISmartNarratives>

Returns

Promise<ISmartNarratives>

moveVisual(number, number, number)

Updates the position of a visual.

visual.moveVisual(x, y, z)
  .catch(error => { ... });
function moveVisual(x: number, y: number, z?: number): Promise<IHttpPostMessageResponse<void>>

Parameters

x

number

y

number

z

number

Returns

Promise<IHttpPostMessageResponse<void>>

removeFilters()

Removes all filters from the current visual.

visual.removeFilters();
function removeFilters(): Promise<IHttpPostMessageResponse<void>>

Returns

Promise<IHttpPostMessageResponse<void>>

resizeVisual(number, number)

Resize a visual.

visual.resizeVisual(width, height)
  .catch(error => { ... });
function resizeVisual(width: number, height: number): Promise<IHttpPostMessageResponse<void>>

Parameters

width

number

height

number

Returns

Promise<IHttpPostMessageResponse<void>>

setFilters(IFilter[])

Sets the filters on the current visual to 'filters'.

visual.setFilters(filters);
  .catch(errors => { ... });
function setFilters(filters: IFilter[]): Promise<IHttpPostMessageResponse<void>>

Parameters

filters

IFilter[]

Returns

Promise<IHttpPostMessageResponse<void>>

setSlicerState(ISlicerState)

Set slicer state. Works only for visuals of type slicer.

function setSlicerState(state: ISlicerState): Promise<IHttpPostMessageResponse<void>>

Parameters

state
ISlicerState

Returns

Promise<IHttpPostMessageResponse<void>>

setVisualDisplayState(VisualContainerDisplayMode)

Updates the display state of a visual.

visual.setVisualDisplayState(displayState)
  .catch(error => { ... });
function setVisualDisplayState(displayState: VisualContainerDisplayMode): Promise<IHttpPostMessageResponse<void>>

Parameters

Returns

Promise<IHttpPostMessageResponse<void>>

sortBy(ISortByVisualRequest)

Sort a visual by dataField and direction.

function sortBy(request: ISortByVisualRequest): Promise<IHttpPostMessageResponse<void>>

Parameters

Returns

Promise<IHttpPostMessageResponse<void>>

updateFilters(FiltersOperations, IFilter[])

Update the filters for the current visual according to the operation: Add, replace all, replace by target or remove.

visual.updateFilters(FiltersOperations.Add, filters)
  .catch(errors => { ... });
function updateFilters(operation: FiltersOperations, filters?: IFilter[]): Promise<IHttpPostMessageResponse<void>>

Parameters

operation
FiltersOperations
filters

IFilter[]

Returns

Promise<IHttpPostMessageResponse<void>>