Creating a variable width bar chart using JavaScript

A report shows the Unit cost and Unit price of all products. It also works out the Profit Margin from these two.

Business owners are naturally more interested in products with a high profit margin as well as a high unit price.

Getting ready

Create a simple list report with Product, Unit cost, and Unit price as columns.

Also, add a calculated item called Margin to the list to compute the profit margin and define it as follows:

([Unit price]-[Unit cost])/[Unit cost]

How to do it...

In this recipe, we will create a variable width bar chart using JavaScript that shows a bar for every product. The length of bar will indicate the profit margin, whereas the width will indicate the unit price. To do this, ...

Get IBM Cognos 10 Report Studio Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.