O'Reilly logo

Learning jqPlot by Scott Gottreu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modifying the data array and the tooltip

In order to remedy this problem, we need the closing price to be the first y value in our data array. We can accomplish this by modifying our dataPull function. We save the previous code as a new file and start making our changes executing the following steps:

  1. We create a new array called stocks, and then loop through the remoteData array. We add the date, which is the first element, and then we add the closing price, which is the last element in the remoteData array:
    ...
      function dataPull(remoteData,options) {
        var stocks = new Array;
        for(var x=0;x<remoteData.length;x++){
          stocks[x] = new Array;
          stocks[x].push(remoteData[x][0],remoteData[x][4]);
  2. We now have our x and y values, so we loop through the rest of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required