Jump to content

Javascript Histogram


fab5freddy

Recommended Posts

I have run into a little trouble. I need to create a histogram by accessing a database and retrieving numbers from the database. I can list all the database information however when it comes to the histogram part all I get is a lot of x's that crashes the whole program. I need to use the numbers from the currentStockAmount. If more information is needed let me know here is my code so far:

function project4Part3() {
   var currentNumber;
   var currentName;
   var currentStockAmount;
   var itemRecords;


   //Open Inventory Items
   itemRecords = openInventoryItemsRecords();

   //Read records and display
   while (itemRecords.readNextRecord()) {

       currentNumber = itemRecords.getItemNumber();
       currentName = itemRecords.getItemDescription();
       currentStockAmount = itemRecords.getItemStockAmount();
       currentStockAmount = Number(currentStockAmount);


       document.write(currentNumber + "\t" + currentName + "\t" 
           + currentStockAmount + "\n");
   } 
}

 

I think I need to convert the currentStockAmount to a Number but am unsure.

Link to comment
Share on other sites

You're right I agree with you about having other resources however we don't have class this week. As far as the book is concerned it is no good what so ever. There have been several complaints to the instructor to find us a new one. All he responds with is we should be able to find additional resources on our own. This can be a little overwhelming to a new student. This is not really the best class I've ever been as you can imagine. Only a few weeks to go.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...