1
votes

I'm trying to create stacked column chart as on the picture attached, but I would like to remove "Effort" text highlighted in yellow.

The chart should display (per day) how many hours people worked on the project.

Stacked column chart

I have and XML view:

<core:View controllerName="sap.ui.demo.myFiori.view.Main"
    xmlns:core="sap.ui.core" xmlns:viz="sap.viz.ui5.controls"
    xmlns:viz.feeds="sap.viz.ui5.controls.common.feeds" xmlns:viz.data="sap.viz.ui5.data"
    xmlns="sap.m">
    <App>
        <Page title="Reporting">
            <viz:VizFrame xmlns:viz="sap.viz.ui5.controls" id="idVizFrame"
                uiConfig="{applicationSet:'fiori'}" vizType="stacked_column" width="100%">
                <viz:dataset>
                    <dataSet:FlattenedDataset xmlns:dataSet="sap.viz.ui5.data" data="{/Time}">
                        <dataSet:dimensions>
                            <dataSet:DimensionDefinition name="Date" value="{date}">
                            </dataSet:DimensionDefinition>

                            <dataSet:DimensionDefinition name="Name" value="{name}">
                            </dataSet:DimensionDefinition>

                        </dataSet:dimensions>
                        <dataSet:measures>
                            <dataSet:MeasureDefinition name="Effort" value="{real_effort}">
                            </dataSet:MeasureDefinition>
                        </dataSet:measures>
                    </dataSet:FlattenedDataset>
                </viz:dataset>
                <viz:feeds>
                    <feed:FeedItem xmlns:feed="sap.viz.ui5.controls.common.feeds"
                        uid="valueAxis" type="Measure" values="Effort"/>
                    <feed:FeedItem xmlns:feed="sap.viz.ui5.controls.common.feeds"
                        uid="categoryAxis" type="Dimension" values="Date" />
                    <feed:FeedItem xmlns:feed="sap.viz.ui5.controls.common.feeds"
                        uid="color" type="Dimension" values="Name" />
                </viz:feeds>
            </viz:VizFrame>
        </Page>
    </App>
</core:View>

In the controller in the onInit function I tried to set vizProperties. But when I set hidSubLevels of label of categoryAxis to true, then dates disappear. I don't understand why "Effort" is displayed as category, because it is defined as measure, not category. Could someone please advise how to do such chart without category "Effort" (yellow-highlighted on the picture attached)?

var oVizFrame = this.getView().byId("idVizFrame");
oVizFrame.setVizProperties({
  interaction: {
    behaviorType: null
  },
  plotArea: {
    dataLabel: {
      visible: false
    }
  },
  valueAxis: {
    title: {
      visible: true,
    },
  },
  categoryAxis: {
    title: {
      visible: false,
      text: 'Category text'
    },
    label: {
      hideSubLevels: false
    },
  },
  title: {
    visible: true,
    text: 'Project'
  },
  tooltip: {
    visible: true,
  }
});
1

1 Answers

1
votes

Setting the visibility of the categoryAxis to false seems like the correct approach. I took your code and put it into a Plunker and it works there.

Can you please remove as many as other possible configurations and try it again. If that doesn't help, can you please update my Plunker and create a runnable version of your issue? Maybe it's also a UI5 version issue. You could also try out to upgrade to a newer version.

Here's my Plunker: https://embed.plnkr.co/td2ANcu0F2lZVgd7dfTC/