home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Drawing a Chart using Borland

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1682
Discussions: 200,957, Posts: 2,379,498, Members: 246,327
Old June 22nd, 2003, 11:17 AM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Mar 2003
Location: Florida USA
Posts: 18
Drawing a Chart using Borland

Okay where to start.

Hi Everyone

I have an external data file (Scores.dat), which I have written code for, it opens the file up counts the number of times each number is repeated and stores the answer in another file called chart.txt.

What I have now been trying to do is use this file (chart.txt) to draw (using Borland Builder's OnPaint event) a bar chart showing the number of times these numbers are duplicated.

This is my problem:
The code I have written below compiles but is not displaying a bar chart (actually don't know what the call what it's displaying). I have tried to display the bar chart only using Borlands MoveTo and LineTo methods.

After declaring variables and opening the file i have the following code:
Total is the Array.

Code:
while (!(InFile.eof()))//while file still has data 
{ 
InFile >> Index >> ws; //reads data from inFile to Data 
Total[Index] = Total[Index]++; 
Horizontal=0; 
} 
Canvas->MoveTo(0,190);//start point for chart, 1 less than height(200) 

for (Index=0; Index<=100; Index++) 
{ 

Canvas->LineTo(Horizontal,190-(Total[Index]*10));//top left of bar 
Canvas->LineTo(Horizontal+10,190-(Count[Index]*10)); //top right of bar 
Canvas->LineTo(Horizontal+10,190); //bottom right of bar- bottom left of next 
Horizontal=Horizontal+10; //advances bar position 
}
The height has been set to 200, and the size of each bar is its data number say 3 and then *10 to increase the size of the bar. Each bar has a width of 5 pixels.

Can anyone please point where I have gone wrong in my thinking, am I on the right track to drawing the bar chart or do I have to revise my thinking, yet again.?

Any help/guidance will be greatly appreciated

Last edited by Morphios : June 27th, 2003 at 10:47 PM.
Morphios is offline   Reply With Quote
Old July 3rd, 2003, 09:57 AM     #2 (permalink)
Junior Member
 
Join Date: Mar 2003
Location: Florida USA
Posts: 18
Please don't reply, problem sorted now.
Morphios is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2949)
The disrespect of Obama by Russian .. (41)
Making Health Care Worse (178)
Wireless Televisions. (12)
CPU fan stops spinning randomly (9)
Regular Build (11)
windows 7 problem (7)
Laptop with wireless problem. (5)
Is the PSU I received dead? (12)
Print spooler problem (15)
windows vista security holes (11)
radeon x850xt platinum & shader.. (6)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (11)
Recent Discussions
Open With ..... Win7 (1)
Kingston Bluetooth Dongle Driver (0)
webcam (0)
upgrade for hp a6101 (0)
windows vista security holes (11)
Laptop with wireless problem. (5)
Modern Warfare 2: Who Bought It? (64)
tv not turn on-makes clicking sound (2)
CPU fan stops spinning randomly (9)
EVGA 9800 gtx help with finding a goo.. (11)
Regular Build (11)
Help with onclick and buttons (0)
Virus advise (8)
My monitor won't turn on after instal.. (1)
Internet Lost (3)
Dept. of HS: NSA 'Helped' Develop Vis.. (16)
Point and Shoot Camera Suggestions. (4)
Multiple Restarts Required at Boot (2)
Ideal cheap graph card for PC-Gaming? (18)
radeon x850xt platinum & shader 3 (6)
Graphics Card Upgrade Question (4)
For Sale BFG GTX285 OC2 with 10 year .. (3)
How to convert MP3's (4)
Wireless Televisions. (12)
Hp Artist Edition + Matching Bag (0)


All times are GMT -4. The time now is 07:43 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28