Creating a stacked bar chart

Stacked bar charts allow the contributing parts of data to be compared to the whole. An example of this is displaying a bar that represents the total number of opportunities that are currently open, with sections of the bar displaying the count of opportunity records that are in each stage of the sales process.

In this recipe, we will create a Visualforce page containing a stacked bar chart where each bar displays the total opportunity value that closed that month, both won and lost, for the last 12 months. Each bar is divided into two segments: the lower segment shows the total value of opportunities lost in a month, while the upper segment shows the total value won.

Getting ready

This recipe makes use of a custom controller, ...

Get Visualforce Development 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.