sapui5 fiori xml 查看如何添加BulletChart

sapui5 fiori xml view how to add the BulletChart

我正在用 fiori (sap web ide) 编码,但我缺乏理解:

<mvc:View
xmlns="sap.m"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form" controllerName="test.view.Detail">
<Page id="detailPage" navButtonPress="onNavBack" title="{i18n&gt;detailTitle}" showNavButton="{device&gt;/isPhone}">
    <content>
        <ObjectHeader id="detailHeader" title="{SelectedOption}" introActive="false" titleActive="false" iconActive="false">
            <customData id="customData3">
                <core:CustomData id="coreCustomData3" key="sapDtResourcePath" value="ClaimingHeader"></core:CustomData>
            </customData>
            <attributes id="detailAttributes">
                <ObjectAttribute id="attribute" text="{i18n&gt;detailText}" active="false"></ObjectAttribute>
            </attributes>
            <firstStatus id="detailStatus">
                <ObjectStatus id="status" text="{SelectedOption}">
                    <customData id="customData4">
                        <core:CustomData id="coreCustomData4" key="sapDtResourcePath" value="ClaimingHeader"></core:CustomData>
                    </customData>
                </ObjectStatus>
            </firstStatus>
        </ObjectHeader>
        <IconTabBar id="idIconTabBar" expanded="{device&gt;/isNoPhone}">
            <customData id="customData5">
                <core:CustomData id="coreCustomData5" key="sapDtResourcePath" value="ClaimingHeader"></core:CustomData>
            </customData>
            <items id="detailsItems">
                <IconTabFilter id="iconTabFilter1" key="selfInfo" icon="sap-icon://calendar">
                    <content>
                        <f:SimpleForm id="iconTabFilter1form" minWidth="1024" editable="false" layout="ResponsiveGridLayout" labelSpanL="3" labelSpanM="3" emptySpanL="4" emptySpanM="4" columnsL="1">
                            <f:content>

在代码的底部,我想包含来自 sapui5 sdk 的示例代码: Code: Bullet Micro Chart

问题是,BulletChart 的代码以

开头
<core:View controllerName="sap.suite.ui.commons.sample.BulletChart.BulletChart" xmlns="sap.suite.ui.commons" xmlns:core="sap.ui.core">

我的问题是,它不起作用,如果我添加这个 core:View.. inside of mvc:View.. and/or 它是另一个控制器,controllerName ="sap.suite.ui.commons.sample.BulletChart.BulletChart,想把 inside mvc:view 放在已经有控制器的地方。

谁能帮我解释一下,如何把这个 BulletChart 放在这个地方?

感谢帮助! Imageshack 上的屏幕截图我想做什么 @ 下面的 link。

Screenshot on Imageshack what i want to do

您必须按照下面描述的方式进行操作:

xmlns:commons="sap.suite.ui.commons" 添加到您的 XML

<mvc:View
xmlns="sap.m"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form" 
xmlns:commons="sap.suite.ui.commons"
controllerName="test.view.Detail">

然后在页面内容中添加:注意我们需要根据xmlns声明

有适当的命名空间
<commons:BulletChart size="XS" scale="M" targetValue="100" forecastValue="110" class="marginTopLeft" press="press">
  <commons:actual>
    <commons:BulletChartData value="120" color="Good"/>
  </commons:actual>
  <commons:thresholds>
    <commons:BulletChartData value="0" color="Error"/>
    <commons:BulletChartData value="50" color="Critical"/>
    <commons:BulletChartData value="150" color="Critical"/>
    <commons:BulletChartData value="200" color="Error"/>
  </commons:thresholds>
</commons:BulletChart>