Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Design studio - assign measure and axis type for dual axis chart in script

Hello,

In my application i need to use dual axis chart - two measures must be in columns (axis 1), third in line (axis 2).

If Data source property Load in script = false, it can be asily achieved by Additional properties of Chart:


But i have to use Data source (Load in script = true).

In that case there is no possibility to manage which measures should be assigned to which axis using script.


For example my script:

// Selecting 2 measures

DS_1.setFilter("6JW7K7JQYJR263T2MGQ78RZNN",["6JW7K7JQYJR263T2MGQ78TKJN","6JW7K7JQYJR263T2MGQ78TQV7"]);

//Setting Chart type

CHART_1.setChartType(ChartType.DUAL_COLUMN);

As shown each measures are in different Axis, but same type - column

Now add third measure:

// Selecting 3 measures

DS_1.setFilter("6JW7K7JQYJR263T2MGQ78RZNN",["6JW7K7JQYJR263T2MGQ78TKJN","6JW7K7JQYJR263T2MGQ78TQV7","6JW7K7JQYJR263T2MGQ78TX6R"]);

//Set Chart type

CHART_1.setChartType(ChartType.DUAL_COLUMN);

Now there are first measure in Axis 1 and the other two in Axis 2 and axis type column:

Is there any solution to control measure assignment and type of axis by scripting using standard functions?

Tags:
Former Member
replied

Hi Yaroslav,

If your 3 measures are fixed, then you can make the chart "remember" the axis assignments without scripting as follows:

1)  Initially set the Load in Script property of your data source to false;

2)  Assign the measures to the axes in the Advanced Properties Sheet as you have shown above;

3)  Now set the Load in Script property of your data source to true;

4)  Do not define any measure filtering using scripting (i.e. do not use setFilter or setChartType as you have shown above).

5)  Define the loadDataSource() method in the appropriate section of your script.

With this approach, the chart should remember your original axis assignment settings when the application is executed.

Regards,

Mustafa.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question