Click here to Skip to main content
15,908,661 members
Home / Discussions / C#
   

C#

 
QuestionInserting a Null value in BLOB field in Oracle Pin
kalyanPaladugu30-Aug-06 7:51
kalyanPaladugu30-Aug-06 7:51 
AnswerRe: Inserting a Null value in BLOB field in Oracle Pin
mikone30-Aug-06 8:10
mikone30-Aug-06 8:10 
QuestionAssembly.createInstance contructor not found [modified] Pin
Walter Dias30-Aug-06 7:33
professionalWalter Dias30-Aug-06 7:33 
AnswerRe: Assembly.createInstance contructor not found Pin
Martin#30-Aug-06 9:48
Martin#30-Aug-06 9:48 
GeneralRe: Assembly.createInstance contructor not found Pin
Walter Dias30-Aug-06 10:56
professionalWalter Dias30-Aug-06 10:56 
QuestionGDI+ Serialization error Pin
theonewithtom30-Aug-06 6:58
theonewithtom30-Aug-06 6:58 
QuestionHelp - Serialization Problem Pin
Aaron Schaefer30-Aug-06 6:46
Aaron Schaefer30-Aug-06 6:46 
QuestionGDI+ & Calculation Problems. Pin
Gavin Roberts30-Aug-06 5:23
Gavin Roberts30-Aug-06 5:23 
Hi all,

First of all, please look at the following image:

http://img171.imageshack.us/img171/6038/graphne9.jpg[^]

I'm currently working on a reporting system for our web stats system.

Code:

Pen Black = new Pen(Brushes.Black,  1);<br />
			Pen Gray = new Pen(Brushes.LightGray, 1);<br />
			Bitmap b = new Bitmap(parentWidth,parentHeight);<br />
			Graphics g = Graphics.FromImage(b);<br />
			<br />
			g = GenerateBG(g, parentWidth, parentHeight); // Generates linear background<br />
<br />
			int width = parentWidth - 50; // generates inner width<br />
			int height = parentHeight - 50; // generates inner height<br />
<br />
			int spacer_width = width/7; // amount of space between dates (y axis)<br />
			int spacer_height = 0;<br />
<br />
			int maxCount = 0;<br />
<br />
			ArrayList Data = new ArrayList();<br />
<br />
			// loops from today, backwards 7 days and writes the date<br />
			// and then gets any data against that date and stores it into<br />
			// an arraylist for future usage.<br />
			<br />
			// At the same time, it also finds out the maximum number over<br />
			// the 7 days.<br />
<br />
			for(int i = -6; i < 1; i++)<br />
			{<br />
				DateTime date = DateTime.Now.AddDays(i);<br />
				string toWrite = date.Day.ToString() + "/" + date.Month.ToString();<br />
				g.DrawString(toWrite, new Font("Verdana", 7), Brushes.Black, ((i+7)*spacer_width), parentHeight -20);<br />
				object[] dateData = dal.getStatsForDate(date.Date);<br />
				if(dateData.Length > maxCount)<br />
					maxCount = dateData.Length;<br />
				Data.Add(dateData);<br />
			}<br />
<br />
			spacer_height = (height/maxCount); // amount of space between numbers (x axis)<br />
<br />
			int tempHeight = parentHeight; // temp storage<br />
<br />
			int modCheck = Isqrt(maxCount); // gets square root of the maxcount<br />
<br />
			for(int i = 0; i < maxCount; i++)<br />
			{<br />
				if((i%modCheck)==0) // Space Saver<br />
				{<br />
					g.DrawLine(Gray, 50, tempHeight-25, width+25, tempHeight-25); // draws guide line<br />
					g.DrawString(i.ToString(),new Font("Verdana", 7), Brushes.Black, 5, tempHeight-32); // draws int value<br />
				}<br />
				tempHeight = (tempHeight-spacer_height); // calculate next location for guide line and int value<br />
			}<br />
<br />
			g.DrawLine(Black, 50, 25, 50, parentHeight-25); // draws x axis<br />
			g.DrawLine(Black, 50, parentHeight - 25, parentWidth-25, parentHeight-25); // draws y axis


Now if you look at the image and the code, i've got something wrong and I can't figure where.

Basically, I have calculated the distance between each number/guide line by deviding the height by the maximum number which will be shown.

For some strange reason, it is not using the whole height of the grid.

Anyone have any idea why?
AnswerRe: GDI+ & Calculation Problems. Pin
mikone30-Aug-06 5:39
mikone30-Aug-06 5:39 
GeneralRe: GDI+ & Calculation Problems. Pin
Gavin Roberts30-Aug-06 5:54
Gavin Roberts30-Aug-06 5:54 
GeneralRe: GDI+ & Calculation Problems. Pin
Gavin Roberts30-Aug-06 6:37
Gavin Roberts30-Aug-06 6:37 
GeneralRe: GDI+ &amp; Calculation Problems. [modified] Pin
mikone30-Aug-06 7:41
mikone30-Aug-06 7:41 
QuestionAdd buttons to ControlBox? Pin
Vodstok30-Aug-06 5:05
Vodstok30-Aug-06 5:05 
AnswerRe: Add buttons to ControlBox? Pin
mikone30-Aug-06 5:44
mikone30-Aug-06 5:44 
QuestionMemory allocation Pin
pawelpustelnik30-Aug-06 4:56
pawelpustelnik30-Aug-06 4:56 
AnswerRe: Memory allocation Pin
mikone30-Aug-06 5:05
mikone30-Aug-06 5:05 
GeneralRe: Memory allocation Pin
leppie30-Aug-06 11:17
leppie30-Aug-06 11:17 
GeneralRe: Memory allocation Pin
mikone30-Aug-06 11:33
mikone30-Aug-06 11:33 
GeneralRe: Memory allocation Pin
pawelpus30-Aug-06 11:59
pawelpus30-Aug-06 11:59 
GeneralRe: Memory allocation Pin
mikone30-Aug-06 12:28
mikone30-Aug-06 12:28 
GeneralRe: Memory allocation Pin
pawelpus30-Aug-06 22:15
pawelpus30-Aug-06 22:15 
GeneralRe: Memory allocation Pin
mikone31-Aug-06 7:25
mikone31-Aug-06 7:25 
AnswerRe: Memory allocation Pin
Robert Rohde30-Aug-06 5:45
Robert Rohde30-Aug-06 5:45 
GeneralRe: Memory allocation Pin
pawelpus30-Aug-06 12:01
pawelpus30-Aug-06 12:01 
AnswerRe: Memory allocation Pin
Colin Angus Mackay30-Aug-06 9:56
Colin Angus Mackay30-Aug-06 9:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.