Bar chart refreshed based on MDX


#1

Hi All,

I have a bar chart in a report where X Axis is refreshed based on a mdx expression for which the parameters come from a SUBNM. The same mdx expression is used to update the column in a table where it works perfectly.
The issue is that in the chart when I change the selection in the SUBNM, the new elements from the updated MDX are added to the axis of the chart and not replace the currently displayed.

Any idea?
thanks

Stephane


#2

Hi Stephane,

You need to add the attribute tm1-state to the tm1-ui-chart directive:

tm1-state="{{selections.version}},{{selections.year}},{{selections.product}},{{selections.measure}}">

By using the tm1-state, you are forcing the chart data to refresh if one of the variable change in the tm1-state change.

<tm1-ui-chart tm1-chart-type="discreteBar" 
tm1-data-decimal="0" 
tm1-hide-controls="true" 
tm1-height="180"
tm1-margin="{top:10,bottom:60,left:40, right:5}"
tm1-legend="none" tm1-color-scheme='["#02C39A", "#02C39A" ,"#02C39A"]' 
tm1-axis-label-x="" 
tm1-rotate-label="-30" 
tm1-options-override="optionsOverride"
tm1-state="{{selections.version}},{{selections.year}},{{selections.product}},{{selections.measure}}">

	<tm1-ui-chart-dbr ng-repeat="region in lists.country" 
                tm1-label="{{region.alias}}" 
                tm1-instance="dev" 
                tm1-cube="Retail" 
                tm1-elements="{{selections.version}},{{selections.year}},Year,local,{{region.key}},{{selections.product}},{{selections.measure}}">
		</tm1-ui-chart-dbr>

</tm1-ui-chart>

#3

Thanks @Vincent !