Skip to Content

Changing Measure definition of Vizflex chart from controller

Hi Everyone,

I am quite new to UI5 development.

I have a requirement to change the measure definition of the viz flex chart on the click of buttons, so I am trying doing it by changing it from the controller.js on the basis of conditions. But I am not sure how it can be done from controller.js.

OR should I display multiple charts one above other with different measure definitions and show/hide from them with the controller.

Please let me know how this can be achieved.

I have to change highlighted measures in the image with the click of buttons.

This is how I display the chart.


  <l:FixFlex id='chartFixFlex' minFlexSize="300">
    <l:flexContent>
     <viz:Popover id="idPopOver"></viz:Popover>
        <viz:VizFrame id="idVizFrame" uiConfig="{applicationSet:'fiori'}" 
              height="100%" width= "100%" vizType='dual_column'>
                  <viz:dataset>
                  <viz.data:FlattenedDataset data="{/count}">
                  <viz.data:dimensions>
                  <viz.data:DimensionDefinition name="Net Trade Sales" value="{Days}" />
                  </viz.data:dimensions>
                  <viz.data:measures>
                     <viz.data:MeasureDefinition name="Actual" value="{line1}" />
                     <viz.data:MeasureDefinition name="Budget" value="{line2}" />
                       </viz.data:measures>
                        </viz.data:FlattenedDataset>
                         </viz:dataset>
                          </viz:VizFrame>
                          </l:flexContent>
                       </l:FixFlex>


arch.png (8.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 26 at 10:51 AM

    Updating measure/dimension binding at runtime meaning:

    1. you must destroy the feeds and dataset which was bound to vizFrame by calling

    vizFrame.destroyFeeds();
    vizFrame.destroyDataset();

    2. redefine the dataset and feed items for vizFrame. If you use oData as datasource, you need to fire a new batch.

    3. Then rebind and refed them back to vizFrame by calling

    vizFrame.vizUpdate({data: newDataset, feeds: newFeeds})
    Add comment
    10|10000 characters needed characters exceeded