Friday Puzzler: You can take this data and chart it!

One of the (many) things I like about ColdFusion is its built-in support for charting. I especially like the improvements in the last version. Not just the ability to apply custom charting, but the simple improvement to the default colors. There is a reason I don’t pick out my own clothes!

For today’s puzzler though, we are going to take a trip back in time. Imagine for a moment that you don’t have Flash based charts or even HTML for that matter. Imagine you have a set of data and you want to generate a simple bar chart. You are only allowed to use preformatted text since it is going to an old fashion line printer.

Your mission, if you choose to accept it, is to create a textbased bar chart based on the data from the code at the end of this entry. You can use * for bar markers, or any character. You don’t have to do labels, but it’s extra credit if you do. (You will win 5% more than the nothing I’m giving away.)

As always, remember the rules: Don’t spend more than five minutes and don’t expect a prize. It’s just for fun.

<!--- Sales of widgets over the last 12 months ---> <cfset sales = arrayNew(1)> <cfloop index="x" from="1" to="12"> <cfset sales[x] = randRange(0,100)> </cfloop>

p.s. Still coughing, but I think I’m slowly getting over whatever bug got me this week. What really bugs me is sinus issues always tends to make beer takes like crap.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com

Comments