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

Connecting the cursor with the legend


As we experiment, we come across the option to pass the data points from the cursor tooltip to the legend. We revisit the chart we just worked on, and save it as a new file, 1168_06_05.html:

  1. We include the canvas plugins so that we can rotate our ticks and labels. We need to do this since our legend will be taking up more space than normal:

    <script src="../js/jqplot.cursor.min.js"></script>
    <script src="../js/jqplot.canvasTextRenderer.min.js"></script>
    <script src="../js/jqplot.canvasAxisTickRenderer.min.js"></script>
    <script src="../js/jqplot.canvasAxisLabelRenderer.min.js"></script>
    
  2. We set showTooltip to false so that we don't show data points in multiple places. We set showVerticalLine to true. By connecting the cursor to the legend, values will only appear when the cursor crosses data points. When our vertical line crosses a data point, the values will appear in the legend. So, showVerticalLine must be...