Hi experts,
I have searched SCN with "axis scaling", "layout" and "design studio" but I could not find a solution to the problem below. I am using Design Studio version 1.6:
I'm having trouble with the layout when I recalculate the x-axis for two charts. Both charts are not shown as designed. More information:
CHART_A = bar stacked
CHART_B = bar ("normal")
The business would like to ensure that the x-as of both charts are always equal. This means that a calculation must be made to determine the maximum value for both charts and subsequently, the maximum value of both charts must be applied as the maximum value for both charts. To enable the calculation the property regarding "axis scaling" must be checked and I have filled in dummy values for min and max (because they will directly calculated at start). The following code is applied at startup:
//Determine maximum values for both CHARTS
max_B = DS_2.getDataAsString("element")
value_max_B = Convert.stringToFloatUsingLocale(max_B);
max_A1 = DS_2.getDataAsString("element")
value_max_B1 = Convert.stringToFloatUsingLocale(max_A1);
max_A2 = DS_2.getDataAsString("element")
value_max_A2 = Convert.stringToFloatUsingLocale(max_A2);
max_A3 = DS_2.getDataAsString("element")
value_max_B3 = Convert.stringToFloatUsingLocale(max_A3);
value_max_A = value_max_A1 + value_max_A2 +value_max_A3;
//Set both axis equal to maximum value
if (value_max_B >= value_max_A)
{
CHART_A.setAxisScaling(ChartAxisScaling.X_AXIS, 0, value_max_B);
CHART_B.setAxisScaling(ChartAxisScaling.X_AXIS, 0, value_max_B);
}
else
{
CHART_A.setAxisScaling(ChartAxisScaling.X_AXIS, 0, value_max_A);
CHART_B.setAxisScaling(ChartAxisScaling.X_AXIS, 0, value_max_A);
}
All in all, the code works fine but the layout of both charts is not shown as designed but "as default" (e.g. Design Studio seems to ignore properties like show x-axis and the position of legend). When I remove the calculation regarding the x-axis both charts are shown as designed. Has anybody experience with this?
Thanks in advance!