简体   繁体   English

Power BI 自定义主题文件未应用于 Angular

[英]Power BI Custom theme file is not getting applied with Angular

We are using pbi-client to embed pbi report in our angular app.我们正在使用 pbi-client 在我们的 angular 应用程序中嵌入 pbi 报告。 We are passing custom theme file with embed configuration as well as we tried to apply it on the pbi report load.我们正在传递带有嵌入配置的自定义主题文件,并尝试将其应用于 pbi 报告加载。 It seems custom theme file is not getting override the default theme of pbi.似乎自定义主题文件没有覆盖 pbi 的默认主题。 Please find below code:请找到以下代码:

  1. theme file with embed config:带有嵌入配置的主题文件:

const embedConfig = { type: 'report', embedUrl: embedUrl + '?' const embedConfig = { type: 'report', embedUrl: embedUrl + '?' + 'xxxxId=' + xxxxId + '&yyyyId=' + yyyyId, accessToken: embedToken, permissions: models.Permissions.All, tokenType: models.TokenType.Embed, theme: {themeJson: powerbiTheme}, viewMode: models.ViewMode.View }; + 'xxxxId=' + xxxxId + '&yyyyId=' + yyyyId,accessToken:embedToken,权限:models.Permissions.All,tokenType:models.TokenType.Embed,主题:{themeJson:powerbiTheme},viewMode:models.ViewMode.View }; 2. theme file after report load: self.report.applyTheme({theme:powerbiTheme}); 2.报表加载后的主题文件:self.report.applyTheme({theme:powerbiTheme});

Please follow the below code snippets to apply custom theme to the Power BI report:请按照以下代码片段将自定义主题应用于 Power BI 报告:

  • To apply theme with embedConfig:使用 embedConfig 应用主题:
    1. Import custom theme file like below:导入自定义主题文件,如下所示:
     const theme = require("../custom-theme.json");
    1. Assign the theme to themeJson property of theme property in embedConfig object:分配主题themeJson的财产theme财产embedConfig对象:
     embedConfig: IReportEmbedConfiguration = { type: "report", embedUrl: "EMBED URL", tokenType: models.TokenType.Embed, accessToken: "ACCESS TOKEN", settings: "SETTINGS", theme: { themeJson: theme } };
  • To apply theme after report load, Use:要在报告加载后应用主题,请使用:
    1. Import custom theme file like below:导入自定义主题文件,如下所示:
     const theme = require("../custom-theme.json");
    1. In any method:在任何方法中:
     self.report.applyTheme({ themeJson: theme });

Please refer docs: https://docs.microsoft.com/javascript/api/overview/powerbi/apply-report-themes请参考文档: https : //docs.microsoft.com/javascript/api/overview/powerbi/apply-report-themes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM