Jump to content
Killersites Community

Javascript Histogram

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.

Share this post

Link to post
Share on other sites

I'll take a look at this later... realistically though, if you are doing this for a class, you should have resources there that are available to you to help explain this information (professors, textbooks, sample code, etc.)

Share this post

Link to post
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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now