Change the visual type

You can change the type of an existing visual in a Power BI report, such as changing a bar chart into a pie chart. See a list of available out-of-the-box visual types.

How to change an existing visual type using the API

Use the changeType method and specify the desired type.

changeType(visualType: string): Promise<void>

Code example

The following code example shows how to change an existing visual type to a pieChart type.

await visual.changeType('pieChart');

Considerations and limitations

  • changeType will fail if the target visual type is not installed.
  • Different visual types have different data binding rules. If any data fields were applied to a visual and changeType is used, then the data fields might be mapped to a different dataRole if such mapping is defined on the visual type metadata. If no such mapping exists between the visual types, changeType fails. See Visual data binding to learn more.