Adding external libraries

Including JavaScript files

  1. Install an external JavaScript library by using any package manager (npm, yarn, etc.)
  2. Include a path of the library to the externalJS property of the pbiviz.json

Please pay attention to @types/d3 package if you’d like to add typings for your JavaScript file to get intellisense and compile time safety on them.

Example

  • Installing d3 by using npm
npm install d3@3.5 --save
npm install @types/d3@3.5 --save
  • Including d3 to the pbiviz.json
{
  "visual": {...},
  "apiVersion": ...,
  "author": {...},
  "assets": {...},
  "externalJS": [
    "node_modules/d3/d3.min.js"
  ],
  "style": ...,
  "capabilities": ...,
  "dependencies": ...
}

Please visit this page to find the real example.

Including CSS files

  1. Install an external CSS framework by using any package manager (npm, yarn, etc.)
  2. Include the import statement to the .less file of the visual

Example

npm install bootstrap --save
  • Include the import statement to the visual.less
@import (less) "node_modules/bootstrap/dist/css/bootstrap.css";

Please visit this page to find the real example.

COMMENTS