Ejemplo n.º 1
0
        public void SetChartSeriesStyle(ChartFX.WebForms.Chart chart, DataTable dataSource)
        {
            for (int i = 0; i < chart.Series.Count; i++)
            {
                // Todo: display the point information in the buttom of the line
                if (chart.AxisX.Labels.Count > 0)
                {
                    int xpos = this.GetLastPos(dataSource, chart.Series[i].Text);
                    if (xpos < 0 || xpos > chart.AxisX.Labels.Count - 1)
                    {
                        xpos = chart.AxisX.Labels.Count - 1;
                    }
                    chart.Points[i, xpos].PointLabels.Visible = true;
                    if (chart.Series[i].Text.ToUpper().Contains("QTY") || chart.Series[i].Text.ToUpper().Contains("OUTPUT"))
                    {
                        chart.Series[i].Gallery = Gallery.Bar;
                        chart.Points[i, xpos].PointLabels.LineAlignment = System.Drawing.StringAlignment.Center;
                    }
                    else if (chart.Series[i].Text.Contains("%") || chart.Series[i].Text.ToUpper().Contains("RATIO") || chart.Series[i].Text.ToUpper().Contains("YIELD"))
                    {
                        chart.Series[i].Gallery = Gallery.Lines;
                        for (int j = 0; j < chart.AxisX.Labels.Count; j++)
                        {
                            chart.Points[i, j].PointLabels.LineAlignment = System.Drawing.StringAlignment.Far;
                        }
                    }
                }

                // Todo:
                if (chart.Series[i].Text.Contains("$"))
                {
                    chart.Series[i].Text = chart.Series[i].Text.Replace("$", "_");
                }
            }
        }
Ejemplo n.º 2
0
        public void SetChartTitle(ChartFX.WebForms.Chart chart, string title)
        {
            if (chart == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(title) == true)
            {
                return;
            }

            chart.Titles.Clear();
            List <TitleDockable> listTitle = new List <TitleDockable>();

            System.Drawing.Font font = new System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Bold);
            int start = 0;

            for (; ;)
            {
                int len = 75;
                if (start + len < title.Length)
                {
                    if (title[start + len].Equals('_') == false || title[start + len].Equals(',') == false)
                    {
                        for (int i = start + len; i > start + len - 20; i--)
                        {
                            if (title[i] == '_' || title[i] == ',')
                            {
                                len = i - start;
                                break;
                            }
                        }
                    }
                    TitleDockable td = new TitleDockable(title.Substring(start, len + 1));
                    td.Font = font;
                    listTitle.Add(td);
                }
                else
                {
                    TitleDockable td = new TitleDockable(title.Substring(start));
                    td.Font = font;
                    listTitle.Add(td);
                    break;
                }
                start = start + len + 1;
            }

            chart.LegendBox.Titles.Clear();
            chart.LegendBox.AutoSize = true;
            for (int i = 0; i < listTitle.Count; i++)
            {
                chart.LegendBox.Titles.Add(listTitle[i]);
            }
            chart.LegendBox.ContentLayout = ContentLayout.Spread;
            chart.LegendBox.Border        = DockBorder.None;
            chart.LegendBox.SizeToFit();
        }
Ejemplo n.º 3
0
        public void setchartfxStyle(ChartFX.WebForms.Chart FX, ChartFX.WebForms.Gallery ChartGallery, string title, int AxisX_Step, int X_ScaleUnit, int Y_ScaleUnit, bool showTargetLine, int TargetQty)
        {
            //FX.Height = Unit.Pixel(180);
            //FX.Width = Unit.Pixel(210);
            //FX.EnableViewState = false;
            FX.Gallery            = ChartGallery;
            FX.AllSeries.FillMode = FillMode.Gradient;
            GradientBackground myGradient = new GradientBackground(GradientType.Radial);

            //myGradient.ColorFrom = Color.Black;
            //myGradient.ColorTo = Color.Black;
            myGradient.Angle = 45;
            SimpleBorder myBorder = new SimpleBorder(SimpleBorderType.Etched);

            //myBorder.Color = Color.Gray;
            myBorder.InternalOpposite = false;
            FX.Background             = myGradient;
            FX.Border            = myBorder;
            FX.LegendBox.Visible = false;
            FX.RenderFormat      = "Image";
            //FX.AllSeries.Border.Color = Color.Black;
            TitleDockable oTitle = new TitleDockable();

            oTitle.Text      = title;
            oTitle.TextColor = Color.Red;
            FX.Titles.Add(oTitle);

            FX.AxisX.ForceZero            = true;
            FX.AxisX.ScrollPosition       = 200;
            FX.AxisY2.Grids.Major.Visible = false;
            FX.AxisX.Grids.Major.Visible  = false;
            //FX.ForeColor = Color.Yellow;
            //FX.ChartAreaRectangle.Location.
            FX.PlotAreaMargin.Top    = 20;
            FX.PlotAreaMargin.Left   = 10;
            FX.PlotAreaMargin.Bottom = 10;
            FX.PlotAreaMargin.Right  = 10;
            if (AxisX_Step > 0)
            {
                FX.AxisX.Step = double.Parse(AxisX_Step.ToString());
            }
            if (showTargetLine == true)
            {
                ShowTagLine_FX(FX, TargetQty);
            }
            if (X_ScaleUnit > 0)
            {
                FX.AxisX.ScaleUnit = double.Parse(X_ScaleUnit.ToString());
            }
            if (Y_ScaleUnit > 0)
            {
                FX.AxisY.ScaleUnit = double.Parse(Y_ScaleUnit.ToString());
            }
            FX.ToolBar.Visible = false;
        }
Ejemplo n.º 4
0
        public void InitChart(ChartFX.WebForms.Chart chart)
        {
            if (chart == null)
            {
                return;
            }

            chart.Titles.Clear();
            chart.Series.Clear();
            chart.Points.Clear();
        }
Ejemplo n.º 5
0
        public void ShowTagLine_FX(ChartFX.WebForms.Chart ChartName, int TagValue)
        {
            CustomGridLine TagLine = new CustomGridLine();

            TagLine.Color     = Color.Red;
            TagLine.Value     = TagValue;
            TagLine.ShowLine  = true;
            TagLine.ShowText  = true;
            TagLine.TextColor = Color.Red;
            ChartName.AxisY.CustomGridLines.Add(TagLine);
            ConditionalHighlightAttributes hCustomGridAttr = ChartName.AxisY.CustomGridLines[0].Highlight;

            hCustomGridAttr.Series = 1;
        }
Ejemplo n.º 6
0
        public void setchartfx(DataTable dt, ChartFX.WebForms.Chart chart, string title)
        {
            TitleDockable newTitle = new TitleDockable();

            chart.DataSource = dt;
            chart.DataBind();
            chart.Zoom    = true;
            newTitle.Text = title;
            chart.Titles.Add(newTitle);
            newTitle.Font           = new Font(newTitle.Font, FontStyle.Bold);
            newTitle.Dock           = DockArea.Top;
            chart.LegendBox.Visible = false;
            chart.Width             = 300;
            chart.Height            = 200;
            chart.RenderFormat      = "Image";
            //Link to Chart
            Link seriesLink = chart.Series[0].Link;

            seriesLink.OnMouseOver = "DisplayTooltip('<IMG SRC=../ChartReport_Detail.aspx>');";
            seriesLink.OnMouseOut  = "DisplayTooltip('');";
        }
Ejemplo n.º 7
0
        public void SetChartStyle(ChartFX.WebForms.Chart chart)
        {
            if (chart == null)
            {
                return;
            }

            chart.MenuBar.Visible  = false;
            chart.ToolBar.Visible  = false;
            chart.ContextMenus     = false;
            chart.DataGrid.Visible = false;

            chart.View3D.Enabled  = false;
            chart.EnableViewState = false;

            chart.LegendBox.Dock = ChartFX.WebForms.DockArea.Top;
            //chart.LegendBox.Height = 60;
            chart.LegendBox.AutoSize = true;
            chart.LegendBox.Border   = DockBorder.None;
            chart.ToolBar.Dock       = DockArea.Top;

            chart.Width  = 750;
            chart.Height = 350;
        }
Ejemplo n.º 8
0
 public void SetChartSeriesStyle(ChartFX.WebForms.Chart chart)
 {
     this.SetChartSeriesStyle(chart, null);
 }