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

Building a candlestick chart with filtered data


We are happy with how our OHLC chart turned out. Now, we turn our attention to creating a candlestick chart. We consider this might work well on the dashboard.

We open the OHLC chart we just created and save it as a new file. We only need to set one option to make it a candlestick chart, but we also want to make a few other cosmetic changes. We execute the following steps:

  1. The first change is the data feed that will pull in the stock prices of the last 14 days. We also update our title:

    ...
      var stockPrice = $.jqplot ('stockPrice', "./data/last_14.json",
      {
        title:'Last 14 Days - jQ Big Box Electronics (jqBBE)',
  2. Under rendererOptions for our series, we set candleStick to true:

    ...
        series: [
          {
            renderer:$.jqplot.OHLCRenderer,
            rendererOptions: {
              lineWidth: 2,
              candleStick: true
            }
          }
        ],
  3. Previously, we used numberTicks to limit the number of ticks jqPlot created for our axes. For this...