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

Zooming in on a colored candlestick chart


We get back from lunch and jump into creating the colored candlestick chart for Calvin. It will only require a couple of changes to our previous chart. We save the original as a new file, and then begin our modifications executing the following steps:

  1. We include the cursor plugin file because the zooming feature is part of the cursor plugin:

    <script src="../js/jqplot.cursor.min.js"></script>
    <script>
    $(document).ready(function(){
      function dataPull(remoteData,options) {
        return [remoteData];
      }
  2. We add the enablePlugins option before we create our chart. This way we don't have to enable each plugin individually. Next, we change the remote data feed back to the JSON feed with the first three quarters of data, and we also update our title:

      $.jqplot.config.enablePlugins = true;
      var stockPrice = $.jqplot ('stockPrice', "./data/q1_q3_2012.json",
      {
        title:'Q1-Q3 2012 - jQ Big Box Electronics (jqBBE)',
        axesDefaults: {
     ...