Migrating to versioned API guide

To migrate from the legacy APIs to the new versioned Visuals API, use PowerBI visuals CLI tools and NPM API packages. Check the Power BI visuals API roadmap for current and upcomming features.

Utility libraries using NPM packages

The npm packages are intended to provide utility libraries for common functionlaity that is required by custom visuals, and to align it with Power BI’s core visuals look & feel. Use the npm packages instead of the legacy APIs that were used in the past to achieve those common functionalities. Replace “Legacy Reference” in your code with the relevant “NPM package”, as described below.

TypeUtils

TypeUtils is a set of functions and classes to extend the basic types.

Legacy reference NPM package namespace
powerbi.Double powerbi.extensibility.utils.type.Double
powerbi.Prototype powerbi.extensibility.utils.type.Prototype
powerbi.visuals.jsCommon.PixelConverter powerbi.extensibility.utils.type.PixelConverter

SVGUtils

SVGUtils is a set of functions and classes to simplify SVG manipulations.

Legacy reference NPM package namespace
powerbi.visuals.jsCommon.CssConstants powerbi.extensibility.utils.svg.CssConstants
powerbi.visuals.SVGUtils methods powerbi.extensibility.utils.svg methods
powerbi.visuals.shapes.Rect powerbi.extensibility.utils.svg.shapes.Rect
powerbi.visuals.getCoordinates powerbi.extensibility.utils.svg.getCoordinates

DataViewUtils

DataViewUtils is a set of functions and classes to simplify parsing of the DataView object.

Legacy reference NPM package namespace
powerbi.data.DataRoleHelper powerbi.extensibility.utils.dataview.DataRoleHelper
powerbi.DataViewObjects powerbi.extensibility.utils.dataview.DataViewObjects
powerbi.DataViewObject powerbi.extensibility.utils.dataview.DataViewObject
powerbi.visuals.converterHelper powerbi.extensibility.utils.dataview.converterHelper
none powerbi.extensibility.utils.dataview.DataViewObjectsParser

FormattingUtils

FormattingUtils is a set of functions and classes to format values.

Legacy reference NPM package namespace
powerbi.TextMeasurementService powerbi.extensibility.utils.formatting.textMeasurementService
powerbi.visuals.jsCommon.StringExtensions powerbi.extensibility.utils.formatting.stringExtensions
powerbi.visuals.valueFormatter powerbi.extensibility.utils.formatting.valueFormatter

InteractivityUtils

InteractivityUtils is a set of functions and classes to simplify implementation of cross-selection and cross-filtering.

Legacy reference NPM package namespace
powerbi.visuals.InteractivityOptions powerbi.extensibility.utils.interactivity
powerbi.visuals.InteractivityUtils powerbi.extensibility.utils.interactivity.interactivityUtils

TooltipUtils

TooltipUtils is a set of functions and classes to simplify usage of the Tooltip API.

Legacy reference NPM package namespace
powerbi.common.createTooltipService powerbi.extensibility.utils.tooltip.createTooltipServiceWrapper
powerbi.common.ITooltipService powerbi.extensibility.utils.tooltip.ITooltipServiceWrapper

ColorUtils

ColorUtils is a set of functions and classes to simplify color manipulations.

Legacy reference NPM package namespace
powerbi.visuals.ColorHelper powerbi.extensibility.utils.color.ColorHelper
powerbi.visuals.jsCommon.Color powerbi.extensibility.utils.color methods

ChartUtils

ChartUtils is a set of interfaces to format chart properties, such as axes and data labels.

Legacy reference NPM package namespace
powerbi.visuals.AxisHelper methods powerbi.extensibility.utils.chart.axis methods
powerbi.DataLabelManager powerbi.extensibility.utils.chart.dataLabel.DataLabelManager
powerbi.visuals.dataLabelUtils methods powerbi.extensibility.utils.chart.dataLabel.utils methods

TestUtils

TestUtils is a set of mocks and functions to simplify unit testing.

Legacy reference NPM package namespace
none powerbi.extensibility.utils.test.mocks.MockIVisualHost
none powerbi.extensibility.utils.test.mocks.createVisualHost
none powerbi.extensibility.utils.test.mocks.MockIColorPalette
none powerbi.extensibility.utils.test.mocks.createColorPalette
none powerbi.extensibility.utils.test.mocks.MockISelectionId
none powerbi.extensibility.utils.test.mocks.createSelectionId
none powerbi.extensibility.utils.test.mocks.MockISelectionIdBuilder
none powerbi.extensibility.utils.test.mocks.createSelectionIdBuilder
none powerbi.extensibility.utils.test.mocks.MockISelectionManager
none powerbi.extensibility.utils.test.mocks.createSelectionManager
COMMENTS