Skip to Content

How can I add and remove Measures dynamically in sapui5 VizFrame?

Dec 11, 2017 at 11:09 AM


avatar image

I would like to change Measures dynamically in my VizFrame like in ChartDemo App from sapui5 docs [link below].

So when I click to one of my five checkboxes the proper Measure will be added or removed in case of unchecking. I have one json from which I get data.

I've tried with this code:

                       oVizFrame.removeFeed(feedValuesAxis);                                       feedValuesAxis.setValues("ValueFromJSON");           
                       oVizFrame.addFeed(feedValuesAxis);                    }

But it causes error:

[50005] - valueAxis : does not meet the minimum or maximum number of feeds definition.

I am using SAP UI5 version 1.28. I have one VizFrame, one Dataset with all Measures and two FeedItem one for values and one for Dimension.

I guess I have to create a binding, right? But how should I do it? Thanks a lot for any pieces of advice.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Chapman Wong
Dec 27, 2017 at 03:37 AM

In order to update the measures/dimensions, you should destroy the dataset and feedItems first which were previously bound to vizFrame:



Then you redefine the new ones:

var newDataset = new;

var newFeeds = new sap.viz.ui5.controls.common.feeds.FeedItem(......);

You could use vizUpdate to bound them back to vizFrame

vizFrame.vizUpdate({data: "newDataset", feeds: "newFeeds"})
10 |10000 characters needed characters left characters exceeded
Arjun Biswas Dec 12, 2017 at 10:22 AM


You can view this app and its code to modify measures at runtime.


Arjun Biswas

10 |10000 characters needed characters left characters exceeded