/// <summary>
 /// Sets interval properties for the axis.
 /// Note that we use the Axis object's interval properties, and not the properties of its label,
 /// and major tick mark and grid line objects
 /// </summary>
 public void SetAxisInterval(System.Web.UI.DataVisualization.Charting.Axis axis, double interval, DateTimeIntervalType intervalType, double intervalOffset, DateTimeIntervalType intervalOffsetType)
 {
     // Set interval-related properties
     axis.Interval           = interval;
     axis.IntervalType       = intervalType;
     axis.IntervalOffset     = intervalOffset;
     axis.IntervalOffsetType = intervalOffsetType;
 }
예제 #2
0
        private static void ApplyAxis(DV.Axis axis, ChartAxisData axisData)
        {
            if (axisData == null)
            {
                return;
            }

            if (!String.IsNullOrEmpty(axisData.Title))
            {
                axis.Title = axisData.Title;
            }
            axis.Minimum = axisData.Minimum;
            axis.Maximum = axisData.Maximum;
        }
예제 #3
0
        /// <summary>
        /// Metodo que se encarga de crear el 'Coco' de los gráficos de barra
        /// </summary>
        /// <returns></returns>
        public System.Web.UI.DataVisualization.Charting.Chart CrearTorta()
        {
            System.Web.UI.DataVisualization.Charting.Chart TortaRecursos = new System.Web.UI.DataVisualization.Charting.Chart();
            TortaRecursos.Width             = System.Web.UI.WebControls.Unit.Pixel(650);
            TortaRecursos.Height            = System.Web.UI.WebControls.Unit.Pixel(400);
            TortaRecursos.BackGradientStyle = GradientStyle.TopBottom;

            Legend Default = new Legend();

            Default.LegendStyle   = LegendStyle.Row;
            Default.Docking       = Docking.Bottom;
            Default.Alignment     = StringAlignment.Center;
            Default.BackColor     = Color.Transparent;
            Default.IsTextAutoFit = false;
            //Font font = new Font();
            //font.FontFamily=FontFamily.
            //Default.Font=
            TortaRecursos.Legends.Add(Default);



            ChartArea ChartArea1 = new ChartArea("ChartArea1");

            System.Web.UI.DataVisualization.Charting.Axis axisX = new System.Web.UI.DataVisualization.Charting.Axis();
            axisX.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep90;
            axisX.IsLabelAutoFit    = true;
            axisX.Interval          = 1;


            System.Web.UI.DataVisualization.Charting.Axis axisY = new System.Web.UI.DataVisualization.Charting.Axis();
            axisX.Interval = 0.2;

            ChartArea1.AxisX = axisX;
            ChartArea1.AxisY = axisY;

            //Color borderColor = new Color();
            //borderColor.A = 64;
            //borderColor.B = 64;
            //borderColor.G = 64;
            //borderColor.R = 64;
            //ChartArea1.BorderColor=borderColor;
            ChartArea1.BackColor            = Color.Transparent;
            ChartArea1.BackSecondaryColor   = Color.Transparent;
            ChartArea1.Area3DStyle.Enable3D = true;
            ChartArea1.BorderWidth          = 0;

            TortaRecursos.ChartAreas.Add(ChartArea1);

            System.Web.UI.DataVisualization.Charting.Series tipoRecurso = new System.Web.UI.DataVisualization.Charting.Series("Recursos");
            tipoRecurso.ShadowColor                 = Color.Gray;
            tipoRecurso.ChartType                   = SeriesChartType.Pie;
            tipoRecurso.IsVisibleInLegend           = true;
            tipoRecurso.MarkerImageTransparentColor = Color.Aqua;
            tipoRecurso.Label = "#PERCENT{P1}";
            tipoRecurso.IsValueShownAsLabel = true;
            tipoRecurso.LabelForeColor      = Color.White;
            tipoRecurso.XValueType          = ChartValueType.Auto;
            TortaRecursos.Series.Add(tipoRecurso);


            return(TortaRecursos);
        }
예제 #4
0
        public string CrearGraficoBarra(Empresa empresa, string strDirectorio)
        {
            System.Web.UI.DataVisualization.Charting.Chart Chart1 = new System.Web.UI.DataVisualization.Charting.Chart();
            Chart1.Width  = System.Web.UI.WebControls.Unit.Pixel(650);
            Chart1.Height = System.Web.UI.WebControls.Unit.Pixel(400);

            Legend legend = new Legend();

            legend.LegendStyle = LegendStyle.Table;
            legend.Docking     = Docking.Bottom;
            Chart1.Legends.Add(legend);

            ChartArea ChartArea1 = new ChartArea("ChartArea1");

            System.Web.UI.DataVisualization.Charting.Axis axisX = new System.Web.UI.DataVisualization.Charting.Axis();
            axisX.LabelAutoFitStyle       = LabelAutoFitStyles.LabelsAngleStep90;
            axisX.LabelAutoFitMaxFontSize = 10;
            axisX.IsLabelAutoFit          = true;
            axisX.Interval = 1;

            System.Web.UI.DataVisualization.Charting.Axis axisY = new System.Web.UI.DataVisualization.Charting.Axis();
            axisX.Interval = 0.2;

            ChartArea1.AxisX = axisX;
            ChartArea1.AxisY = axisY;


            Chart1.ChartAreas.Add(ChartArea1);

            System.Web.UI.DataVisualization.Charting.Series Recursos = new System.Web.UI.DataVisualization.Charting.Series("Recursos");
            Recursos.ShadowColor       = Color.Gray;
            Recursos.ChartType         = SeriesChartType.Column;
            Recursos.IsVisibleInLegend = true;
            Chart1.Series.Add(Recursos);

            System.Web.UI.DataVisualization.Charting.Series srPromedio = new System.Web.UI.DataVisualization.Charting.Series("Promedio");
            srPromedio.ShadowColor = Color.Red;
            srPromedio.ChartType   = SeriesChartType.Line;
            srPromedio.BorderWidth = 2;
            Chart1.Series.Add(srPromedio);

            List <Entidades.MatrizValoracion> MatrizValoracion = new List <RBV_Clases.MatrizValoracion>();
            List <RBV_Clases.RecursoValioso>  recursosValiosos = new List <RBV_Clases.RecursoValioso>();
            decimal ValorTotal = 0;

            MatrizValoracion = RBV_Negocio.MatrizBO.ConsultarMatrizValoracion(empresa.IdEmpresa).OrderBy(p => p.IdCaracteristica).ThenBy(p => p.IdRecurso).ToList();

            if (MatrizValoracion.Count > 0)
            {
                recursosValiosos = RBV_Negocio.MatrizBO.CalcularResultadosMatriz(MatrizValoracion, empresa.IdEmpresa);
                ValorTotal       = recursosValiosos.Sum(p => p.Valor) / recursosValiosos.Count;
            }
            string[]  Titulos  = recursosValiosos.Select(p => p.NombreRecurso).ToArray();
            decimal[] Valores  = recursosValiosos.Select(p => p.Valor).ToArray();
            decimal[] Promedio = new decimal[Titulos.Length];

            Chart1.Series["Recursos"].Points.DataBindXY(Titulos, Valores);
            for (int i = 0; i < Titulos.Length; i++)
            {
                Promedio[i] = ValorTotal;
            }

            Chart1.Series["Promedio"].Points.DataBindXY(Titulos, Promedio);
            string strFile = "Barra" + empresa.NombreEmpresa + DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss") + ".Jpeg";
            string imgName = string.Concat(strDirectorio, "\\", strFile);

            Chart1.SaveImage(imgName, ChartImageFormat.Jpeg);
            return(imgName);
        }
 /// <summary>
 /// Sets interval properties for the axis.
 /// Note that we use the Axis object's interval properties, and not the properties of its label,
 /// and major tick mark and grid line objects
 /// </summary>
 public void SetAxisInterval(System.Web.UI.DataVisualization.Charting.Axis axis, double interval, DateTimeIntervalType intervalType)
 {
     SetAxisInterval(axis, interval, intervalType, 0, DateTimeIntervalType.Auto);
 }