子聚合中父聚合的SAPUI5 XMLView聚合绑定路径

问题描述 投票:0回答:1

我想要生成n不。基于从服务读取的配置数据的图表。这是我的json结构

{
"opr": 
{
    "c1":{"data": [{"period": "Apr-16",
            "bmx": "1.133",
            "bsl": "0.083"}],
                              "props":{"title":"Monthly Production ","viztype":"dual_stacked_combination","dimension":[{"name":"period","value":"period"}],
                         "vizproperties":"{legendGroup :{layout :{position : 'bottom'},forceToShow: true,linesOfWrap: 2}}",
                         "measures":[   {"name":"BMX","value":"bmx"},       {"name":"BSL","value":"bsl"}],
                                             "feeds":[{"uid":"valueAxis2","type":"Measure","values":"BMX"},{"uid":"valueAxis2","type":"Measure","values":"BSL" },{"uid":"categoryAxis","type":"Dimension","values":"period" }]}},
    "c2":{"data": [],
                                 "props":{"dimension":[],"feeds":[],"measures":[]}

这是我的xmlviewcode

<HBox width="100%" items="{path:'infoChartModel>/opr',templateShareable:false}">
        <su:ChartContainer
                            showFullScreen="true"
                            showPersonalization="false"
                            autoAdjustHeight="false"
                            showZoom="false"
                            title="{infoChartModel>props/title}">                           
                            <su:content>
                                <su:ChartContainerContent icon="sap-icon://line-chart" title="Chart View">
                                    <su:content>                            
                                        <viz:VizFrame width="100%" vizType='{infoChartModel>props/viztype}'
                                        vizProperties="{infoChartModel>props/vizproperties}" feeds="{path:'infoChartModel>props/feeds',templateShareable:false}"> 
                                            <viz:dataset>
                                                <viz.data:FlattenedDataset data="{infoChartModel>data}"
                                                measures="{path:'infoChartModel>props/measures',templateShareable:false}" 
                                                dimensions="{path:'infoChartModel>props/dimension',templateShareable:false}" >
                                                    <viz.data:dimensions >
                                                        <viz.data:DimensionDefinition name="{infoChartModel>name}" value="{parts:[{path:'infoChartModel>value'},{path:'infoChartModel>/opr/data'}],formatter:'.getDimVal'}" />
                                                    </viz.data:dimensions>
                                                    <viz.data:measures>
                                                        <viz.data:MeasureDefinition name="{infoChartModel>name}" value="{parts:[{path:'infoChartModel>value'},{path:'infoChartModel>/opr/data'}],formatter:'.getMeasureVal'}" />
                                                    </viz.data:measures>
                                                </viz.data:FlattenedDataset>
                                            </viz:dataset>
                                            <viz:feeds>
                                                <viz.feeds:FeedItem uid="{infoChartModel>uid}" type="{infoChartModel>type}" values="{infoChartModel>values}" />
                                            </viz:feeds>
                                        </viz:VizFrame>
                                    </su:content>
                                </su:ChartContainerContent>
                        </su:content>       
                        </su:ChartContainer>
                </HBox>

我面临的挑战是如何将维度/度量聚合的“值”属性绑定到FlattenedDataset数据中的值(来自父级)。它的嵌套聚合问题引用来自子聚合的父值。

Similar point is discussed here。(17:51来自用户dlgrasse的回复)

在此先感谢您的帮助。

sapui5 aggregation
1个回答
0
投票

感谢大家。使用工厂功能解决了它。代码是共享here

© www.soinside.com 2019 - 2024. All rights reserved.