Appearance and Styling

28 Jun 20174 minutes to read

Minimum and maximum Font size

The TagCloud content can be set to different font sizes from minimum to maximum based on its frequency values. By default, minFontSize is “10px” and maxFontSize is “40px”, using these properties you can customize the minimum and maximum font sizes.

Customizing font sizes of TagCloud

Refer to the following code to configure font sizes for a TagCloud.

  • HTML
  • <div id="techweblist" ej-tagcloud e-datasource="dataList" e-minfontsize="20px" e-maxfontsize="50px" e-titletext="Tech Sites"></div>

    The following screenshot illustrates the TagCloud control with customized font sizes.

    Tag format

    You can set the TagCloud content display format using format property. By default format is set to cloud, that displays content in TagCloud. You can set the format as list to display the content in linear format.

    Defining Cloud and List format

    Refer to the following code to configure format option for a TagCloud.

  • HTML
  • <table>
    <tr>
    <td>
    <span>Tag format cloud</span>
    <div id="techwebcloud" ej-tagcloud e-datasource="dataList" e-format="list" e-titletext="Tech Sites List"></div>
    </td>
    <td>
    <span>Tag format list</span>
    <div id="techweblist" ej-tagcloud e-datasource="dataList" e-format="cloud" e-titletext="Tech Sites Cloud"></div>
    </td>
    </tr>
    </table>

    The following screenshot illustrates the TagCloud control with customized formats.

    Theme

    You can control the style and appearance of TagCloud based on CSS classes. To apply styles to the TagCloud control, you can refer two files, ej.widgets.core.min.css and ej.theme.min.css. When you refer ej.widgets.all.min.css file, it is not necessary to include the files ej.widgets.core.min.css and ej.theme.min.css in your project, as ej.widgets.all.min.css is the combination of these two.

    By default, there are 12 themes support available for TagCloud control namely,

    • default-theme
    • flat-azure-dark
    • fat-lime
    • flat-lime-dark
    • flat-saffron
    • flat-saffron-dark
    • gradient-azure
    • gradient-azure-dark
    • gradient-lime
    • gradient-lime-dark
    • gradient-saffron
    • gradient-saffron-dark

    CssClass

    You can use the CSS class to customize the TagCloud appearance. Any of the CSS properties can be used to modify look and feel of tag cloud based on the requirement. Define a CSS class as per requirement and assign the class name to cssClass property.

    Configure TagCloud using CSS class

    Refer to the following code to configure CSS class for TagCloud.

  • HTML
  • <div id="techweblist" ej-tagcloud e-datasource="dataList" e-titletext="title" e-cssclass="CustomCss"></div>
  • JAVASCRIPT
  • var list = [
    { text: "Google", url: "http://www.google.co.in", frequency: 12 },
        { text: "a2zwebhelp", url: "http://www.a2zwebhelp.com", frequency: 3 },
        { text: "Arts Technica", url: "http://arstechnica.com/", frequency: 8 },
        { text: "Bxslider", url: "http://bxslider.com/examples", frequency: 2 },
        { text: "Yahoo", url: "http://in.yahoo.com/", frequency: 12 },
        { text: "Facebook", url: "https://www.facebook.com/", frequency: 5 },
        { text: "Blogspot", url: "http://www.blogspot.com/", frequency: 8 },
        { text: "Valleywag", url: "http://valleywag.gawker.com/", frequency: 6 },
        { text: "WOWslider", url: "http://wowslider.com", frequency: 9 },
        { text: "W3schools", url: "http://www.w3schools.com/", frequency: 2 }
    ];
    angular.module('tagCloudApp', ['ejangular'])
    .controller('TagCloudCtrl', function ($scope) {
        $scope.dataList = list;
        $scope.title = "Tech Sites";
    });

    Define CSS class for customizing the TagCloud widget.

  • CSS
  • <style type="text/css" class="cssStyles">
            /* Customize the TagCloud div element */
            .CustomCss
            {
                background-color: #DDC;
                width: 400px;
            }
            /* Customize the TagCloud header element */        
            .CustomCss .e-header.e-title {
                text-align: center;
                font-weight: bold;
            }
    </style>

    The following screenshot illustrates the TagCloud with customized CSS class,