Gathering detailed insights and metrics for powerbi-client-vue-js
Gathering detailed insights and metrics for powerbi-client-vue-js
Gathering detailed insights and metrics for powerbi-client-vue-js
Gathering detailed insights and metrics for powerbi-client-vue-js
powerbi-client
JavaScript library for embedding Power BI into your apps. Provides service which makes it easy to embed different types of components and an object model which allows easy interaction with these components such as changing pages, applying filters, and res
powerbi-report-authoring
A library for authoring Power BI reports while embedded into your apps. Provides service which makes it easy to change report and visual elements in session. It gives APIs such as creating visual, changing visual properties, etc ...
powerbi-router
Router for Microsoft Power BI. Given an http method and url pattern call the matching handler with the request and response object. Syntax matches common libraries such as express and restify.
powerbi-models
Contains JavaScript & TypeScript object models for Microsoft Power BI JavaScript SDK. For each model there is a TypeScript interface, and a validation function to ensure and object is valid.
Power BI Vue.js component. This library lets you embed Power BI report, dashboard, dashboard tile, report visual, or Q&A in your Vue.js application.
npm install powerbi-client-vue-js
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
174 Stars
73 Commits
25 Forks
6 Watching
7 Branches
28 Contributors
Updated on 05 Nov 2024
Minified
Minified + Gzipped
TypeScript (88.48%)
Vue (10.54%)
JavaScript (0.54%)
HTML (0.44%)
Cumulative downloads
Total Downloads
Last day
-42.6%
596
Compared to previous day
Last week
-29.4%
2,941
Compared to previous week
Last month
19.2%
13,714
Compared to previous month
Last year
66.7%
115,006
Compared to previous year
Power BI Vue component. This library enables you to embed Power BI reports, dashboards, dashboard tiles, report visuals, Q&A or paginated reports in your Vue application, and to create new Power BI reports directly in your application.
Import the 'PowerBIReportEmbed' inside your target module:
1import { PowerBIReportEmbed } from 'powerbi-client-vue-js';
1<PowerBIReportEmbed 2 :embedConfig = {{ 3 type: "report", 4 id: "<Report Id>", 5 embedUrl: "<Embed Url>", 6 accessToken: "<Access Token>", 7 tokenType: models.TokenType.Embed, 8 settings: { 9 panes: { 10 filters: { 11 expanded: false, 12 visible: false 13 } 14 }, 15 background: models.BackgroundType.Transparent, 16 } 17 }} 18 19 :cssClassName = { "reportClass" } 20 21 :phasedEmbedding = { false } 22 23 :eventHandlers = { 24 new Map([ 25 ['loaded', () => console.log('Report loaded');], 26 ['rendered', () => console.log('Report rendered');], 27 ['error', (event) => console.log(event.detail);] 28 ]) 29 } 30> 31</PowerBIReportEmbed>
1<PowerBIReportEmbed 2 :embedConfig = {{ 3 type: "report", 4 id: undefined, 5 embedUrl: undefined, 6 accessToken: undefined, // Keep as empty string, null or undefined 7 tokenType: models.TokenType.Embed, 8 hostname: "https://app.powerbi.com" 9 }} 10> 11</PowerBIReportEmbed>
Note: To embed the report after bootstrapping, update the embedConfig (with at least accessToken and embedUrl).
The library offers the following components that can be used to embed various Power BI artifacts.
Component | Selector to use for embedding |
---|---|
PowerBIReportEmbedComponent | <PowerBIReportEmbed> |
PowerBIDashboardEmbedComponent | <PowerBIDashboardEmbed> |
PowerBITileEmbedComponent | <PowerBITileEmbed> |
PowerBIVisualEmbedComponent | <PowerBIVisualEmbed> |
PowerBIQnaEmbedComponent | <PowerBIQnaEmbed> |
PowerBIPaginatedReportEmbedComponent | <PowerBIPaginatedReportEmbed> |
PowerBICreateReportEmbedComponent | <PowerBICreateReport> |
You can embed other artifacts such as:
1<PowerBIDashboardEmbed 2 :embedConfig = "<IDashboardEmbedConfiguration>" 3 :cssClassName = "<className>" 4 :eventHandlers = "<Map of String and eventHandler>" 5> 6</PowerBIDashboardEmbed>
This demo includes a Vue application that embeds a sample report using the PowerBIReportEmbed component.
It demonstrates the complete flow from bootstrapping the report, to embedding and updating the embedded report.
It also demonstrates using the powerbi report authoring library, by enabling the user to change the type of visual from a report using the "Change visual type" button.
It also sets a 'DataSelected' event.
npm run demo
Redirect to http://localhost:3000/ to view in the browser.
Use case | Details |
---|---|
Embed Power BI | To embed your powerbi artifact, pass the component with at least type, embedUrl and accessToken in embedConfig property. |
Apply style class | Pass the name(s) of style classes to be applied to the embed container div to the cssClassName property. |
Set event handlers | Pass a map object of event name (string) and event handler (function) to the eventHandlers prop. Key: Event name Value: Event handler method to be triggered Event handler method takes two optional parameters: First parameter: Event Second parameter: Reference to the embedded entity List of supported events is given here: Additional events |
Reset event handlers | To reset event handler for an event, set the event handler's value as null in the eventHandlers map of properties. |
Bootstrap Power BI | To bootstrap your powerbi entity, pass the property embedConfig to the component without accessToken Note: embedConfig should at least contain type of the powerbi entity being embedded. Available types: "report", "dashboard", "tile", "visual" and "qna". Refer to How to bootstrap a report section in Quick Start. Note: A paginated report cannot be bootstrapped. |
Using with PowerBI Report Authoring | 1. Install powerbi-report-authoring as an npm dependency. 2. Use the report authoring APIs using the embedded report's instance. |
Phased embedding (Report type only) | Set the phasedEmbedding property value to true Refer to the Phased embedding article. |
Create report | To create a new report, pass the component with at least type, embedUrl and datasetId in embedConfig prop. |
Note: Supported browsers are Edge, Chrome, and Firefox.
Property | Description | Supported by |
---|---|---|
embedConfig | Configuration for embedding the PowerBI entity (required) | All |
phasedEmbedding | Phased embedding flag (optional) | Report |
eventHandlers | Map of pair of event name and its handler method to be triggered on the event (optional) | Report, Dashboard, Tile, Visual, Qna |
cssClassName | CSS class to be set on the embedding container (optional) | All |
service | Provide the instance of PowerBI service (optional) | All |
Entity | Event |
---|---|
Report | "buttonClicked", "commandTriggered", "dataHyperlinkClicked", "dataSelected", "loaded", "pageChanged", "rendered", "saveAsTriggered", "saved", "selectionChanged", "visualClicked", "visualRendered" |
Dashboard | "loaded", "tileClicked" |
Tile | "tileLoaded", "tileClicked" |
QnA | "visualRendered" |
1type EventHandler = (event?: service.ICustomEvent<any>, embeddedEntity?: Embed) => void | null;
Import the 'PowerBIReportEmbed' inside your targeted component file:
1import { PowerBIReportEmbed } from 'powerbi-client-vue-js';
Component will emit report-obj and You can use this variable.Add method in the component template.
1<PowerBIReportEmbed v-if="isEmbedded" 2 :embed-config="sampleReportConfig" 3 :phased-embedding="phasedEmbeddingFlag" 4 :css-class-name="reportClass" 5 :event-handlers="eventHandlersMap" 6 @report-obj="setReportObj"> 7</PowerBIReportEmbed>
Declare a variable report!:Report
and set the report to the report-obj.
1setReportObj(value: Report) { 2 this.report = value; 3},
You can use report
to call supported SDK APIs.
1async getReportPages(): Page[] { 2 const pages = await this.report.getPages(); 3 console.log(pages); 4}
The library supports Vue applications having version >= 3.
powerbi-client (https://www.npmjs.com/package/powerbi-client)
vue (https://www.npmjs.com/package/vue)
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications.
If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at Microsoft Privacy Statement. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
No vulnerabilities found.
No security vulnerabilities found.