Book Image

Learning jqPlot

By : Scott Gottreu
Book Image

Learning jqPlot

By: Scott Gottreu

Overview of this book

Table of Contents (19 chapters)
Learning jqPlot
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using the second xaxis and smoothing lines


We save the previous chart as a new file and begin making our modifications as follows:

  1. We want an array containing various shades of the purple used by the company. We can use these colors for our lines, bars, pie wedges, and even our backgrounds. We also want this in a central place along with the functions to help us theme our charts. With that in mind, we create a file called themes.js and add an array called company_colors to hold our shades of purple as follows:

    var company_colors = [ "#400040", "#8C008C", "#D8BFD8", "#DE6FA1", "#9400D3" ];
  2. Next, we return to our file containing our HTML, 1168_10_03.html. We include the themes.js file in our HTML. After setting dataRendererOptions, we set seriesDefaults. Inside this object, we set rendererOptions and then set smooth to true. We also set seriesColors to the company_colors array in themes.js as follows:

    <script src="../js/themes.js"></script>
    ...
      dataRendererOptions: { dataCallback...