Chapter 10. Beautifying and Extending Your Charts

In each of the previous chapters, we have looked at new chart types or plugins that augmented the functionality of our charts. In this chapter, we will look at how to style the grid and create themed charts. We will also create reusable functions to simplify the building of our charts. In this chapter, we will cover the following topics:

  • Change the background color of the grid and remove all the grid lines
  • Discuss how the canvas element in HTML works and the proper way to style it
  • Create a line chart using the second xaxis and smoothing lines
  • Create a waterfall chart and set the negative colors to match our company's color scheme
  • Create functions to build plot objects with default options for a bar chart
  • Use our newly-created functions to build bar charts with less code

Nailing down the charts for our dashboard

We get into the office around 9 o'clock and head to the conference room for our meeting with Roshan. A few minutes later he and Calvin arrive. "Thanks for joining us this morning," Roshan begins. "I think we've settled on the charts we want on the dashboard. We've decided we want two versions: one for vice presidents that give a company-wide view and one for managers to keep abreast of their divisions."

Roshan continues, "I think the next step for you two will be to modify the charts to match our brand standards. For the company-wide charts, we want to use the company's purple color scheme. For each division, we want the red, green, and blue color schemes. Is there any way we can use a different color for the background of the charts? If so, let's make it a lighter version of the standard color. The tan or off-white color is just bland. Beyond changing the background color, we'll leave it to you to find other ways to put some polish on the charts."

The meeting wraps up and we gather our things. Calvin speaks up, "I forgot to bring the list of which charts go with which report. I'll e-mail that over when I get back to my office." We head back to our office and work through our e-mails from the weekend. About 10 minutes later, we get an e-mail from Calvin. It lists the following charts for the company-wide report:

  • The stacked bar chart showing the last 12 months of divisional revenue
  • The waterfall chart showing expenses against revenue
  • The line chart showing the last 12 months of revenue and profit
  • The bar chart showing product return reasons

Thankfully, we already have a working version of each chart. We just need to clean them up and style them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.206.25