private UltraChart CreateNewStackColumnChart(string reportType)
        {
            UltraChart lStackColumnChart = new UltraChart();

            try
            {
                lStackColumnChart.Dock              = DockStyle.Fill;
                lStackColumnChart.ChartType         = ChartType.StackColumnChart;
                lStackColumnChart.Tooltips.Overflow = TooltipOverflow.ChartArea;

                lStackColumnChart.ColumnChart.SeriesSpacing = 1;

                Infragistics.UltraChart.Resources.Appearance.ChartTextAppearance chartTextAppearance = new Infragistics.UltraChart.Resources.Appearance.ChartTextAppearance();
                Infragistics.UltraChart.Resources.Appearance.StackAppearance     stackAppearance     = new Infragistics.UltraChart.Resources.Appearance.StackAppearance();

                chartTextAppearance.ChartTextFont    = new Font("Verdana", 8F);
                chartTextAppearance.Column           = 0;
                chartTextAppearance.ItemFormatString = "<DATA_VALUE:00.00>";
                chartTextAppearance.Row             = -2;
                chartTextAppearance.VerticalAlign   = StringAlignment.Center;
                chartTextAppearance.HorizontalAlign = StringAlignment.Near;
                lStackColumnChart.BarChart.ChartText.Add(chartTextAppearance);

                lStackColumnChart.Axis.BackColor = Color.White;

                lStackColumnChart.Axis.Y.Labels.Font                         = new Font("Verdana", 8F);
                lStackColumnChart.Axis.Y.Labels.FontColor                    = Color.DimGray;
                lStackColumnChart.Axis.Y.Labels.HorizontalAlign              = StringAlignment.Far;
                lStackColumnChart.Axis.Y.Labels.ItemFormatString             = "<DATA_VALUE:0.##>";
                lStackColumnChart.Axis.Y.Labels.Layout.Behavior              = AxisLabelLayoutBehaviors.Auto;
                lStackColumnChart.Axis.Y.Labels.Orientation                  = TextOrientation.Horizontal;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.Font            = new Font("Verdana", 8F);
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.FontColor       = Color.DimGray;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.HorizontalAlign = StringAlignment.Center;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.Orientation     = TextOrientation.VerticalLeftFacing;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.VerticalAlign   = StringAlignment.Center;
                lStackColumnChart.Axis.Y.Labels.VerticalAlign                = StringAlignment.Center;
                lStackColumnChart.Axis.Y.LineThickness                       = 1;
                lStackColumnChart.Axis.Y.MajorGridLines.AlphaLevel           = 255;
                lStackColumnChart.Axis.Y.MajorGridLines.Color                = Color.Gainsboro;
                lStackColumnChart.Axis.Y.MajorGridLines.DrawStyle            = LineDrawStyle.Solid;
                lStackColumnChart.Axis.Y.MajorGridLines.Visible              = true;
                lStackColumnChart.Axis.Y.MinorGridLines.AlphaLevel           = 200;
                lStackColumnChart.Axis.Y.MinorGridLines.Color                = Color.LightGray;
                lStackColumnChart.Axis.Y.MinorGridLines.DrawStyle            = LineDrawStyle.Dot;
                lStackColumnChart.Axis.Y.MinorGridLines.Visible              = true;
                lStackColumnChart.Axis.Y.TickmarkInterval                    = 40;
                lStackColumnChart.Axis.Y.TickmarkStyle                       = AxisTickStyle.Smart;
                lStackColumnChart.Axis.Y.Visible = true;

                //lStackColumnChart.Axis.X.Margin.Near.Value = 0.74626865671641784;
                lStackColumnChart.Axis.Y.Margin.Far.Value = 2;

                lStackColumnChart.Axis.X.Extent = 13;
                lStackColumnChart.Axis.Y.Extent = 30;

                lStackColumnChart.Axis.X.Labels.ItemFormatString = String.Empty;

                lStackColumnChart.Axis.X.Labels.SeriesLabels.Font      = new Font("Verdana", 8F);
                lStackColumnChart.Axis.X.Labels.SeriesLabels.FontColor = Color.DimGray;

                lStackColumnChart.Axis.X.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
                lStackColumnChart.Axis.Y.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;

                // title
                lStackColumnChart.TitleBottom.Visible      = false;
                lStackColumnChart.TitleTop.Font            = new Font("Verdana", 12.75F, FontStyle.Regular);
                lStackColumnChart.TitleTop.HorizontalAlign = StringAlignment.Center;
                lStackColumnChart.TitleTop.Visible         = false;

                lStackColumnChart.Tooltips.Font                  = new Font("Calibri", 8.25F);
                lStackColumnChart.Tooltips.FormatString          = " <SERIES_LABEL>, <ITEM_LABEL>: <DATA_VALUE> ";
                lStackColumnChart.Tooltips.HighlightFillColor    = Color.LightBlue;
                lStackColumnChart.Tooltips.HighlightOutlineColor = Color.LightBlue;

                // colours
                lStackColumnChart.BackgroundImageLayout = ImageLayout.Center;
                lStackColumnChart.Border.Color          = Color.FromArgb(170, 173, 187);
                //lStackColumnChart.ColorModel.AlphaLevel = ((byte)(255));

                lStackColumnChart.ColorModel.AlphaLevel = 200;
                lStackColumnChart.ColorModel.ColorBegin = Color.Red;
                lStackColumnChart.ColorModel.ColorEnd   = Color.Red;
                lStackColumnChart.ColorModel.ModelStyle = ColorModels.CustomLinear;
                //lColumnChart.ColorModel.Scaling = ColorScaling.None;

                Infragistics.UltraChart.Resources.Appearance.GradientEffect gradientEffect1 = new Infragistics.UltraChart.Resources.Appearance.GradientEffect();

                gradientEffect1.Coloring = GradientColoringStyle.Lighten;
                gradientEffect1.Style    = GradientStyle.BackwardDiagonal;
                lStackColumnChart.Effects.Effects.Add(gradientEffect1);

                // use different colour depending on report type
                DataTable reportData;

                if (reportType == "Under-Licensed Applications")
                {
                    reportData = new StatisticsDAO().StatisticsUnderLicensedApplicationsForDashboard();
                    lStackColumnChart.ColorModel.ColorBegin = Color.FromArgb(211, 78, 78);
                }
                else
                {
                    reportData = new StatisticsDAO().StatisticsOverLicensedApplicationsForDashboard();
                    lStackColumnChart.ColorModel.ColorBegin = Color.FromArgb(151, 189, 100);
                }

                lStackColumnChart.ColorModel.ModelStyle = ColorModels.Office2007Style;
                lStackColumnChart.ColorModel.Scaling    = ColorScaling.Decreasing;

                lStackColumnChart.Data.UseRowLabelsColumn = false;
                lStackColumnChart.EmptyChartText          = "";
                lStackColumnChart.InvalidDataReceived    += lChart_InvalidDataReceived;
                lStackColumnChart.ChartDataClicked       += licenseChart_ChartDataClicked;

                lStackColumnChart.DataSource = reportData;
            }
            catch (Exception ex)
            {
                //logger.Error(ex.Message);
            }

            return(lStackColumnChart);
        }
示例#2
0
        private UltraChart CreateNewStackColumnChart()
        {
            UltraChart lStackColumnChart = new UltraChart();

            try
            {
                lStackColumnChart.Dock      = DockStyle.Fill;
                lStackColumnChart.ChartType = ChartType.StackColumnChart;

                lStackColumnChart.ColumnChart.SeriesSpacing = 1;

                Infragistics.UltraChart.Resources.Appearance.ChartTextAppearance chartTextAppearance = new Infragistics.UltraChart.Resources.Appearance.ChartTextAppearance();
                Infragistics.UltraChart.Resources.Appearance.StackAppearance     stackAppearance     = new Infragistics.UltraChart.Resources.Appearance.StackAppearance();

                chartTextAppearance.ChartTextFont    = new Font("Verdana", 8F);
                chartTextAppearance.Column           = 0;
                chartTextAppearance.ItemFormatString = "<DATA_VALUE:00.00>";
                chartTextAppearance.Row             = -2;
                chartTextAppearance.VerticalAlign   = StringAlignment.Center;
                chartTextAppearance.HorizontalAlign = StringAlignment.Near;
                lStackColumnChart.BarChart.ChartText.Add(chartTextAppearance);

                lStackColumnChart.Axis.BackColor = Color.White;

                lStackColumnChart.Axis.X.Extent           = 35;
                lStackColumnChart.Axis.Y.Extent           = 20;
                lStackColumnChart.Axis.Y.Margin.Far.Value = 2;

                lStackColumnChart.Axis.Y.Labels.Font                         = new Font("Verdana", 8F);
                lStackColumnChart.Axis.Y.Labels.FontColor                    = Color.DimGray;
                lStackColumnChart.Axis.Y.Labels.HorizontalAlign              = StringAlignment.Far;
                lStackColumnChart.Axis.Y.Labels.ItemFormatString             = "<DATA_VALUE:0.##>";
                lStackColumnChart.Axis.Y.Labels.Layout.Behavior              = AxisLabelLayoutBehaviors.Auto;
                lStackColumnChart.Axis.Y.Labels.Orientation                  = TextOrientation.Horizontal;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.Font            = new Font("Verdana", 7F);
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.FontColor       = Color.DimGray;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.HorizontalAlign = StringAlignment.Center;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.Orientation     = TextOrientation.VerticalLeftFacing;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.VerticalAlign   = StringAlignment.Center;
                lStackColumnChart.Axis.Y.Labels.VerticalAlign                = StringAlignment.Center;
                lStackColumnChart.Axis.Y.LineThickness                       = 1;
                lStackColumnChart.Axis.Y.MajorGridLines.AlphaLevel           = 255;
                lStackColumnChart.Axis.Y.MajorGridLines.Color                = Color.Gainsboro;
                lStackColumnChart.Axis.Y.MajorGridLines.DrawStyle            = LineDrawStyle.Solid;
                lStackColumnChart.Axis.Y.MajorGridLines.Visible              = true;
                lStackColumnChart.Axis.Y.MinorGridLines.AlphaLevel           = 200;
                lStackColumnChart.Axis.Y.MinorGridLines.Color                = Color.LightGray;
                lStackColumnChart.Axis.Y.MinorGridLines.DrawStyle            = LineDrawStyle.Dot;
                lStackColumnChart.Axis.Y.MinorGridLines.Visible              = true;
                lStackColumnChart.Axis.Y.TickmarkInterval                    = 40;
                lStackColumnChart.Axis.Y.TickmarkStyle                       = AxisTickStyle.Smart;
                lStackColumnChart.Axis.Y.Visible = true;

                lStackColumnChart.Axis.X.Labels.ItemFormatString = String.Empty;

                lStackColumnChart.Axis.X.Labels.SeriesLabels.Font      = new Font("Verdana", 8F);
                lStackColumnChart.Axis.X.Labels.SeriesLabels.FontColor = Color.DimGray;

                lStackColumnChart.Axis.X.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
                lStackColumnChart.Axis.Y.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;

                // title
                lStackColumnChart.TitleBottom.Visible      = false;
                lStackColumnChart.TitleTop.Font            = new Font("Verdana", 10F, FontStyle.Regular);
                lStackColumnChart.TitleTop.HorizontalAlign = StringAlignment.Center;
                lStackColumnChart.TitleTop.Visible         = false;

                lStackColumnChart.Tooltips.Font                  = new Font("Verdana", 8F);
                lStackColumnChart.Tooltips.FormatString          = " Drive <SERIES_LABEL> <ITEM_LABEL>: <DATA_VALUE> GB ";
                lStackColumnChart.Tooltips.HighlightFillColor    = Color.LightBlue;
                lStackColumnChart.Tooltips.HighlightOutlineColor = Color.LightBlue;

                // colours
                lStackColumnChart.BackgroundImageLayout = ImageLayout.Center;
                lStackColumnChart.Border.Color          = Color.FromArgb(170, 173, 187);
                lStackColumnChart.ColorModel.Scaling    = ColorScaling.Decreasing;

                lStackColumnChart.ColorModel.AlphaLevel = 200;
                lStackColumnChart.ColorModel.ColorBegin = Color.FromArgb(151, 189, 100);
                //lStackColumnChart.ColorModel.ColorEnd = System.Drawing.Color.Red;
                lStackColumnChart.ColorModel.ModelStyle = ColorModels.Office2007Style;
                //lColumnChart.ColorModel.Scaling = ColorScaling.None;

                lStackColumnChart.Tooltips.Overflow = TooltipOverflow.ChartArea;

                Infragistics.UltraChart.Resources.Appearance.GradientEffect gradientEffect1 = new Infragistics.UltraChart.Resources.Appearance.GradientEffect();

                gradientEffect1.Coloring = GradientColoringStyle.Lighten;
                gradientEffect1.Style    = GradientStyle.BackwardDiagonal;
                lStackColumnChart.Effects.Effects.Add(gradientEffect1);

                lStackColumnChart.Data.UseRowLabelsColumn = false;
                lStackColumnChart.EmptyChartText          = "";
                lStackColumnChart.InvalidDataReceived    += lStackColumnChart_InvalidDataReceived;
            }
            catch (Exception ex)
            {
                //logger.Error(ex.Message);
            }

            return(lStackColumnChart);
        }