Documentation
Getting Started
jqxTagCloud is a jQuery widget is a flexible UI component that displays a collection of user-generated tags accompanying the articles, posts, or videos on your website. Each tag has weight value which corresponds to its popularity, importance or recurrence on the page. The keywords in the cloud can have their own URL which navigates to a collection of items associated with the relevant tag. The user can easily customize the appearance of the control, choose the items that will be displayed in the cloud, their font size and color, sort the tags alphabetically or by value, in ascending or descending order.Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly.
The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxTagCloud widget requires the following files:
<head> <link type="text/css" rel="Stylesheet" href="../../jqwidgets/styles/jqx.base.css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxtagcloud.js"></script><script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head>
The next step is to create a DIV element within the body of the html document where the jqxTagCloud widget will be.
<body> ... <div id="jqxTagCloud"> </div> ...</body>
The last step is to initialize the widget by adding the following script to the html document:
<script type="text/javascript"> $(document).ready(function () { var data = [ { label: 'Hardware' }, { label: 'Music' }, { label: 'Sound' }, { label: 'Software' } ]; $("#jqxTagCloud").jqxTagCloud({ source: data }); }); </script>
Be sure to specify a valid source for the tag information.
To bind to an event of a UI widget, you can use basic jQuery syntax. The example code below demonstrates how to bind to the "itemClicked" event of jqxFileUpload.
<script type="text/javascript"> // bind to itemClicked event. $('#jqxTagCloud').on('itemClicked', function (event) { var args = event.args; alert("You have clicked on: " + args.displayMember); });</script>
Basic Sample
<!DOCTYPE html><html lang="en"><head> <title id='Description'>TagCloud basic demo</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css"/> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxtagcloud.js"></script> <script> $(document).ready(function () { var data = [ { countryName: "Australia", technologyRating: 35 }, { countryName: "United States", technologyRating: 60 }, { countryName: "Germany", technologyRating: 55 }, { countryName: "Brasil", technologyRating: 20 }, { countryName: "United Kingdom", technologyRating: 50 }, { countryName: "Japan", technologyRating: 80 } ]; var source = { localdata: data, datatype: "array", datafields: [ { name: 'countryName' }, { name: 'technologyRating' } ] }; var dataAdapter = new $.jqx.dataAdapter(source, {}); $('#jqxTagCloud').jqxTagCloud({ width: '600', source: dataAdapter, displayMember: 'countryName', valueMember: 'technologyRating' }); }); </script><script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head><body><div id="jqxTagCloud"></div></body></html>