Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can I set the limits of Qlik sense gauge to variable using the SDK?

I am creating a Qlik sense app using the SDK as part of a c# MVC project. My app has a gauge with a number of segments. Is it possible to set the limits for these segments to something other than an integer value i.e. can it be set to a measure or to a percent of a measure

4 Replies
konrad_mattheis
Partner - Creator III
Partner - Creator III

Hi,

you will do that with an expression on the qlik sense side on not in the extension / SDK side.

bye

Konrad

Øystein_Kolsrud
Employee
Employee

I am not an expert on the gauge visualization, but I believe the property you need to modify is the GaugeSegmentInfoLimits values of the GaugeProperties of your gauge object. I think it should look something like this (I haven't tried it though, so I apologize if it doesn't work out of the box, but at least I hope it points you in the right direction):

IGauge gauge;

var expressions = new[] {"=<expression1>", "=<expression2>", "=<expression3>"};

var myLimits = expressions.Select(e => new GaugeSegmentInfoLimits {Value = e});

using (gauge.SuspendedLayout)

{

    gauge.Properties.SegmentInfo.Limits = myLimits;

}

The expressions can of course be any expression that the engine can evaluate (like "Sum(Sales)").

ogster1974
Partner - Master II
Partner - Master II

You can either write an expression to set the gauge limits as I have done below or store in a variable and call that using the same method.

SET VarLimit=<Your Limit>

=$(VarLimit)

Not applicable
Author

I have set the value in code to a Variable WIPAlarm which is given a value based on the SQL script loaded. This achieves what I was trying to do.

Thanks

properties.SegmentInfo = new GaugeSegmentInfo

            {

                Colors = segColours,

                Limits = new List<GaugeSegmentInfoLimits>

                    {

                        new GaugeSegmentInfoLimits

                        {

                            Value = "=WIPAlarm"

                        }

                    }

               }