
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
powerbi-client
Advanced tools
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
The powerbi-client npm package is a JavaScript library that allows developers to embed Power BI reports, dashboards, and tiles into their web applications. It provides a set of APIs to interact with the embedded content, enabling functionalities such as filtering, setting parameters, and capturing events.
Embed a Power BI Report
This code demonstrates how to embed a Power BI report into a web application. It uses the powerbi-client library to configure the embedding settings and then embeds the report into a specified HTML container.
const powerbi = require('powerbi-client');
const models = powerbi.models;
const embedConfiguration = {
type: 'report',
id: 'your-report-id',
embedUrl: 'your-embed-url',
accessToken: 'your-access-token',
tokenType: models.TokenType.Embed,
settings: {
filterPaneEnabled: false,
navContentPaneEnabled: false
}
};
const reportContainer = document.getElementById('reportContainer');
powerbi.embed(reportContainer, embedConfiguration);
Apply Filters to a Report
This code sample shows how to apply a filter to an embedded Power BI report. It creates a filter object and then uses the getFilters and setFilters methods to apply the filter to the report.
const filter = {
$schema: 'http://powerbi.com/product/schema#basic',
target: {
table: 'Sales',
column: 'Region'
},
operator: 'In',
values: ['North America']
};
report.getFilters().then(filters => {
filters.push(filter);
return report.setFilters(filters);
}).catch(error => {
console.error(error);
});
Capture Events from an Embedded Report
This code demonstrates how to capture events from an embedded Power BI report. It listens for 'loaded', 'rendered', and 'error' events and logs the corresponding messages to the console.
report.on('loaded', function() {
console.log('Report loaded');
});
report.on('rendered', function() {
console.log('Report rendered');
});
report.on('error', function(event) {
console.error(event.detail);
});
The tableau-api package allows developers to embed Tableau visualizations into web applications. Similar to powerbi-client, it provides APIs to interact with the embedded content, such as applying filters and capturing events. However, it is specific to Tableau's ecosystem.
JavaScript library for embedding Power BI into your apps.
See the wiki for more details about embedding, service configuration, setting a default page, page navigation, dynamically applying filters, and more.
See the code docs for detailed information about classes, interfaces, types, etc.
New live demo for a sample application using the powerbi-client
library in scenarios such as page navigation, applying filters, updating settings, and more.
Install via Nuget:
Install-Package Microsoft.PowerBI.JavaScript
Install from NPM:
npm install --save powerbi-client
Installing beta versions:
npm install --save powerbi-client@beta
Ideally you would use a module loader or a compilation step to import using ES6 modules as:
import * as pbi from 'powerbi-client';
However, the library is exported as a Universal Module and the powerbi.js script can be included before your app's closing </body>
tag as:
<script src="/powerbi-client/dist/powerbi.js"></script>
When included directly, the library is exposed as a global named powerbi-client
.
There is also another global named powerbi
which is an instance of the service.
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 repos 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
FAQs
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
The npm package powerbi-client receives a total of 170,416 weekly downloads. As such, powerbi-client popularity was classified as popular.
We found that powerbi-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.