Available in the Full Version

Linear Gauge - Orientation

This sample demonstrates how to change the orientation of the linear gauge and how to invert the scale.
Options
Orientation Is Scale Inverted

This sample is designed for a larger screen size.

On mobile, try rotating your screen, view full size, or email to another device.

This sample demonstrates how to change the orientation of the linear gauge and how to invert the scale.

Code View

Copy to Clipboard
<!DOCTYPE html>
<html>
<head>
    <title></title>

    <!-- Ignite UI for jQuery Required Combined CSS Files -->
    <link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
    <link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/structure/infragistics.css" rel="stylesheet" />

    <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script>
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>

    <!-- Ignite UI for jQuery Required Combined JavaScript Files -->
    <script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.core.js"></script>
    <script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.dv.js"></script>

    
</head>
<body>  

    <div style="width:100%; height:300px" >
        <div id="lineargauge"  />
    </div>
     
    <script type="text/javascript">

        $(function () {

            var linearGauge = $("#lineargauge");

            linearGauge.igLinearGauge({
                height: "300px",
                width: "60px",
                orientation: "vertical", 
                value: 85, 
                ranges: [
                    {
                        name: 'bad',
                        startValue: 0,
                        endValue: 33
                    },
                    {
                        name: 'acceptable',
                        startValue: 33,
                        endValue: 70
                    },
                    {
                        name: 'good',
                        startValue: 70,
                        endValue: 100
                    }],
                transitionDuration: 200,
            });

            // Orientation
            $("#orientationButton").click(function () {
                

                var orientation = linearGauge.igLinearGauge("option", "orientation") == "vertical" ? "horizontal" : "vertical";
                linearGauge.igLinearGauge("option", "orientation", orientation);

                if (orientation == "horizontal") {
                    linearGauge.igLinearGauge("option", "width", "100%");
                    linearGauge.igLinearGauge("option", "height", 60);
                }
                else {
                    linearGauge.igLinearGauge("option", "width", 60);
                    linearGauge.igLinearGauge("option", "height", 300);
                }

                $("#orientationButton").text(orientation == "horizontal" ? "Vertical" : "Horizontal");
            });

            // Scale Inversion
            $("#isScaleInvertedCheckBox").click(function () {
                linearGauge.igLinearGauge("option", "isScaleInverted", $(this).is(":checked"));
            });
        });
    </script>

    <fieldset id="graphOptions" style="margin-top: 30px; font-size:14px" >
        <legend>Options</legend>
        <table style="font-size:14px">
            <tr>
                <td>Orientation</td>
                <td>
                    <button id="orientationButton" style="width: 100px; margin: 12px 40px 12px 12px">Horizontal</button>
                </td>
                <td style="font-size:14px"> 
                    Is Scale Inverted
                </td>
                <td>
                    <input type="checkbox" id="isScaleInvertedCheckBox" style="width: 100px; margin: 12px" />
                </td>
            </tr>
        </table>
    </fieldset>
</body>
</html>