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

Refreshing our chart from remote data


About an hour later, Jeff stops back by the office. We show him our prototype. "This is cool. My guys are still trying to figure out how to pass the information from the routers to our web servers. In the meantime, I had them create a mock endpoint that you can test against. I told them to e-mail you the link." Jeff leaves, and a few minutes later, we receive an e-mail from Mark in IT.

We load the URL and see that the page contains the single array [200]. With this endpoint, we'll only need to change a few things in our meter.

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

  1. We start by adding dataPull to format our data. We only need to wrap remoteData in an array, as shown in the following code snippet:

    $(document).ready(function(){
    
      function dataPull(remoteData,options) {
        return [remoteData];
      }

    Note

    If your chart does not load the new data, you will need to set cache to false inside the AJAX method in...