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

Adding a threshold to our chart


Sara leans toward the screen, "This is exactly what we need. I'm already thinking that we need to put a line on here, like a threshold. One of our new initiatives is to examine the product categories we are in. If any category drops below monthly revenue of $50,000, it is flagged, and we will evaluate whether we need to stay in that category."

You mention that we can make the change quickly. We won't need to change much in our existing chart:

  1. We start by including the canvasOverlay plugin:

    ...
    <script src="../js/jqplot.canvasOverlay.min.js"></script>
    ...
  2. We create a canvasOverlay option and set show to true. Next, we create the objects option, which accepts an array of objects with the options for each line we want to draw. For each line, we have the four options of verticalLine, dashedVerticalLine, horizontalLine, and dashedHorizontalLine. For this chart, we create a verticalLine object:

    ...
        canvasOverlay: {
          show: true,
          objects: [
    ...