i am trying to get my text to display the value of the bar graph.. as you will see my values scale the bars, jan is set to 2000 but if u move it, it moves the bar.. now how do i display the amount and get it move at the same time..
so if i were to put 3500 instead of 2000, it would be at the top of the bar for january.
//mathew tucker
//lab 3 - bar chart
#include "DarkGDK.h"
void DarkGDK()
{
DWORD Blue =dbRGB(0,0,255);
DWORD Red =dbRGB(255,0,0);
DWORD Green =dbRGB(0,255,0);
DWORD Yellow =dbRGB(255,255,0);
DWORD Black =dbRGB(0,0,0);
DWORD White =dbRGB(255,255,255);
dbInk(Yellow,Black);
int january=2000;
int febuary=3000;
int march=5000;
int textX1;
int textY1;
int pointPerPixel=25;
int barWidth=150;
int barHeight;
int lowerRightX;
int lowerRightY;
int upperLeftX;
int upperLeftY;
int textX;
int textY;
int lineStartX=0;
int lineStartY=400;
int lineEndX=639;
int lineEndY=400;
dbSetWindowTitle("Bar Chart");
dbLine(lineStartX,lineStartY,lineEndX,lineEndY);
//Start of January
lowerRightX=200;
lowerRightY=400;
upperLeftX=lowerRightX-barWidth;
barHeight=january/pointPerPixel;
upperLeftY=lowerRightY-barHeight;
dbInk(Blue,Black);
dbBox(upperLeftX,upperLeftY,lowerRightX,lowerRightY);
textY=420;
textX=upperLeftX+( (lowerRightX-upperLeftX) /2);
dbInk(White,Black);
dbCenterText(textX,textY,"January");
//End of January
//Start of Febuary
lowerRightX+=200;
upperLeftX=lowerRightX-barWidth;
barHeight=febuary/pointPerPixel;
upperLeftY=lowerRightY-barHeight;
dbInk(Red,Black);
dbBox(upperLeftX,upperLeftY,lowerRightX,lowerRightY);
textX=upperLeftX+( (lowerRightX-upperLeftX) /2);
dbInk(White,Black);
dbCenterText(textX,textY,"Febuary");
//End of Febuary
//Start of March
lowerRightX+=200;
upperLeftX=lowerRightX-barWidth;
barHeight=march/pointPerPixel;
upperLeftY=lowerRightY-barHeight;
dbInk(Green,Black);
dbBox(upperLeftX,upperLeftY,lowerRightX,lowerRightY);
textX=upperLeftX+( (lowerRightX-upperLeftX)/2);
dbInk(White,Black);
dbCenterText(textX,textY,"March");
//End of March
dbWaitKey();
}
Darkbluedeath