Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

TagCloud / Weighted Styling of the Items


  • Weighted Visualization of the Tags

    RadTagCloud styles the items, with different weight, using font-size and color. The items with greater weight have greater font size, and different color. The user can easily control how the font-size and color is distributed among the tags.

    The range of the font size, the keywords could have, can be defined using the MinFontSize and MaxFontSize properties. Both of them take values of type System.Web.UI.WebControls.Unit, so the user can specify whether the font size is applied in pixels, percentage values, em values and so on, by setting the values to the MinFontSize and MaxFontSize in the desired System.Web.UI.WebControls.UnitType.The default values for the MinFontSize and MaxFontSize properties are 10px and 20px, respectively.

    Similarly, as the font-size, the fore color of the tagCloud items can be specified using the MinColor and MaxColor properties. The default value of both properties is System.Drawing.Color.Empty, which means the fore color is applied from the built-in skins. Note that you need to supply values to both properties, in order for the items to have their fore color dynamically applied. In case the ForeColor is also specified, the value of the ForeColor property will not be applied.



Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="c#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.TagCloud.Range.DefaultCS"
        CodeFile="DefaultCS.aspx.cs" %>

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <qsf:HeadTag ID="Headtag1" runat="server" />
        <style type="text/css">
            .mainDiv
            {
                width: 100%;
                min-height: 310px;
                margin-top: 20px;
                height: auto;
            }
            .configuratorDiv
            {
                width: 100px;
            }
        </style>
    </head>
    <body class="BODY">
        <form id="Form2" method="post" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="C#" ShowSkinChooser="true" />
        <telerik:RadScriptManager ID="ScriptManager" runat="server" />
        <telerik:RadFormDecorator ID="FormDecorator" runat="server" DecoratedControls="RadioButtons" />
        <telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" MinDisplayTime="500">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxManager ID="AjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="sliderRange">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTagCloud1" LoadingPanelID="LoadingPanel1"
                            UpdatePanelRenderMode="Block" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="rblUnitType">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTagCloud1" LoadingPanelID="LoadingPanel1"
                            UpdatePanelRenderMode="Block" />
                        <telerik:AjaxUpdatedControl ControlID="rblUnitType" />
                        <telerik:AjaxUpdatedControl ControlID="panelSlider" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="pickerMinColor">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTagCloud1" LoadingPanelID="LoadingPanel1"
                            UpdatePanelRenderMode="Block" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="pickerMaxColor">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTagCloud1" LoadingPanelID="LoadingPanel1"
                            UpdatePanelRenderMode="Block" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <div class="mainDiv">
            <h3>
                Some of the Longest Rivers on Earth
            </h3>
            <div style="width: 500px; margin-bottom: 50px;">
                <telerik:RadTagCloud ID="RadTagCloud1" runat="server" MaxFontSize="50px" Width="500px"
                    MinColor="#c0c0c0" MaxColor="#008000">
                    <Items>
                        <telerik:RadTagCloudItem Text="Ural" Weight="2428" />
                        <telerik:RadTagCloudItem Text="Yukon" Weight="3700" />
                        <telerik:RadTagCloudItem Text="Amazon" Weight="6400" />
                        <telerik:RadTagCloudItem Text="Dnieper" Weight="2287" />
                        <telerik:RadTagCloudItem Text="Niger" Weight="4200" />
                        <telerik:RadTagCloudItem Text="Danube" Weight="2850" />
                        <telerik:RadTagCloudItem Text="Nile" Weight="6650" />
                        <telerik:RadTagCloudItem Text="Volga" Weight="3645" />
                        <telerik:RadTagCloudItem Text="Tigris" Weight="1950" />
                        <telerik:RadTagCloudItem Text="Brahmaputra" Weight="2948" />
                    </Items>
                </telerik:RadTagCloud>
            </div>
            <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Title="Configure Example"
                Expanded="true">
                <div style="width: 180px; float: left; margin: 0 10px 0 35px; _margin: 0 10px 0 25px;">
                    <span>Choose MinColor:</span>
                    <telerik:RadColorPicker runat="server" ID="pickerMinColor" Columns="5" Width="180"
                        Preset="None" Style="margin: 10px 0 0 0;" OnColorChanged="ColorPicker_ColorChanged"
                        AutoPostBack="true" SelectedColor="#c0c0c0">
                        <telerik:ColorPickerItem Title="Yellow" Value="#FFFF00" />
                        <telerik:ColorPickerItem Title="Light Green" Value="#00FF00" />
                        <telerik:ColorPickerItem Title="Turquoise" Value="#00FFFF" />
                        <telerik:ColorPickerItem Title="Pink" Value="#FF00FF" />
                        <telerik:ColorPickerItem Title="Blue" Value="#0000FF" />
                        <telerik:ColorPickerItem Title="Red" Value="#FF0000" />
                        <telerik:ColorPickerItem Title="Dark Blue" Value="#000080" />
                        <telerik:ColorPickerItem Title="Teal" Value="#008080" />
                        <telerik:ColorPickerItem Title="Green" Value="#008000" />
                        <telerik:ColorPickerItem Title="Violet" Value="#800080" />
                        <telerik:ColorPickerItem Title="Dark Red" Value="#800000" />
                        <telerik:ColorPickerItem Title="Dark Yellow" Value="#808000" />
                        <telerik:ColorPickerItem Title="Gray - 50%" Value="#808080" />
                        <telerik:ColorPickerItem Title="Gray - 25%" Value="#C0C0C0" />
                        <telerik:ColorPickerItem Title="Black" Value="#000000" />
                    </telerik:RadColorPicker>
                </div>
                <div style="width: 180px; float: left; margin-right: 50px;">
                    <span>Choose MaxColor:</span>
                    <telerik:RadColorPicker runat="server" ID="pickerMaxColor" Columns="5" Width="180"
                        Preset="None" Style="margin: 10px 0 0 0;" OnColorChanged="ColorPicker_ColorChanged"
                        AutoPostBack="true" SelectedColor="#008000">
                        <telerik:ColorPickerItem Title="Yellow" Value="#FFFF00" />
                        <telerik:ColorPickerItem Title="Light Green" Value="#00FF00" />
                        <telerik:ColorPickerItem Title="Turquoise" Value="#00FFFF" />
                        <telerik:ColorPickerItem Title="Pink" Value="#FF00FF" />
                        <telerik:ColorPickerItem Title="Blue" Value="#0000FF" />
                        <telerik:ColorPickerItem Title="Red" Value="#FF0000" />
                        <telerik:ColorPickerItem Title="Dark Blue" Value="#000080" />
                        <telerik:ColorPickerItem Title="Teal" Value="#008080" />
                        <telerik:ColorPickerItem Title="Green" Value="#008000" />
                        <telerik:ColorPickerItem Title="Violet" Value="#800080" />
                        <telerik:ColorPickerItem Title="Dark Red" Value="#800000" />
                        <telerik:ColorPickerItem Title="Dark Yellow" Value="#808000" />
                        <telerik:ColorPickerItem Title="Gray - 50%" Value="#808080" />
                        <telerik:ColorPickerItem Title="Gray - 25%" Value="#C0C0C0" />
                        <telerik:ColorPickerItem Title="Black" Value="#000000" />
                    </telerik:RadColorPicker>
                </div>
                <div style="height: 155px; float: left; width: 370px;">
                    <div style="width: 100px; margin: 0 0 20px 0;">
                        <span>Choose UnitType:</span>
                        <asp:RadioButtonList ID="rblUnitType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rblUnitType_SelectedIndexChanged">
                            <asp:ListItem Text="Pixel" Value="Pixel" Selected="True"></asp:ListItem>
                            <asp:ListItem Text="Percentage" Value="Percentage"></asp:ListItem>
                            <asp:ListItem Text="Em" Value="Em"></asp:ListItem>
                        </asp:RadioButtonList>
                    </div>
                    <span style="display: block; text-align: center;">Choose Min/Max Font Size</span>
                    <div style="position: relative; clear: both; width: 300px; padding: 0 30px;">
                        <asp:Panel ID="panelSlider" runat="server" CssClass="configuratorDiv">
    <asp:Label ID="lblMin" runat="server" Text="10px" Style="position: absolute; left: 0;
    top: 13px;"></asp:Label>

                            <telerik:RadSlider ID="sliderRange" runat="server" AutoPostBack="true" ItemType="item"
                                Height="40px" Width="300px" SelectionStart="10" SelectionEnd="50" MinimumValue="10"
                                MaximumValue="50" ThumbsInteractionMode="Push" IsSelectionRangeEnabled="true"
                                OnValueChanged="sliderRange_ValueChanged" Style="display: inline;">
                            </telerik:RadSlider>
    <asp:Label ID="lblMax" runat="server" Text="50px" Style="position: absolute; right: 0;
    top: 13px;"></asp:Label>

                        </asp:Panel>
                    </div>
                </div>
            </qsf:ConfiguratorPanel>
        </div>
        <qsf:Footer runat="server" ID="Footer1" ShowCodeViewer="true" />
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451