Sign in to follow this  
domurtag

change upper limit of Angular gauge at runtime

Recommended Posts

Hi,
 
I'm using an angular gauge which is updated in real-time with values received from the server. If the upper limit of the gauge is currently 200, and I receive a value of 250, then I want to increase the upper limit of the gauge to something slightly larger than 250 before displaying this new value. My effort at implementing this is shown below:

chart.addEventListener("RealtimeUpdateComplete", function (event, parameter) {

        var newValue = event.sender.getData(1);
        var currentUpperLimit = parseInt(chart.getChartAttribute("upperLimit"));

        if (newValue > currentUpperLimit) {

            var newUpperLimit = newValue * 1.2;

            chartRef.setChartAttribute("upperLimit", newUpperLimit);
            chartRef.setChartAttribute("upperLimitDisplay", newUpperLimit);
        }
    }
);

This seemed to be the right approach, however when a value is received from the server which is larger than the upper limit of the gauge, the variable newValue is always set to 0. Strangely, this variable is set correctly when the value received is lower than the gauge's upper limit. Is there another way to change the upper limit of the gauge at runtime so that it always exceeds the current value of the gauge?

Edited by domurtag

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this