Browse DevX
Sign up for e-mail newsletters from DevX


Simplify and Enhance Your Reporting with Character-based Bar Charts : Page 2

Numerous software packages and programming languages have built-in capabilities for producing text-based bar charts by making use of either ASCII or UNICODE characters. Because these bar graphs are nothing more than text characters themselves, you don't need any special third-party software to create them. Consequently, you can incorporate such graphs easily and at virtually no cost anywhere you need to present tabular data.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Producing Charts
You produce a chart using a two-step process. First, choose a character (such as "*", "x", etc.) to serve as a marker. Second, repeat the character as many times as necessary. For the cola example, the maximum mean rating for any one of the cola brands is five. Thus, the maximum number of characters required to create a bar chart for the ratings should be some multiple of five. (The sample in Figure 1 used x3.) That is, a mean of five would equate to a bar chart 15 characters wide and any mean less than five is then scaled proportionately. In symbols, that means NumChars = 15 x (Mean / 5.0). So, how wide should the associated chart be when the mean is one? Well, according to the logic you've already seen, you would calculate a mean of one as 1/5=0.20, so you would expect to make the chart 0.20 x 15 = 3 characters wide. But, you probably don't want that in this case. Most likely, you would want to have a mean of one have a zero-length bar—that is, no display at all. You can accommodate that by making an adjustment to the calculation: NumChars = 15 x ((Mean - 1.0) / (5.0 - 1.0)). The take-away point here is not how to derive a deterministic function for how many characters to type out when a 1-5 scale is used, but rather to illustrate the idea that you can choose any text character you like and repeat it appropriately to produce bar charts that can help derive meaning out of summarized, tabular data.

ASCII Characters
Thus far, the term "text characters" means nothing more than one-byte ASCII characters. ASCII stands for American Standard Code for Information Interchange and was published in 1968 by the American National Standards Institute (ANSI). It was intended to define "standard character codes for interchanging data that could handle the full character set of an English-language typewriter" (see A Brief History of Character Codes). In essence, the standard gives each typical character found on a keyboard a numeric code between 0-127. In addition, an extended ASCII character set (codes 128-255) includes characters not typically seen on a standard, English keyboard; such as Latin characters, trademark symbols, and smiley faces. For better or worse, these extended characters are highly dependent upon the particular computer's operating system, language setting, and the current font. But that scheme doesn't take many foreign language characters and symbols into account. Consequently, several different "standard" character sets arose to meet different needs. For a sample listing, see The ISO 8859 Alphabet Soup. Unicode Characters
Unicode Standard was born out of an attempt to create a single multinational and universal character set that could support all human languages. The Unicode Consortium is a non-profit organization founded to develop, extend and promote the use of this Unicode Standard (http://www.unicode.org). However, the Unicode character set is not just another character set, it goes far beyond that. Because it uses two bytes to represent characters, instead of getting only 255 possible characters to choose from, there are 65,536 possible characters! The best part is that many of these characters are not just linguistic, but also symbolic. For example, there's subsets for mathematical symbols, block elements, and geometric shapes. For a complete list, see http://www.alanwood.net/unicode. The Unicode block character used in the cola example, has the value 9608 (or 25F4 in hexidecimal).

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date