Completed
Last Updated: 04 Mar 2019 21:39 by ADMIN
ADMIN
Danail Vasilev
Created on: 29 Sep 2014 08:41
Category: Gauge
Type: Feature Request
3
ADD templates for labels in RadGauge
You can do this with the Template property of the Label object

			<telerik:RadLinearGauge runat="server" ID="rlg1">
				<Scale Min="1" Max="4" MajorUnit="1">
					<Labels Template="#= getLabelText(value)#" />
				</Scale>
			</telerik:RadLinearGauge>
			<telerik:RadRadialGauge runat="server" ID="rrg1">
				<Scale Min="1" Max="4" MajorUnit="1">
					<Labels Template="#= getLabelText(value)#" />
				</Scale>
			</telerik:RadRadialGauge>
			<script>
				function getLabelText(e) {
					return "label for " + e;
				}
			</script>

For old versions the template can be set through the kendoWidget:

ASPX:

        <script>
            function setGaugeLabels(value) {
                switch (value) {
                    case -10:
                        return "Min: " + -10;
                        break;
                    case 35:
                        return "Max: " + 35;
                        break;
                    default:
                        return "Name: " + value;
                        break;
                }
            }
            function pageLoad() {
                var gaugeObj = $find("<%=RadLinearGauge1.ClientID%>")._gaugeObject;
                gaugeObj.options.scale.labels.template = "#=setGaugeLabels(value)#";
                gaugeObj.redraw();
            }
        </script>
        <telerik:RadLinearGauge runat="server" ID="RadLinearGauge1" Height="300px" Width="100px">
            <Pointer Value="11" Color="Green">
            </Pointer>
            <Scale Min="-25" Max="50" MajorUnit="15" MinorUnit="1">
                <Labels Format="{0} °C" />
                <Ranges>
                    <telerik:GaugeRange From="-25" To="-5" Color="Blue" />
                    <telerik:GaugeRange From="-5" To="15" Color="LightBlue" />
                    <telerik:GaugeRange From="15" To="30" Color="GreenYellow" />
                    <telerik:GaugeRange From="30" To="50" Color="Red" />
                </Ranges>
            </Scale>
        </telerik:RadLinearGauge>
0 comments