ASP.NET - problema con grafico

 
Vista:

problema con grafico

Publicado por Mariza (3 intervenciones) el 16/02/2006 18:51:03
Hola les escribo porque tengo un problema, estoy trabajando con Asp.net C# y con gráficos, pero cuando ejecuto la aplicación no me aparece el control de usuario Web en el cual puse una imagen de un logo, no he logrado que el grafico se vea en el centro de la pantalla y que aparte me muestre el logo al mismo tiempo.
La funcion que utilizo para cargar el grafico es la siguiente:

protected void GenerateBarGraph(string graphTitle,ArrayList xValues, ArrayList yValues, int barWidth,int barSpaceWidth, int graphHeight)
{
int graphTitleHeight=20;
int itemsHeight=35;

int graphWidth= (barWidth + barSpaceWidth) * xValues.Count + barSpaceWidth ;

int maxBarHeight = 0;

int totalGraphHeight = graphHeight + graphTitleHeight + itemsHeight;

Bitmap barBitmap= new Bitmap(graphWidth, totalGraphHeight);

Graphics barGraphics= Graphics.FromImage(barBitmap);

barGraphics.FillRectangle(new SolidBrush(Color.White),0,0,graphWidth + 400,totalGraphHeight + 500);

Font titleFont=new Font("Papyrus",11, FontStyle.Bold);

barGraphics.DrawString(graphTitle,titleFont,new SolidBrush(Color.Black),(graphWidth / 2) - graphTitle.Length * 5,(totalGraphHeight - itemsHeight) + 15);

foreach(int _value in yValues)
if(_value > maxBarHeight) maxBarHeight=_value;

int barXPos = barSpaceWidth;

int barHeight;

Font itemsFont=new Font("Verdana",7, FontStyle.Bold);
Font valuesFont=new Font("Verdana", 7, FontStyle.Bold);

Random rnd=new Random();

for(int i=0;i < xValues.Count;i++)
{
Color color = Color.FromArgb(rnd.Next(0),rnd.Next(0),rnd.Next(255));
SolidBrush barBrush=new SolidBrush(color);
SolidBrush barB = new SolidBrush(Color.Black);

barHeight=((((int)yValues[i]* 100 / maxBarHeight) )* graphHeight)/100;

barGraphics.FillRectangle(barBrush,barXPos,(graphHeight-barHeight) + 20,barWidth,barHeight);

barGraphics.DrawString(xValues[i].ToString(),itemsFont,barB,barXPos,graphHeight + 25);

barGraphics.DrawString(yValues[i].ToString(),valuesFont,barB,barXPos,(graphHeight-barHeight)-itemsHeight +40 );

barXPos += (barWidth + barSpaceWidth);
}

Response.ContentType = "image/jpeg";
barBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);
barGraphics.Dispose();
barBitmap.Dispose();
}

/////////////////////////////////////
private void Page_Load(object sender, System.EventArgs e)
{
ArrayList _years=new ArrayList();
_years.Add("18");
_years.Add("19");
_years.Add("31");
_years.Add("34");

ArrayList _sales=new ArrayList();
_sales.Add(100);
_sales.Add(130);
_sales.Add(223);
_sales.Add(243);

GenerateBarGraph("Estadistica de Inasistencias de Docentes",_years, _sales, 50, 60, 600);

}
//////////////////////////
Me bastaría con mostrar el grafico y el titulo.

Por favor ayúdenme

Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder