Exemplo n.º 1
0
        /// <summary>
        /// BindChart :Private method used to bind chart based on the parameter
        /// </summary>
        /// <param name="chartModule">dotnetCHARTING.Chart</param>
        /// <param name="query">String Sql Query</param>
        /// <param name="title">title</param>
        /// <param name="format">format</param>
        private void BindChart(dotnetCHARTING.Chart chartModule, string query, string title, string format)
        {
            dotnetCHARTING.ChartType myChartType;
            string strFormat = "%YValue";
            //dotnetCHARTING.ChartType myChartType = (dotnetCHARTING.ChartType)Enum.Parse(typeof(dotnetCHARTING.ChartType), Session["ChartType"].ToString(), true);
            dotnetCHARTING.Scale myAxisScale = (dotnetCHARTING.Scale)Enum.Parse(typeof(dotnetCHARTING.Scale), "Range", true);
            dotnetCHARTING.SeriesType mySeriesType = (dotnetCHARTING.SeriesType)Enum.Parse(typeof(dotnetCHARTING.SeriesType), "Column", true);
            dotnetCHARTING.LegendBoxPosition myLegendBoxPosition = dotnetCHARTING.LegendBoxPosition.BottomMiddle;

            if (Request.QueryString["ChartPalette"] == null && Request.QueryString["ChartType"] == null)
            {
                chartModule.PaletteName = customerActivitySheet.GetPaletteName(Session["ChartPalette"].ToString());
                myChartType = (dotnetCHARTING.ChartType)Enum.Parse(typeof(dotnetCHARTING.ChartType), Session["ChartType"].ToString(), true);
            }
            else
            {
                chartModule.PaletteName = customerActivitySheet.GetPaletteName(Request.QueryString["ChartPalette"].ToString());
                myChartType = (dotnetCHARTING.ChartType)Enum.Parse(typeof(dotnetCHARTING.ChartType), Request.QueryString["ChartType"].ToString(), true);
            }
            //General settings
            chartModule.DefaultSeries.ConnectionString = Global.ReportsConnectionString.ToString();
            chartModule.DefaultSeries.LimitMode = (dotnetCHARTING.LimitMode)Enum.Parse(typeof(dotnetCHARTING.LimitMode), "Top", true);
            chartModule.DefaultSeries.DefaultElement.ShowValue = true;
            chartModule.DefaultAxis.NumberPercision = 0;

            chartModule.Mentor = false;
            chartModule.TempDirectory = "temp";
            chartModule.Visible = true;
            chartModule.Type = myChartType;
            chartModule.Height = 210;
            chartModule.Width = 300;
            chartModule.UseFile = true;
            chartModule.Debug = false;
            chartModule.DonutHoleSize = 50;
            chartModule.LegendBox.Template = "%icon%name";
            chartModule.LegendBox.Position = myLegendBoxPosition;
            chartModule.Use3D = true;
            chartModule.Transpose = true;
            chartModule.DefaultSeries.ShowOther = true;
            chartModule.DefaultSeries.Type = mySeriesType;
            chartModule.DefaultAxis.Scale = myAxisScale;
            chartModule.Series.Name = "";
            chartModule.AutoNameLabels = true;
            chartModule.Title = "";
            chartModule.Series.SqlStatement = query;
            chartModule.SeriesCollection.Add();
            chartModule.PrinterOptimizedText = true;
            chartModule.ChartArea.ClearColors();
            chartModule.DefaultSeries.DefaultElement.ShowValue = true;
            if (format == "$")
            {
                strFormat = "$ %YValue";
                chartModule.YAxis.NumberPrecision = 0;
            }
            else if (format == "%")
            {
                strFormat = "%YValue %";
                chartModule.YAxis.NumberPrecision = 1;
            }
            else
                chartModule.YAxis.NumberPrecision = 0;

            chartModule.DefaultSeries.DefaultElement.SmartLabel.Text = strFormat;
            chartModule.PieLabelMode = dotnetCHARTING.PieLabelMode.Inside;
            chartModule.DefaultSeries.DefaultElement.Transparency = 10;

        }
Exemplo n.º 2
0
        /// <summary>
        /// BindChart : Method used to bind valus in Chart
        /// </summary>
        /// <param name="chartModule">dotnetCHARTING.Chart</param>
        /// <param name="dtTable">datasource DataTable</param>
        /// <param name="strColumn">Filter Column </param>
        private void BindChart(dotnetCHARTING.Chart chartModule, DataTable dtTable, string[] strColumn, bool isexplode)
        {
            dotnetCHARTING.ChartType myChartType;

            dotnetCHARTING.Scale             myAxisScale         = (dotnetCHARTING.Scale)Enum.Parse(typeof(dotnetCHARTING.Scale), "Normal", true);
            dotnetCHARTING.SeriesType        mySeriesType        = (dotnetCHARTING.SeriesType)Enum.Parse(typeof(dotnetCHARTING.SeriesType), "Column", true);
            dotnetCHARTING.PieLabelMode      myPieLabelMode      = dotnetCHARTING.PieLabelMode.Outside;
            dotnetCHARTING.LegendBoxPosition myLegendBoxPosition = dotnetCHARTING.LegendBoxPosition.None;

            if (Request.QueryString["ChartPalette"] == null && Request.QueryString["ChartType"] == null)
            {
                chartModule.PaletteName = customerActivitySheet.GetPaletteName(Session["ChartPalette"].ToString());
                myChartType             = (dotnetCHARTING.ChartType)Enum.Parse(typeof(dotnetCHARTING.ChartType), Session["ChartType"].ToString(), true);
            }
            else
            {
                chartModule.PaletteName = customerActivitySheet.GetPaletteName(Request.QueryString["ChartPalette"].ToString());
                myChartType             = (dotnetCHARTING.ChartType)Enum.Parse(typeof(dotnetCHARTING.ChartType), Request.QueryString["ChartType"].ToString(), true);
            }

            //General settings
            chartModule.DefaultSeries.LimitMode = (dotnetCHARTING.LimitMode)Enum.Parse(typeof(dotnetCHARTING.LimitMode), "Top", true);
            chartModule.DefaultSeries.DefaultElement.ShowValue = true;
            chartModule.DefaultAxis.NumberPercision            = 0;

            chartModule.Mentor                  = false;
            chartModule.TempDirectory           = "temp";
            chartModule.Visible                 = true;
            chartModule.Type                    = myChartType;
            chartModule.Height                  = 220;
            chartModule.Width                   = 600;
            chartModule.UseFile                 = true;
            chartModule.Debug                   = false;
            chartModule.DonutHoleSize           = 50;
            chartModule.LegendBox.Template      = "%icon%name";
            chartModule.LegendBox.Position      = myLegendBoxPosition;
            chartModule.Use3D                   = true;
            chartModule.Transpose               = true;
            chartModule.DefaultSeries.ShowOther = true;
            chartModule.DefaultSeries.Type      = mySeriesType;
            chartModule.DefaultAxis.Scale       = myAxisScale;
            chartModule.PieLabelMode            = myPieLabelMode;
            chartModule.Series.Name             = "";
            chartModule.AutoNameLabels          = true;
            chartModule.Title                   = "";
            chartModule.Series.Data             = dtTable.DefaultView.ToTable(false, strColumn);
            chartModule.SeriesCollection.Add();
            chartModule.PrinterOptimizedText = true;
            chartModule.ChartArea.ClearColors();
            chartModule.DefaultSeries.DefaultElement.ExplodeSlice = isexplode;
            chartModule.DefaultSeries.DefaultElement.Transparency = 10;

            chartModule.DefaultSeries.DefaultElement.ShowValue = true;
            if (isexplode)
            {
                chartModule.DefaultSeries.DefaultElement.SmartLabel.Text = "%Name \n %YValue ";
                chartModule.YAxis.NumberPrecision = 0;
            }
            else
            {
                chartModule.DefaultSeries.DefaultElement.SmartLabel.Text = "%Name \n %YValue %";
                chartModule.YAxis.NumberPrecision = 1;
            }
        }