2017-09-19 11 views
0

サンプルコードのJavaScriptを使用してPowerBi DashboardをHTMLファイルに埋め込みたいと考えています(this GitHub)。私は取得していますエラーです:未定義またはnull参照のPowerBi JavaScriptダッシュボードembedConfiguration

プロパティを取得できません 'モデルの

私は、ヘッド部に追加する必要が.jsファイル足りませんか?

あなたが ECMAScript 6(ES6)を含める必要が
<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8" /> 
    <title></title> 
    <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.7.js"></script> 
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/jquery-ui.js"></script>` 
    <script> 
    $(document).ready(function() { 
     // Get models. models contains enums that can be used. 
     var models = window['powerbi-client'].models; 
     var embedConfiguration = { 
     type: 'dashboard', 
     id: 'dashboardid', 
     embedUrl: 'https://app.powerbi.com/reportEmbed', 
     tokenType: models.TokenType.Aad, 
     accessToken: 'TokenKey' 
     }; 
     var $dashboardContainer = $('#embedContainer'); 
     var dashboard = powerbi.embed($dashboardContainer.get(0), embedConfiguration); 
     }); 
    </script> 
</head > 
    <body> 
    <div id="dashboardContainer"></div> 
    </body > 
</html > 
+0

、と試みることができるあなたがPowerBi JSライブラリを含めることを試みたことがありますか?その後、あなたはd3が必要かもしれないと思います。また – Alberto

答えて

0

<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.3/es6-shim.js"></script> 

それはあなたのことを表示されませんので、あなたはまた、任意の必要なJSファイルと一緒に、実際のPowerBiライブラリをロードする必要がありますあなたが提供したコードでは、すでにそうしています。

また、$dashboardContainerの変数$('#embedContainer')は、指定したHTMLの要素ではありません。あなたのHTMLにID#dashboardContainerを使用しました。

+0

これはPowerBiライブラリですか[githubサイト](https://github.com/Microsoft/PowerBI-JavaScript)v2-demo/scripts /にファイルが必要ですか? – Mcdevitt

0

あなたは

<script src="https://raw.githubusercontent.com/Microsoft/PowerBI-JavaScript/master/dist/powerbi.js"></script>

+0

私はraw.githubusercontent APIを試しましたが、まだSCRIPT5009を取得しました。「models」は未定義ですが、APIを呼び出す正しい方法です。 VAR embedConfiguration = { タイプ: 'ダッシュボード'、 ID: 'DashboardID' embedUrl 'https://app.powerbi.com/dashboardEmbed' tokenType:models.TokenType.Aad、 accessToken 'TokenKey' }; var $ dashboardContainer = $( '#embedContainer'); var dashboard = powerbi.embed($ dashboardContainer.get(0)、embedConfiguration); – Mcdevitt

+0

https://stackoverflow.com/a/46435033/6612255 @Mcdevitt – Yash

関連する問題