Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/10/2008, 12:13
somily
 
Fecha de Ingreso: octubre-2008
Mensajes: 7
Antigüedad: 15 años, 7 meses
Puntos: 0
Respuesta: Ayuda en Herramienta Dundas

Hola que tal si lo que quieres en llenar Manualmente los datos de la grafica en relacion a tus dos Querys que en si me supongo que lo que quieres es de esos dos querys obtener una sola tabla para esa tabla graficarla.

Bueno es sencillo.
1.- Primero agregar

using Dundas.Charting.WebControl;

public class IndicadoresGrafica : Chart
{
private DataTable m_OrigenDatos;
AtributosGrafica m_AtributosGrafica;

private void ConfigurarAtributosGrafica()
{
m_AtributosGrafica = new AtributosGrafica();
MinimosMaximos.MinimosMaximosDatos(m_OrigenDatos, m_AtributosGrafica, 1, 1);
UnidadMedida.UnidadMedidaGrafica(m_AtributosGrafic a);
FormatoUnidades.FormatoUnidadesGrafica(m_Atributos Grafica);
MinimosMaximos.AjustarMaximo(m_AtributosGrafica);
}

public IndicadoresGrafica(DataTable oDataTable)
{
ConstruyeGrafica(oDataTable);
}




private void ConstruyeGrafica(DataTable oDataTable)
{
Color[] colorPalette = { Color.FromArgb(0, 130, 55),
Color.FromArgb(255,117,51),
Color.FromArgb(255,248,51),
Color.FromArgb(255,204,51),
Color.FromArgb(174,218,44),
Color.FromArgb(255,161,51),
Color.FromArgb(66,192,38),
Color.FromArgb(41,205,203),
Color.FromArgb(39,129,196),
Color.FromArgb(37,62,187),
Color.FromArgb(107,36,181),
Color.FromArgb(205,41,164),
Color.FromArgb(248,50,69),
};

m_OrigenDatos = oDataTable;
ConfigurarAtributosGrafica();
this.Series.Clear();
this.ChartAreas.Add("AreaGrafica");
this.ChartAreas[0].BackColor = Color.Transparent;
this.ChartAreas[0].Area3DStyle.Enable3D = true;
this.ImageType = ChartImageType.Bmp;
this.RenderType = RenderType.ImageTag;
//this.ImageUrl = "..\\Images\\ChartLocation\\ChartPic_#SEQ(600,38)" ;
this.BackColor = Color.WhiteSmoke;
this.BackGradientEndColor = Color.White;
this.BackGradientType = GradientType.DiagonalLeft;
this.BorderLineColor = Color.Gray;
this.BorderLineWidth = 1;
this.BorderLineStyle = ChartDashStyle.Solid;
this.Series.Add("Series");
this.Series["Series"].Type = SeriesChartType.Pie;
this.Series["Series"].ChartArea = "AreaGrafica";
this.Series["Series"]["FunnelPointGap"] = "1";
this.Series["Series"].MarkerSize = 8;
this.Series["Series"].ShadowColor = Color.White;
this.Series["Series"].ShadowOffset = 2;
this.Series["Series"].Color = Color.FromArgb(220, 65, 140, 240);
this.Series["Series"]["PieLabelStyle"] = "Inside";
this.Series["Series"]["3DLabelLineSize"] = "30";
this.Series["Series"].SmartLabels.Enabled = true;
object[] objDatos = ObtenerArrayComposicionActivo(m_OrigenDatos);
this.Series["Series"].Points.DataBindXY((string[])objDatos[0], (double[])objDatos[1]);
this.Legends.RemoveAt(0);
this.Legends.Add("Leyendas");
this.Legends["Leyendas"].LegendStyle = LegendStyle.Table;
this.Legends["Leyendas"].TableStyle = LegendTableStyle.Wide;
this.Legends["Leyendas"].ShadowColor = Color.Gray;
this.Legends["Leyendas"].ShadowOffset = 2;
this.Legends["Leyendas"].BorderColor = Color.Gray;
this.Legends["Leyendas"].Alignment = StringAlignment.Center;
this.Legends["Leyendas"].Docking = LegendDocking.Right;
this.Legends["Leyendas"].MaxAutoSize = 40;
this.Legends["Leyendas"].AutoFitText = true;
this.Legends["Leyendas"].TextWrapThreshold = 5;
this.Series["Series"].Legend = "Leyendas";
this.Legends["Leyendas"].DockInsideChartArea = false;


this.Series["Series"]["MinimumRelativePieSize"] = "50";

this.PaletteCustomColors = colorPalette;

this.Width = Unit.Pixel(800);
this.Height = Unit.Pixel(500);
this.Legends["Leyendas"].Font = new System.Drawing.Font("Trebuchet MS", 8, FontStyle.Bold);
this.Series["Series"].Font = new System.Drawing.Font("Trebuchet MS", 10, FontStyle.Bold);




foreach (DataPoint currPoint in this.Series["Series"].Points)
{


string textoLeyenda = currPoint.AxisLabel;
textoLeyenda = Regex.Replace(textoLeyenda, "CRÉDITO AL", "");
textoLeyenda = Regex.Replace(textoLeyenda, "CRÉDITO", "");
textoLeyenda = Regex.Replace(textoLeyenda, "TOTAL", "");
textoLeyenda = textoLeyenda.Trim();
currPoint.ShowInLegend = true;
currPoint.LegendText = textoLeyenda;
currPoint.ToolTip = textoLeyenda + " = #VALY{" + m_AtributosGrafica.FormatoDecimales + "} " + UnidadMedida.UnidadMedidaCadena(m_AtributosGrafica .UnidadMedida);
currPoint.Label = "#PERCENT";
}
this.Series["Series"].SmartLabels.Enabled = true;
ConfigurarTitulo();
this.DataBind();
}

private void ConfigurarTitulo()
{
Title oTitle = this.Titles.Add("Indicadores");


oTitle.Font = new System.Drawing.Font("Trebuchet MS", 10, FontStyle.Bold);

oTitle.ShadowOffset = 1;
oTitle.ShadowColor = Color.Gray;
oTitle.Color = Color.Black;
}

private object[] ObtenerArrayComposicionActivo(DataTable oDataTable)
{
int numeroFilas = oDataTable.Rows.Count;
string[] arregloConcepto = new string[numeroFilas];
double[] arregloPorcentage = new double[numeroFilas];
int indiceArreglo = 0;
foreach (DataRow oDataRow in oDataTable.Rows)
{
arregloConcepto[indiceArreglo] = oDataRow["Nombre"].ToString();
arregloPorcentage[indiceArreglo] = Convert.ToDouble(oDataRow["Datos"].ToString());
indiceArreglo++;
}
object[] oObject = new object[2];
oObject[0] = arregloConcepto;
oObject[1] = arregloPorcentage;
return oObject;
}

}

esta es una clase para una grafica de pastel y bueno la forma de programarlo varia.

La mayoria lo unico que necesitas es desarrollar una clase que calcule Maximos y minimos por que como todo lo harias manual los datos en oaciobnes se saldrian de la graifica.

Por ultimo

para visualizar la Grafica

IndicadoresGrafica GRaficaPastel = new IndicadoresGrafica(DO.LoadDatosGrafica(Convert.ToI nt16(dllPeriodo.SelectedValue), Convert.ToInt16(dllFechaIni.SelectedValue), Convert.ToInt16(dllFechaFin.SelectedValue), IdIndicador));
msImage.Controls.Add(GRaficaPastel);

solo agreags a un div la grafica.