Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

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

Tags (1)
4 Replies
konrad_mattheis
Contributor III

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

Hi,

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

bye

Konrad

Employee
Employee

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

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
Honored Contributor II

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

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

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

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"

                        }

                    }

               }

Community Browser