PowerBI provides several tools that help to cover the main needs to build your own visual.
- DataViewUtils is a set of functions and classes in order to simplify parsing of the DataView objects for PowerBI custom visuals.
- ChartUtils helps to simplify development of axes, labels and legend for PowerBI custom visuals.
- ColorUtils is a tool to manage color manipulations for PowerBI custom visuals
- TypeUtils helps to use the Tooltip API for PowerBI custom visuals and extends the basic types for PowerBI custom visuals.
- InteractivityUtils is a set of functions and classes for implementation of cross-selection and cross-filtering for PowerBI custom visuals.
- FormattingUtils are interfaces for creating PowerBI custom visuals.
- SVGUtils is a tool for SVG manipulations for PowerBI custom visuals.
To install the package you should run the following command in the directory with your current custom visual:
npm install powerbi-visuals-utils-svgutils --save
This command installs the package and adds a package as a dependency to your package.json
After installation of the package you should include all necessary js dependencies into your project. You can find more information on each package github page.
For example here is the installation guide for SVGUtils package.
Having installed the package with all dependencies, you can use these utils in your project. Let's change the following instruction by using SVGUtils package:
this.xAxis
.attr('transform', 'translate(0, ' + height + ')')
.call(xAxis);
At first, import SVGUtils module in top of your typescript file:
import SVGUtils = powerbi.extensibility.utils.svg;
After that user can use all available module methods
this.xAxis
.attr('transform', SVGUtils.translate(0, height))
.call(xAxis);
To get more information about SVGItils package, please check the following documentation