Line chart doesn't show in Object Page - Vizfr

2019-08-22 03:40发布

I am trying to make a line chart using Vizframe in an Object Page. Does anybody have an example how to do it? I searched the APIs and the sdn but find just samples with Layout element and not Object Page Layout element.
So when I test it within a simple Layout element (< layout > element) the line charts works fine. But when I try it with Object Page Layout elementt, the chart doesn't show and there is no errors in the console.

Thanks a lot,

Haylee N.

I joined the two different views here:

View.xml with Layout element ( that works )

<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core"
    xmlns:u="sap.uxap" xmlns:layout="sap.ui.layout" xmlns="sap.m" xmlns:f="sap.f"
    xmlns:t="sap.ui.table" xmlns:viz="sap.viz.ui5.controls" xmlns:viz.data="sap.viz.ui5.data"
    xmlns:viz.feeds="sap.viz.ui5.controls.common.feeds" xmlns:sample="test.controller.ChartsOverview"
    xmlns:goals="test.view.goals" controllerName="test.controller.ChartsOverview"
    height="100%">

    <Page title="SAPUI5 App">
        <layout:FixFlex id='chartFixFlex' minFlexSize="250">
            <layout:fixContent>
                <Panel id='settingsPanel' class="panelStyle" expandable="true"
                    expanded="true" headerText="Summary" width="auto">
                    <content>
                        <HBox class='settingsHBox'>
                            <VBox width="200px">
                                <Label text='Reports' design="Bold" class='settingsLabel'></Label>
                            </VBox>
                        </HBox>
                    </content>
                </Panel>
            </layout:fixContent>
            <layout:flexContent>
                <viz:Popover id="idPopOver"></viz:Popover>
                <viz:VizFrame id="idVizFrame" uiConfig="{applicationSet:'fiori'}"
                    height='50%' width="50%" vizType='timeseries_line'>
                    <viz:dataset>
                        <viz.data:FlattenedDataset data="{/milk}">
                            <viz.data:dimensions>
                                <viz.data:DimensionDefinition name="Date"
                                    value="{Date}" dataType="date" />
                            </viz.data:dimensions>
                            <viz.data:measures>
                                <viz.data:MeasureDefinition name="Revenue"
                                    value="{Revenue}" />
                            </viz.data:measures>
                        </viz.data:FlattenedDataset>
                    </viz:dataset>

                    <viz:feeds>
                        <viz.feeds:FeedItem uid="valueAxis" type="Measure"
                            values="Revenue" />
                        <viz.feeds:FeedItem uid="timeAxis" type="Dimension"
                            values="Date" />
                    </viz:feeds>
                </viz:VizFrame>
            </layout:flexContent>
        </layout:FixFlex>
    </Page>

</mvc:View>

View.xml with Object Page Layout element ( that doesn't work )

<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core"
    xmlns="sap.uxap" xmlns:layout="sap.ui.layout" xmlns:m="sap.m" xmlns:f="sap.f"
    xmlns:t="sap.ui.table" xmlns:viz="sap.viz.ui5.controls" xmlns:viz.data="sap.viz.ui5.data"
    xmlns:viz.feeds="sap.viz.ui5.controls.common.feeds" xmlns:sample="test.controller.ChartsOverview"
    xmlns:goals="test.view.goals" controllerName="test.controller.ChartsOverview"
    height="100%">
    <m:Page showHeader="true" title="{i18n>appTitle}" showFooter="true"
        showNavButton="false">
        <ObjectPageLayout id="ObjectPageLayout"
            enableLazyLoading="false" subSectionLayout="TitleOnLeft"
            showTitleInHeaderContent="true" showHeaderContent="true">
            <headerTitle>
                <ObjectPageHeader objectTitle="Quality Monitor"
                    objectSubtitle="Reports based on errors processed"
                    isObjectIconAlwaysVisible="false" isObjectTitleAlwaysVisible="false"
                    isObjectSubtitleAlwaysVisible="false" isActionAreaAlwaysVisible="true"
                    id="ObjectPageLayoutHeaderTitle">
                    <actions>
                    </actions>
                </ObjectPageHeader>
            </headerTitle>

            <sections>

                <ObjectPageSection title="Charts">
                    <subSections>
                        <ObjectPageSubSection>
                            <blocks>
                                <viz:Popover id="idPopOver"></viz:Popover>
                                <viz:VizFrame id="idVizFrame" uiConfig="{applicationSet:'fiori'}"
                                    height='50%' width="50%" vizType='timeseries_line'>
                                    <viz:dataset>
                                        <viz.data:FlattenedDataset data="{/milk}">
                                            <viz.data:dimensions>
                                                <viz.data:DimensionDefinition
                                                    name="Date" value="{Date}" dataType="date" />
                                            </viz.data:dimensions>
                                            <viz.data:measures>
                                                <viz.data:MeasureDefinition name="Revenue"
                                                    value="{Revenue}" />
                                            </viz.data:measures>
                                        </viz.data:FlattenedDataset>
                                    </viz:dataset>

                                    <viz:feeds>
                                        <viz.feeds:FeedItem uid="valueAxis" type="Measure"
                                            values="Revenue" />
                                        <viz.feeds:FeedItem uid="timeAxis" type="Dimension"
                                            values="Date" />
                                    </viz:feeds>
                                </viz:VizFrame>
                            </blocks>

                        </ObjectPageSubSection>
                    </subSections>
                </ObjectPageSection>

            </sections>
        </ObjectPageLayout>
    </m:Page>
</mvc:View>

1条回答
forever°为你锁心
2楼-- · 2019-08-22 04:19

Whoever may come here for an answer, giving the height of vizframe with pixels does the trick.

查看更多
登录 后发表回答