简体   繁体   English

PowerBI 嵌入式垂直滚动条不可见

[英]PowerBI Embedded vertical scrollbar not visible

I have embedded a PowerBI report.我嵌入了 PowerBI 报告。 This is the Javascript with the page setup.这是带有页面设置的 Javascript。

For some reason I don't get a vertical scrollbar in my report.出于某种原因,我的报告中没有垂直滚动条。 When I open it in the workspace online the scrollbars work just fine.当我在工作区在线打开它时,滚动条工作得很好。 I already tried switching between different 'View' options in PowerBi but that does not seem to make a difference.我已经尝试在 PowerBi 中的不同“查看”选项之间切换,但这似乎没有什么区别。

<H2>PowerBI</H2>
<p><i>User: {{username}} | AccessLevel: {{access_level}}</i></p>
<div id="reportContainer" style="height: 80vh;"></div>

<script type="text/javascript">
window.onload = function () {
 
// Get models. models contains enums that can be used.
var models = window['powerbi-client'].models;

var embedConfiguration = {
    type: 'report',
    id: '{{txtembedreportid}}',
    embedUrl: '{{txtreportembed}}',
    tokenType: models.TokenType.Embed,
    accessToken: '{{txtaccesstoken}}',
    settings: {
            layoutType: models.LayoutType.Custom,
            customLayout: {
                pageSize: {
                    type: models.PageSizeType.Widescreen,
                }
            },
            panes:{
                bookmarks: {
                    visible: false
                },
                fields: {
                    expanded: false
                },
                filters: {
                    expanded: false,
                    visible: false
                },
                pageNavigation: {
                    visible: true
                },
                selection: {
                    visible: true
                },
                syncSlicers: {
                    visible: true
                },
                visualizations: {
                    expanded: false
                }
           }
    }
};

var $reportContainer = $('#reportContainer');
var report = powerbi.embed($reportContainer.get(0), embedConfiguration);
report.fullscreen(); 
            }
</script>

Try adding the "displayOption" property with value "FitToWidth" in customLayout object, as this option will try to fit the report as per the total available size for the page and will introduce a scrollbar for the remaining part if necessary.尝试在 customLayout object 中添加值为“FitToWidth”的“displayOption”属性,因为此选项将尝试根据页面的总可用大小调整报告,并在必要时为剩余部分引入滚动条。

Also change "Widescreen" to "Custom" in pageSizeType object还要在 pageSizeType object 中将“宽屏”更改为“自定义”

After all changes, your embedConfiguration will become as following.完成所有更改后,您的 embedConfiguration 将如下所示。

var embedConfiguration = {
    type: 'report',
    id: '{{txtembedreportid}}',
    embedUrl: '{{txtreportembed}}',
    tokenType: models.TokenType.Embed,
    accessToken: '{{txtaccesstoken}}',
    settings: {
            layoutType: models.LayoutType.Custom,
            customLayout: {
                displayOption: models.DisplayOption.FitToWidth, // Add "FitToWidth"
                pageSize: {
                    type: models.PageSizeType.Custom, // Change to "Custom"
                }
            },
            panes:{
                bookmarks: {
                    visible: false
                },
                fields: {
                    expanded: false
                },
                filters: {
                    expanded: false,
                    visible: false
                },
                pageNavigation: {
                    visible: true
                },
                selection: {
                    visible: true
                },
                syncSlicers: {
                    visible: true
                },
                visualizations: {
                    expanded: false
                }
           }
    }
};

Refer docs: https://docs.microsoft.com/en-us/javascript/api/overview/powerbi/custom-layout参考文档: https://docs.microsoft.com/en-us/javascript/api/overview/powerbi/custom-layout

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

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