on 08-21-2014 12:24 AM
Hi all,
I have a requirement to display 3 different metrics on a chart, with each metric having a different minimum value on the y-axis. The user will select the metric they want to see and the chart will display that metric. The problem is two metrics are percents and the other is in dollars. I want to use the same chart for all 3 metrics to reduce the file size and computing necessary to have 3 chart components. I know in Xcelsius we could dynamically change min/max values. In Design Studio I don't see a scripting option to dynamically change the min/max values, but is there a workaround anyone has figured out? If not, does anyone know when this functionality might be available?
Thanks,
John Cintolo
Hello John,
On design time you can make it in Additional Properties. You need to scroll down and search for the scaling, dependent on chart type you will find it one or two times.
On run time you can use scripting:
CHART_1.setAxisScaling(chartAxisScaling, minValue, maxValue)
The scripting is avaiolable in release 1.3 SP1 for sure, so if you do not see it perhaps you have older release.
Regards, Karol
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi John,
When you change the Data selection, the Chart should automatically take up proper scaling. But if you still want both auto and Manual you can do this with a if condition. for eg:
if(chart is showing Percent measure)
{
{
CHART_1.setAxisScaling(chartAxisScaling.Y_AXIS, 0, 100);
}
else
{
CHART_11.removeAxisScaling(ChartAxisScaling.Y_AXIS);
}
}
This way you can leverage both auto and Manual Axis scaling
Regards,
Fazith Ali Z.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arjun
Like I asked is there a possibility that one value is always maximum,
i.e. Let's say you have three countries, US CANADA & MEXICO, if you know that US will always have the highest value, you can take that into account for the Max value.
If that is not the case, then you have to take all the three values and then check if they are working, luckily you have foreach function now which you can use.
But the Chart scales automatically is there any particualar reason you want to set it manually?
Regards,
Fazith Ali Z.
Hello Sheik,
Thank You for the reply, I can not determine which is the Max value with out loading data. So I used for each function and found the Max value .
When the chart scales automatically the values in Y-axis is repeating many times. Like below
So in order to set Max value in the setAxisScaling , I need to find the Max value on the fly and this chart will under go filtering as well from a Dimension filter.
But now I have a formula to find the Max value using Foreach Function , which is using in the initial load.
DS_1.sortByMeasure("vehicle_count",false);
var v1 = DS_1.getMembers("State", 100);
var i = 0;
var e = "";
var v2 =0;
var v3= 0;
v1.forEach(function(element, index) {
e = element.text;
v3= Convert.stringToInt( DS_1.getDataAsString("vehicle_count",{"State": e}));
if (i == index) {
v2= Convert.stringToInt( DS_1.getDataAsString("vehicle_count",{"State": e}));
}
else {
if(v2<v3){v2=v3;}
}
});
TEXT_1.setText("maxn"+v2);
Hope this is one of way to find Max value via scripting .
Regards
Arjun KT
Dear Arjun,
I think you found the right way to solve this problem which I have as well.
I try to reproduce your steps.
Could you give me more details about this?
Did you really solve the problem?
Where did you define this script? In a global variable?
Any information is very appreciated.
The initial question from John Cintolo was answered.
Shall I create a new discussion?
Regards,
Deniz
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.