Hi,
the code below draws a line graph by getting data from a sql server database,draw the line and saving it to my C:. However i want to be able to view this graph on a image, however i cant get the image to display since im running it on my local host and the local host cant reference anything outside the project folder i believe. i think i need to save the graph to this folder and reference it using server.mapPath although im not to sure.
any insight would be great
Thanks
protected void Draw()
{
for (int intRowCounter = 0; intRowCounter <= objDataTable.Rows.Count - 1; intRowCounter++)
{
DataRow drowRow = objDataTable.Rows[intRowCounter];
objGraphics.DrawLine(Pens.Red, PrevX, PrevY, intRowCounter * XScale, ImageHeight - (float.Parse(drowRow.ItemArray.GetValue(43).ToString()) * float.Parse(YScale.ToString())));
PrevX = intRowCounter * XScale;
PrevY = ImageHeight - (Int32.Parse(drowRow.ItemArray.GetValue(43).ToString()) * Int32.Parse(YScale.ToString()));
}
objBitmap.Save("C:\\img1.gif"); <----here i believe is where i need to save and reference the image
Image4.ImageUrl = "C:\\img1.gif";
}
the code below draws a line graph by getting data from a sql server database,draw the line and saving it to my C:. However i want to be able to view this graph on a image, however i cant get the image to display since im running it on my local host and the local host cant reference anything outside the project folder i believe. i think i need to save the graph to this folder and reference it using server.mapPath although im not to sure.
any insight would be great
Thanks
protected void Draw()
{
for (int intRowCounter = 0; intRowCounter <= objDataTable.Rows.Count - 1; intRowCounter++)
{
DataRow drowRow = objDataTable.Rows[intRowCounter];
objGraphics.DrawLine(Pens.Red, PrevX, PrevY, intRowCounter * XScale, ImageHeight - (float.Parse(drowRow.ItemArray.GetValue(43).ToString()) * float.Parse(YScale.ToString())));
PrevX = intRowCounter * XScale;
PrevY = ImageHeight - (Int32.Parse(drowRow.ItemArray.GetValue(43).ToString()) * Int32.Parse(YScale.ToString()));
}
objBitmap.Save("C:\\img1.gif"); <----here i believe is where i need to save and reference the image
Image4.ImageUrl = "C:\\img1.gif";
}