Exemplo n.º 1
0
        private void CreateChart(DataTable dt)
        {
            #region Series
            //创建几个图形的对象
            Series series1 = CreateSeries("SD", ViewType.Line, dt, 0);
            Series series2 = CreateSeries("XSD", ViewType.Point, dt, 1);

            PointSeriesView pointSeriesView1 = new PointSeriesView();
            pointSeriesView1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            pointSeriesView1.PointMarkerOptions.Size = 15;
            series2.View = pointSeriesView1;

            //LineSeriesView lineSeriesView1 = new LineSeriesView();
            //lineSeriesView1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            //lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            //lineSeriesView1.LineMarkerOptions.Kind = DevExpress.XtraCharts.MarkerKind.Circle;
            //lineSeriesView1.LineMarkerOptions.Size = 15;
            //lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True;
            //series1.View = lineSeriesView1;

            #endregion

            List <Series> list = new List <Series>()
            {
                series1, series2
            };
            QCchartControl.Series.AddRange(list.ToArray());
        }
        protected virtual Series CreatePointSeries(StrategyDataItemInfo info)
        {
            Series s = new Series();

            s.Name = info.Name;
            s.ArgumentDataMember = GetArgumentDataMember(info);
            s.ArgumentScaleType  = GetArgumentScaleType(info);
            s.ValueDataMembers.AddRange(info.FieldName);
            s.ValueScaleType = ScaleType.Numerical;
            PointSeriesView view = new PointSeriesView();

            view.Color = info.Color;
            view.PointMarkerOptions.Size = info.GraphWidth == 1 ? view.PointMarkerOptions.Size : (int)(info.GraphWidth * DpiProvider.Default.DpiScaleFactor);
            s.View = view;
            object           dataSource = GetDataSource(info);
            IResizeableArray array      = dataSource as IResizeableArray;

            if (array == null || array.Count < BigDataCount)
            {
                s.DataSource = dataSource;
            }
            else
            {
                view.PointMarkerOptions.BorderVisible = false;
                view.PointMarkerOptions.Kind          = MarkerKind.Square;
                view.PointMarkerOptions.Size          = ScaleUtils.ScaleValue(4);
                s.Points.AddRange(CreateSeriesPoints(info));
            }
            return(s);
        }
Exemplo n.º 3
0
 void OnIndentChanged(int oldValue)
 {
     if (cartesianChart == null)
     {
         return;
     }
     foreach (Series series in cartesianChart.Series)
     {
         PointSeriesView view = (PointSeriesView)series.View;
         view.LabelOptions.Indent = Indent;
     }
 }
Exemplo n.º 4
0
        private void FormOnLoad(object sender, EventArgs e)
        {
            this.productsTableAdapter.Fill(this.nwindDataSet.Products);
            PointSeriesView view = (PointSeriesView)chartControl.Series[0].View;

            view.Indicators.Add(new PercentageErrorBars {
                Percent      = 10,
                Direction    = ErrorBarDirection.Both,
                ShowInLegend = true,
                Name         = "Units on Custom Order"
            });
        }
        private void FormOnLoad(object sender, EventArgs e)
        {
            series.ArgumentDataMember = "TimePoint";
            series.ValueDataMembers.AddRange(new string[] { "Temperature" });
            series.DataSource = GetData();
            PointSeriesView view = (PointSeriesView)chartControl.Series[0].View;

            view.Indicators.Add(new StandardErrorBars {
                Direction    = ErrorBarDirection.Both,
                Name         = "Standard Error",
                ShowInLegend = true
            });
        }
Exemplo n.º 6
0
        public void CreateHistogram(DataTable mydt)
        {
            HistBinsData histdata = new HistBinsData(mydt, _settings.xaxisvar, _settings.numbins);

            if (histdata.N > 0)
            {
                Color colortouse = _settings.colors[0];

                Series         s  = CreateHistogramSeries(histdata.bins, colortouse, false);
                AreaSeriesView vw = (AreaSeriesView)s.View;
                chart.Series.Add(s);

                //Normal curve
                if (_settings.shownormalcurve & histdata.normalX != null)
                {
                    Series          s_nc  = CreateNormalCurveSeries(histdata.normalX, histdata.normalY, colortouse, false);
                    PointSeriesView vw_nc = (PointSeriesView)s_nc.View;
                    chart.Series.Add(s_nc);
                }
                //M SD
                if (_settings.histMSD)
                {
                    Series          s_msd  = CreateMSDSeries(histdata.mean, histdata.sd, 0, colortouse, false);
                    PointSeriesView vw_msd = (PointSeriesView)s_msd.View;
                    chart.Series.Add(s_msd);
                }


                string newline = Environment.NewLine;

                string subtitle_text = String.Format("<color={0}> N={1} M={2} SD={3}</color>",
                                                     ColorTranslator.ToHtml(colortouse)
                                                     , histdata.N
                                                     , Math.Round(histdata.mean, 2)
                                                     , Math.Round(histdata.sd, 2));

                this.AddTitles(String.Format("Histogram <b>{0}</b>", _settings.xaxisvar), subtitle_text, "", "Count");

                chart.Width  = _settings.W;
                chart.Height = _settings.H;

                chart.BorderOptions.Color = Color.White;
                chart.Legend.Visibility   = DevExpress.Utils.DefaultBoolean.True;
            }
            else
            {
                //_emptymsg = String.Format("0 cases for {0} {1}", subtitle, var);
                //return null;
            }
        }
Exemplo n.º 7
0
        private void FormOnLoad(object sender, EventArgs e)
        {
            PointSeriesView view = new PointSeriesView();

            view.Indicators.Add(new DataSourceBasedErrorBars {
                ShowInLegend            = true,
                Name                    = "Prices Range",
                NegativeErrorDataMember = "MinProductPrice",
                PositiveErrorDataMember = "MaxProductPrice"
            });
            series.View = view;
            series.ArgumentDataMember = "CategoryName";
            series.ValueDataMembers.AddRange(new string[] { "MeanProductPrice" });
            series.DataSource = GetData();
        }
Exemplo n.º 8
0
        protected virtual Series CreateAnnotationSeriesCore(StrategyDataItemInfo info)
        {
            Series s = new Series();

            s.Name = info.Name;
            s.ArgumentDataMember = GetArgumentDataMember(info);
            s.ValueDataMembers.AddRange(info.FieldName);
            s.ValueScaleType = ScaleType.Numerical;
            PointSeriesView view = new PointSeriesView();

            view.Color = info.Color;
            view.PointMarkerOptions.Size = info.GraphWidth == 1 ? view.PointMarkerOptions.Size : (int)(info.GraphWidth * DpiProvider.Default.DpiScaleFactor);
            s.View = view;
            return(s);
        }
Exemplo n.º 9
0
 private void FormOnLoad(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'nwindDataSet.Products' table. You can move, or remove it, as needed.
     this.productsTableAdapter.Fill(this.nwindDataSet.Products);
     #region #FixedValueErrorBars
     PointSeriesView view = (PointSeriesView)chartControl.Series[0].View;
     view.Indicators.Add(new FixedValueErrorBars {
         NegativeError = 7,
         PositiveError = 10,
         Direction     = ErrorBarDirection.Both,
         ShowInLegend  = true,
         Name          = "Unit Price Range"
     });
     #endregion #FixedValueErrorBars
 }
Exemplo n.º 10
0
        private void InitChart(string title, List <HistoryData> data)
        {
            chartControl1.Series.Clear();
            chartControl1.Titles.Clear();

            int n = data.Max(x => x.id);

            for (int i = 1; i <= n; i++)
            {
                Series series = new Series("Series" + i, ViewType.Line);

                // series.DataSource = data.Where(x=>x.id==i);
                //series.ArgumentScaleType = ScaleType.Qualitative;
                //series.ArgumentDataMember = "time";
                //series.ArgumentScaleType = ScaleType.DateTime;
                //series.ValueScaleType = ScaleType.Numerical;
                //series.ValueDataMembers.AddRange(new string[] { "value" });
                PointSeriesView myView1 = (PointSeriesView)series.View;
                myView1.PointMarkerOptions.Size = 4;
                foreach (HistoryData historyData in data)
                {
                    if (i == historyData.id)
                    {
                        series.Points.Add(new SeriesPoint(historyData.time, historyData.value));
                    }
                }
                chartControl1.Series.Add(series);
            }

            XYDiagram diagram = (XYDiagram)chartControl1.Diagram;

            diagram.AxisX.QualitativeScaleOptions.AutoGrid   = false;
            diagram.AxisX.DateTimeScaleOptions.ScaleMode     = ScaleMode.Manual;           //x轴是扫描轴,时间类型
            diagram.AxisX.DateTimeScaleOptions.MeasureUnit   = DateTimeMeasureUnit.Second; //测量单位是秒这样才能显示到秒
            diagram.AxisX.DateTimeScaleOptions.GridAlignment = DateTimeGridAlignment.Minute;
            diagram.AxisX.DateTimeScaleOptions.GridSpacing   = 1;
            diagram.AxisX.Label.Angle = 30;
            diagram.AxisX.WholeRange.AutoSideMargins  = false;
            diagram.AxisX.WholeRange.SideMarginsValue = 0;

            chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;

            // Add a title to the chart (if necessary).
            ChartTitle chartTitle1 = new ChartTitle();

            chartTitle1.Text = title;
            chartControl1.Titles.Add(chartTitle1);
        }
Exemplo n.º 11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Create a new chart.
            ChartControl pointChart = new ChartControl();

            // Create a point series.
            Series series1 = new Series("Series 1", ViewType.Point);

            // Set the numerical argument scale types for the series,
            // as it is qualitative, by default.
            series1.ArgumentScaleType = ScaleType.Numerical;

            // Add points to it.
            series1.Points.Add(new SeriesPoint(1, 10));
            series1.Points.Add(new SeriesPoint(2, 22));
            series1.Points.Add(new SeriesPoint(3, 14));
            series1.Points.Add(new SeriesPoint(4, 27));
            series1.Points.Add(new SeriesPoint(5, 15));
            series1.Points.Add(new SeriesPoint(6, 28));
            series1.Points.Add(new SeriesPoint(7, 15));
            series1.Points.Add(new SeriesPoint(8, 33));

            // Add the series to the chart.
            pointChart.Series.Add(series1);

            // Access the view-type-specific options of the series.
            PointSeriesView myView1 = (PointSeriesView)series1.View;

            myView1.PointMarkerOptions.Kind           = MarkerKind.Star;
            myView1.PointMarkerOptions.StarPointCount = 5;
            myView1.PointMarkerOptions.Size           = 20;

            // Access the type-specific options of the diagram.
            ((XYDiagram)pointChart.Diagram).Rotated = true;

            // Hide the legend (if necessary).
            pointChart.Legend.Visible = false;

            // Add a title to the chart (if necessary).
            pointChart.Titles.Add(new ChartTitle());
            pointChart.Titles[0].Text = "A Point Chart";

            // Add the chart to the form.
            pointChart.Dock = DockStyle.Fill;
            this.Controls.Add(pointChart);
        }
Exemplo n.º 12
0
        private Series CreateNormalCurveSeries(List <double> x, List <double> y, Color c, bool reflect)
        {
            Series          series          = new Series();
            PointSeriesView pointSeriesView = new PointSeriesView();

            for (int i = 0; i < x.Count(); i++)
            {
                SeriesPoint p1 = new SeriesPoint(x[i], y[i]);
                series.Points.Add(p1);
            }

            //areaSeriesView.Color = c;
            pointSeriesView.Color = Color.FromArgb(30, c);
            pointSeriesView.PointMarkerOptions.BorderVisible      = false;
            pointSeriesView.PointMarkerOptions.FillStyle.FillMode = FillMode.Solid;
            pointSeriesView.PointMarkerOptions.Size = 4;
            //pointSeriesView.Transparency = 200;
            series.View = pointSeriesView;
            return(series);
        }
Exemplo n.º 13
0
        private Series CreateMSDSeries(double mean, double sd, double maxy, Color c, bool reflect)
        {
            Series          series          = new Series();
            PointSeriesView pointSeriesView = new PointSeriesView();
            SeriesPoint     p1 = new SeriesPoint(mean, maxy);
            SeriesPoint     p2 = new SeriesPoint(mean - sd, maxy);
            SeriesPoint     p3 = new SeriesPoint(mean + sd, maxy);

            series.Points.Add(p1);
            series.Points.Add(p2);
            series.Points.Add(p3);

            //areaSeriesView.Color = c;
            pointSeriesView.Color = Color.FromArgb(100, c);
            pointSeriesView.PointMarkerOptions.BorderVisible      = false;
            pointSeriesView.PointMarkerOptions.FillStyle.FillMode = FillMode.Solid;
            pointSeriesView.PointMarkerOptions.Size = 10;
            pointSeriesView.PointMarkerOptions.Kind = MarkerKind.Diamond;
            //pointSeriesView.Transparency = 200;
            series.View = pointSeriesView;
            return(series);
        }
Exemplo n.º 14
0
        private void MakePointChart()
        {
            series1.ArgumentScaleType = ScaleType.Numerical;

            for (int x = 1; x < 100; x++)
            {
                series1.Points.Add(new SeriesPoint(x, 10 + r2.Next(-1, 1)));
            }
            chartControl2.Series.Add(series1);

            PointSeriesView myView1 = (PointSeriesView)series1.View;

            myView1.PointMarkerOptions.Kind           = MarkerKind.Circle;
            myView1.PointMarkerOptions.StarPointCount = 20;
            myView1.PointMarkerOptions.Size           = 3;

            ((XYDiagram)chartControl2.Diagram).EnableAxisXZooming = true;

            chartControl2.Legend.Visible = false;

            chartControl2.Titles.Add(new ChartTitle());
            chartControl2.Titles[0].Text = "";
        }
Exemplo n.º 15
0
        private void MakePointChart()
        {
            // https://documentation.devexpress.com/WindowsForms/2975/Controls-and-Libraries/Chart-Control/Fundamentals/Series-Views/2D-Series-Views/Point-and-Line-Series-Views/Point-Chart
            // Create a point series.

            // Set the numerical argument scale type for the series,
            // as it is qualitative, by default.
            series1.ArgumentScaleType = ScaleType.Numerical;

            // Add points to it.

            for (int x = 1; x < 25; x++)
            {
                series1.Points.Add(new SeriesPoint(x, 10 + r2.Next(-1, 1)));
            }

            // Add the series to the chart.
            chartControl4.Series.Add(series1);

            // Access the view-type-specific options of the series.
            PointSeriesView myView1 = (PointSeriesView)series1.View;

            myView1.PointMarkerOptions.Kind           = MarkerKind.Circle;
            myView1.PointMarkerOptions.StarPointCount = 20;
            myView1.PointMarkerOptions.Size           = 3;

            // Access the type-specific options of the diagram.
            ((XYDiagram)chartControl4.Diagram).EnableAxisXZooming = true;

            // Hide the legend (if necessary).
            chartControl4.Legend.Visible = false;

            // Add a title to the chart (if necessary).
            chartControl4.Titles.Add(new ChartTitle());
            chartControl4.Titles[0].Text = "";
        }
        private void PopularDadosGrafico()
        {
            ViewType[] ignorarOsTipos = new ViewType[]
            {
                ViewType.PolarArea,
                ViewType.PolarLine,
                ViewType.PolarPoint,
                //ViewType.SideBySideGantt,
                ViewType.SideBySideRangeBar,
                ViewType.RangeBar,
                //ViewType.Gantt,
                ViewType.Stock,
                ViewType.SwiftPlot,
                ViewType.CandleStick,
                //ViewType.SideBySideFullStackedBar,
                //ViewType.SideBySideFullStackedBar3D,
                //ViewType.SideBySideStackedBar,
                //ViewType.SideBySideStackedBar3D
            };

            #region Layout

            Enum.GetValues(typeof(ViewType))
            .OfType <ViewType>()
            .Where(w => !ignorarOsTipos.Contains(w))
            .ToList()
            .ForEach(f =>
            {
                BarCheckItem barCheckItem = new BarCheckItem();
                barCheckItem.Caption      = f.ToString();
                barCheckItem.Tag          = f;

                barCheckItem.ItemClick += delegate(object senderItemClick, ItemClickEventArgs eItemClick)
                {
                    if ((eItemClick.Item as BarCheckItem).Checked)
                    {
                        // Procura e desmarca o item selecionado
                        this.brMngrCustomGrid.Items
                        .OfType <BarCheckItem>()
                        .Where(w => w.Tag != null && w.Tag is ViewType && eItemClick.Item != w && w.Checked)
                        .Update(u => u.Checked = false);

                        this.chtCtrlVisualizacoes.SeriesTemplate.ChangeView((ViewType)eItemClick.Item.Tag);

                        this.chtCtrlVisualizacoes.Legend.Visible = this.brChckItmLegenda.Checked;
                        this.pvtGrdVisualizacoes.OptionsChartDataSource.ProvideDataByColumns     = this.brChckItmAlterarLinhasPorColunas.Checked;
                        this.pvtGrdVisualizacoes.OptionsChartDataSource.SelectionOnly            = this.brChckItmSomenteOSelecionado.Checked;
                        this.pvtGrdVisualizacoes.OptionsChartDataSource.ProvideColumnGrandTotals = this.brChckItmMostrarTotalColuna.Checked;
                        this.pvtGrdVisualizacoes.OptionsChartDataSource.ProvideRowGrandTotals    = this.brChckItmMostrarTotalLinha.Checked;
                        this.chtCtrlVisualizacoes.Legend.Visible = this.brChckItmLegenda.Checked;
                        if (this.chtCtrlVisualizacoes.SeriesTemplate.Label != null)
                        {
                            this.chtCtrlVisualizacoes.SeriesTemplate.Label.Visible = this.brChckItmValor.Checked;
                        }

                        if (this.Diagram3D != null)
                        {
                            this.Diagram3D.RuntimeRotation  = true;
                            this.Diagram3D.RuntimeZooming   = true;
                            this.Diagram3D.RuntimeScrolling = true;
                        }
                        else
                        if (this.XyDiagram != null)
                        {
                            this.XyDiagram.AxisX.Visible                  = this.brChckItmEixoX.Checked;
                            this.XyDiagram.AxisX.Title.Visible            = true;
                            this.XyDiagram.AxisX.Range.MaxValue           = 20;
                            this.XyDiagram.AxisX.Range.Auto               = true;
                            this.XyDiagram.AxisX.Range.SideMarginsEnabled = true;

                            this.XyDiagram.AxisY.Visible                  = this.brChckItmEixoY.Checked;
                            this.XyDiagram.AxisY.Title.Visible            = true;
                            this.XyDiagram.AxisY.Range.MaxValue           = 20;
                            this.XyDiagram.AxisY.Range.Auto               = true;
                            this.XyDiagram.AxisY.Range.SideMarginsEnabled = true;

                            this.XyDiagram.Rotated = this.brChckItmVirar.Checked;
                            this.XyDiagram.DefaultPane.EnableAxisXScrolling = DevExpress.Utils.DefaultBoolean.True;
                        }


                        this.chtCtrlVisualizacoes.Series
                        .OfType <Series>()
                        .ToList()
                        .ForEach(f1 =>
                        {
                            ISupportTransparency supportTransparency = f1.View as ISupportTransparency;
                            if (supportTransparency != null &&
                                (f1.View is AreaSeriesView ||
                                 f1.View is Area3DSeriesView ||
                                 f1.View is RadarAreaSeriesView ||
                                 f1.View is Bar3DSeriesView))
                            {
                                supportTransparency.Transparency = 135;
                            }
                        });

                        Series series = this.chtCtrlVisualizacoes.Series
                                        .OfType <Series>()
                                        .FirstOrDefault();

                        if (series != null && series.View != null)
                        {
                            this.brSbItmTipo.Enabled = series.View is PointSeriesView;
                            this.brMngrCustomGrid.Items
                            .OfType <BarCheckItem>()
                            .Where(w => w.Checked)
                            .FirstOrDefault()
                            .PerformClick();
                        }
                    }
                    else
                    {
                        (eItemClick.Item as BarCheckItem).Checked = true;
                    }
                };

                if (f.ToString().ToUpper().IndexOf("RADAR") != -1)
                {
                    this.brSbItmRadar.AddItem(barCheckItem);
                }
                else
                if (f.ToString().ToUpper().IndexOf("BAR") != -1)
                {
                    this.brSbItmBarra.AddItem(barCheckItem);
                }
                else
                if (f.ToString().ToUpper().IndexOf("LINE") != -1)
                {
                    this.brSbItmLinha.AddItem(barCheckItem);
                }
                else
                if (f.ToString().ToUpper().IndexOf("AREA") != -1)
                {
                    this.brSbItmArea.AddItem(barCheckItem);
                }
                else
                if (f.ToString().ToUpper().IndexOf("PIE") != -1 || f.ToString().ToUpper().IndexOf("DOUGHNUT") != -1)
                {
                    this.brSbItmPizza.AddItem(barCheckItem);
                }
                else
                {
                    this.brSbItmOutros.AddItem(barCheckItem);
                }
            });

            #endregion

            #region Tipo

            Enum.GetValues(typeof(MarkerKind))
            .OfType <MarkerKind>()
            .ToList()
            .ForEach(u =>
            {
                BarCheckItem barCheckItem = new BarCheckItem();
                barCheckItem.Caption      = u.ToString();
                barCheckItem.Tag          = u;

                barCheckItem.ItemClick += delegate(object senderItemClick, ItemClickEventArgs eItemClick)
                {
                    if ((eItemClick.Item as BarCheckItem).Checked)
                    {
                        // Procura e desmarca o item selecionado
                        this.brSbItmTipo.LinksPersistInfo
                        .OfType <LinkPersistInfo>()
                        .Where(w => eItemClick.Item != w.Item && (w.Item as BarCheckItem).Checked)
                        .Update(u1 => (u1.Item as BarCheckItem).Checked = false);

                        // Altera o Kind de todas series
                        MarkerKind markerKind = (MarkerKind)eItemClick.Item.Tag;
                        this.chtCtrlVisualizacoes.Series
                        .OfType <Series>()
                        .ToList()
                        .ForEach(f1 =>
                        {
                            PointSeriesView pointSeriesView = f1.View as PointSeriesView;
                            if (pointSeriesView != null)
                            {
                                pointSeriesView.PointMarkerOptions.Kind          = markerKind;
                                pointSeriesView.PointMarkerOptions.BorderVisible = false;
                            }
                        });
                    }
                    else
                    {
                        (eItemClick.Item as BarCheckItem).Checked = true;
                    }
                };
                this.brSbItmTipo.AddItem(barCheckItem);
            });

            #endregion

            this.chtCtrlVisualizacoes.DataSource = this.pvtGrdVisualizacoes;
            this.chtCtrlVisualizacoes.RefreshData();

            this.brMngrCustomGrid.Items
            .OfType <BarCheckItem>()
            .Where(w => w.Tag != null && w.Tag.Equals(ViewType.Line))
            .FirstOrDefault()
            .PerformClick();

            this.brMngrCustomGrid.Items
            .OfType <BarCheckItem>()
            .Where(w => w.Tag != null && w.Tag.Equals(MarkerKind.Circle))
            .FirstOrDefault()
            .PerformClick();
        }
Exemplo n.º 17
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ChartControl pointChart     = new ChartControl();
            int          contadorClasse = 0;
            var          classes        = _ibl.Classes();

            var serieClass = new Series("Fronteira", ViewType.Point);

            serieClass.CheckableInLegend = false;
            serieClass.ShowInLegend      = false;
            serieClass.ArgumentScaleType = ScaleType.Auto;

            var incrementoX = Incremento(_ibl._dataset.MaiorX - _ibl._dataset.MenorX);
            var incrementoY = Incremento(_ibl._dataset.MaiorY - _ibl._dataset.MenorY);

            for (var i = _ibl._dataset.MenorX - (incrementoX * 10); i < _ibl._dataset.MaiorX + (incrementoX * 10); i = i + incrementoX)
            {
                for (var j = _ibl._dataset.MenorY - (incrementoY * 10); j < _ibl._dataset.MaiorY + (incrementoY * 10); j = j + incrementoY)
                {
                    var item = new Item
                    {
                        X = new Atributo {
                            Valor = i
                        },
                        Y = new Atributo {
                            Valor = j
                        },
                    };

                    var novo = _ibl.Classificar(item);

                    var ponto = new SeriesPoint(item.X.Valor, item.Y.Valor);
                    ponto.Color = CoresLigth(Array.IndexOf(classes, novo.ItemOriginal.Classe));
                    serieClass.Points.Add(ponto);
                }
            }

            pointChart.Series.Add(serieClass);

            PointSeriesView viewClass = (PointSeriesView)serieClass.View;

            viewClass.PointMarkerOptions.Kind           = MarkerKind.Square;
            viewClass.PointMarkerOptions.StarPointCount = 5;
            viewClass.PointMarkerOptions.Size           = 20;

            //EXISTENTES
            foreach (var classe in classes)
            {
                var serie = new Series(classe, ViewType.Point);
                serie.ArgumentScaleType = ScaleType.Auto;
                foreach (var item in _ibl._dataset.Itens.Where(x => x.ItemOriginal.Classe == classe))
                {
                    var ponto = new SeriesPoint(item.ItemOriginal.X.Valor, item.ItemOriginal.Y.Valor);
                    ponto.Color = Cores(contadorClasse);
                    serie.Points.Add(ponto);
                }
                pointChart.Series.Add(serie);

                PointSeriesView myView1 = (PointSeriesView)serie.View;
                myView1.PointMarkerOptions.Kind           = (MarkerKind)contadorClasse;
                myView1.PointMarkerOptions.StarPointCount = 5;
                myView1.PointMarkerOptions.Size           = 5;

                contadorClasse++;
            }

            pointChart.Titles.Add(new ChartTitle());
            pointChart.Titles[0].Text = "IBL 1";

            pointChart.Dock = DockStyle.Fill;
            this.Controls.Add(pointChart);
        }
Exemplo n.º 18
0
        private void InitSpline2Inner(string enumValue, string titleName, DataTable dt, Color color)
        {
            Series series = new Series(titleName, (ViewType)Enum.Parse(typeof(ViewType), enumValue));

            DevExpress.XtraCharts.PointSeriesLabel         pointSeriesLabel1      = new DevExpress.XtraCharts.PointSeriesLabel();
            DevExpress.XtraCharts.PieSeriesLabel           pieSeriesLabel1        = new DevExpress.XtraCharts.PieSeriesLabel();
            DevExpress.XtraCharts.SideBySideBarSeriesLabel sideBySizeSeriesLabel1 = new SideBySideBarSeriesLabel();

            //************************************************************BeginInit()********************************************************
            ((System.ComponentModel.ISupportInitialize)(chartControl1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(series)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(pointSeriesLabel1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(pieSeriesLabel1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(sideBySizeSeriesLabel1)).BeginInit();

            series.ArgumentScaleType = ScaleType.Qualitative;

            DevExpress.XtraCharts.PiePointOptions piePointOptions1 = new DevExpress.XtraCharts.PiePointOptions();
            piePointOptions1.PointView = DevExpress.XtraCharts.PointView.ArgumentAndValues;
            series.PointOptions        = piePointOptions1;

            series.LegendText = m_ColumnName;
            series.View.Color = color;
            foreach (DataRow dataRow in dt.Rows)
            {
                string name = dataRow[m_X_NameID + "#" + m_X_Name].ToString();
                if (name == "总计")
                {
                    continue;
                }
                string      value = dataRow[m_ColumnID + "#" + m_ColumnName].ToString();
                SeriesPoint sp    = new SeriesPoint(name, value);
                series.Points.Add(sp);
            }
            chartControl1.Series.Add(series);

            PointSeriesView pointView = series.View as PointSeriesView;

            if (pointView != null)
            {
                pointView.PointMarkerOptions.Kind = MarkerKind.Circle;
            }

            //针对饼图的处理
            if (series.View is PieSeriesView)
            {
                this.chartControl1.RuntimeSelection           = false;
                ((PieSeriesView)series.View).RuntimeExploding = true;
            }
            else
            {
                this.chartControl1.RuntimeSelection = true;
            }

            ChartTitle ct1 = new ChartTitle();

            ct1.Text = titleName;
            chartControl1.Titles.Clear();
            chartControl1.Titles.Add(ct1);

            if (series.Label is PointSeriesLabel)
            {
                pointSeriesLabel1.LineLength   = 15;
                pointSeriesLabel1.LineVisible  = true;
                pointSeriesLabel1.Antialiasing = true;
                pointSeriesLabel1.Angle        = 30;
                pointSeriesLabel1.ResolveOverlappingMinIndent = 10;
                pointSeriesLabel1.ResolveOverlappingMode      = DevExpress.XtraCharts.ResolveOverlappingMode.JustifyAllAroundPoint;
                series.Label = pointSeriesLabel1;
            }
            else if (series.Label is PieSeriesLabel)
            {
                pieSeriesLabel1.LineLength   = 15;
                pieSeriesLabel1.LineVisible  = true;
                pieSeriesLabel1.Antialiasing = true;
                pieSeriesLabel1.ResolveOverlappingMinIndent = 10;
                pieSeriesLabel1.ResolveOverlappingMode      = DevExpress.XtraCharts.ResolveOverlappingMode.JustifyAllAroundPoint;
                series.Label = pieSeriesLabel1;
            }
            else if (series.Label is SideBySideBarSeriesLabel)
            {
                sideBySizeSeriesLabel1.LineLength   = 15;
                sideBySizeSeriesLabel1.LineVisible  = true;
                sideBySizeSeriesLabel1.Antialiasing = true;
                sideBySizeSeriesLabel1.Position     = BarSeriesLabelPosition.Top;
                sideBySizeSeriesLabel1.ResolveOverlappingMinIndent = 10;
                sideBySizeSeriesLabel1.ResolveOverlappingMode      = DevExpress.XtraCharts.ResolveOverlappingMode.JustifyAllAroundPoint;
                series.Label = sideBySizeSeriesLabel1;
            }
            ((System.ComponentModel.ISupportInitialize)(pieSeriesLabel1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(pointSeriesLabel1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(series)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(chartControl1)).EndInit();
            //************************************************************EndInit()********************************************************
        }
Exemplo n.º 19
0
        public void CreateLineplot(DataTable mydt)
        {
            _coloroverride = -1;
            string seriesby = _settings.seriesby;
            string colorsby = _settings.colorvar;
            Color  myseriescolor;

            DataTable dataxy_all = DataTableExtensions.Data_SelectColumnXY(mydt, _settings.xaxisvar, _settings.yaxisvar, seriesby, colorsby);


            List <string> series_levels = dataxy_all.AsEnumerable().Select(x => x.Field <string>("seriesby")).Distinct().ToList();
            List <string> colors_levels = dataxy_all.AsEnumerable().Select(x => x.Field <string>("colorsby")).Distinct().ToList();

            colors_levels.Sort();

            _colorLevels = colors_levels;             //use this to create a manual legend later if needed


            List <string> seriesIDs = new List <string>();

            if (seriesby == "id")
            {
                seriesIDs = dataxy_all.AsEnumerable().Select(x => x.Field <string>("id")).Distinct().ToList();
            }
            else
            {
                seriesIDs = dataxy_all.AsEnumerable().Select(x => x.Field <string>("seriesby")).Distinct().ToList();
            }


            int _nall = dataxy_all.Rows.Count;

            if (_nall > 0)
            {
                List <Series> list_o_series = new List <Series>();

                //foreach (string s in seriesIDs)
                for (int s = 0; s < seriesIDs.Count; s++)
                {
                    for (int s_color = 0; s_color < colors_levels.Count; s_color++)
                    {
                        dataxy_all.DefaultView.Sort             = "seriesby ASC, colorsby ASC, x ASC";
                        dataxy_all.DefaultView.ApplyDefaultSort = true;
                        DataView vw = dataxy_all.AsDataView();

                        string rowfilter = (seriesby == "id") ?
                                           String.Format("{0}='{1}' and colorsby='{2}'", seriesby, seriesIDs[s], colors_levels[s_color]) :
                                           String.Format("{0}='{1}' and colorsby='{2}'", "seriesby", seriesIDs[s], colors_levels[s_color]);

                        //string rowfilter = (seriesby == "id") ?
                        //			String.Format("{0}='{1}'", seriesby, seriesIDs[s]) :
                        //			String.Format("{0}='{1}'", "seriesby", seriesIDs[s]);

                        vw.RowFilter = rowfilter;
                        //vw.Sort = String.Format("{0} {1}", "x", "ASC");  //sort by the x variable
                        //vw.ApplyDefaultSort = true;

                        DataTable dataxy = vw.ToTable();

                        dataxy.DefaultView.Sort             = "x ASC";
                        dataxy.DefaultView.ApplyDefaultSort = true;

                        n = dataxy.Rows.Count;

                        if (n > 0)
                        {
                            string        current_colorlevel = dataxy.AsEnumerable().Select(f => f.Field <string>("colorsby")).Min().ToString();
                            List <string> series_colors      = dataxy.AsEnumerable().Select(f => f.Field <string>("colorsby")).ToList();


                            //Switch to alternate geom if needed
                            if (_settings.vars_for_altgeom.Contains(current_colorlevel))
                            {
                                _settings.activegeom = _settings.altgeom;
                            }
                            else
                            {
                                _settings.activegeom = _settings.geom;
                            }


                            int colorindex = 0;

                            //Get the correct color
                            if (colorsby != "none")
                            {
                                for (int c = 0; c < colors_levels.Count; c++)
                                {
                                    if (current_colorlevel == colors_levels[c])
                                    {
                                        colorindex = c;
                                    }
                                }
                            }
                            myseriescolor = _settings.color(colorindex % 15);

                            if (_coloroverride >= 0)
                            {
                                myseriescolor = _settings.color(_coloroverride % 15);
                            }


                            SeriesPoint[] seriesPoints = CreateSeriesPoints(dataxy, colorsby, colors_levels, series_colors, colorindex, myseriescolor);
                            //TOFIX SeriesPoint[] seriesPoints = new DxSeriesPoints(dataxy, "x", "y", colorsby, colors_levels, series_colors, colorindex, myseriescolor);


                            Series series = new Series();

                            SideBySideBarSeriesView barSeriesView   = new SideBySideBarSeriesView();
                            LineSeriesView          lineSeriesView  = new LineSeriesView();
                            PointSeriesView         pointSeriesView = new PointSeriesView();

                            if (_settings.activegeom == LineplotGeom.Bar)
                            {
                                //barSeriesView = new SideBySideBarSeriesView() ;
                            }
                            else if (_settings.activegeom == LineplotGeom.Line)
                            {
                                //lineSeriesView = new LineSeriesView();
                                lineSeriesView.LineMarkerOptions.FillStyle.FillMode = FillMode.Solid;
                                lineSeriesView.LineMarkerOptions.Kind = _markers[s % _markers.Count];
                            }
                            else
                            {
                                pointSeriesView.PointMarkerOptions.FillStyle.FillMode = FillMode.Solid;
                                MarkerKind mymarker = new MarkerKind();

                                if (_settings.activegeom == LineplotGeom.Circle)
                                {
                                    mymarker = MarkerKind.Circle;
                                }
                                if (_settings.activegeom == LineplotGeom.Square)
                                {
                                    mymarker = MarkerKind.Square;
                                }
                                if (_settings.activegeom == LineplotGeom.Cross)
                                {
                                    mymarker = MarkerKind.Cross;
                                }
                                if (_settings.activegeom == LineplotGeom.Star)
                                {
                                    mymarker = MarkerKind.Star;
                                }

                                pointSeriesView.PointMarkerOptions.Kind = mymarker;
                                pointSeriesView.PointMarkerOptions.Size = _settings.markersize;

                                if (_settings.activegeom == LineplotGeom.Star)
                                {
                                    pointSeriesView.PointMarkerOptions.StarPointCount = 6;
                                }
                            }



                            if (_settings.xaxis_is_date)
                            {
                                this.xydiagram.AxisX.DateTimeScaleOptions.ScaleMode   = ScaleMode.Continuous;
                                this.xydiagram.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Month;
                                this.xydiagram.AxisX.Label.TextPattern = "{A:dd-MMM-yy}";
                                series.ToolTipPointPattern             = "x={A:dd-MMM-yy} y={V:F2} {HINT}";
                            }
                            else
                            {
                                series.ToolTipPointPattern = "x={A:F2} y={V:F2} {HINT}";
                            }


                            ToolTipRelativePosition pos = new ToolTipRelativePosition();
                            pos.OffsetX = -10;
                            pos.OffsetY = -10;
                            chart.ToolTipOptions.ToolTipPosition = pos;

                            if (_settings.activegeom == LineplotGeom.Bar)
                            {
                                series.View = barSeriesView;
                            }
                            else if (_settings.activegeom == LineplotGeom.Line)
                            {
                                series.View = lineSeriesView;
                            }
                            else
                            {
                                series.View = pointSeriesView;
                            }

                            series.Points.AddRange(seriesPoints);

                            list_o_series.Add(series);
                        }
                    }
                }

                //Add the series to the chart
                int max_pts = list_o_series.Select(s => s.Points.Count).Max();

                foreach (Series s in list_o_series)
                {
                    //first add those with the max number of points
                    if (s.Points.Count == max_pts)
                    {
                        chart.Series.Add(s);
                    }
                }
                foreach (Series s in list_o_series)
                {
                    //then add those with fewer points
                    if (s.Points.Count != max_pts)
                    {
                        chart.Series.Add(s);
                    }
                }


                // consider adding N=??, intrcpt=, slope=
                string mytitle       = "";
                string mainTitleText = String.Format("{0}", mytitle);                 //, seriesPoints.Count());

                chart.Width  = _settings.W;
                chart.Height = _settings.H;

                this.AddTitles(mainTitleText, "", _settings.xaxisvar, _settings.yaxisvar);

                chart.BorderOptions.Color = Color.White;

                chart.CustomDrawSeriesPoint += Lineplot_TransparentPoint;
                chart.CustomDrawSeries      += Lineplot_TransparentLine;

                //chart.CustomCallback += _dxcharts.Mychart_CustomCallback;

                chart.ToolTipEnabled = DevExpress.Utils.DefaultBoolean.True;
                chart.ToolTipOptions.ShowForSeries = true;

                chart.CrosshairEnabled = DevExpress.Utils.DefaultBoolean.False;

                if (colorsby != "none")
                {
                    for (int lev = 0; lev < colors_levels.Count; lev++)
                    {
                        // Create a new custom item.
                        CustomLegendItem item = new CustomLegendItem();
                        chart.Legend.CustomItems.Add(item);
                        // Specify its text and marker.
                        item.Text = colors_levels[lev];
                        int coloridx = (_coloroverride >= 0) ? _coloroverride : lev;
                        item.MarkerColor = _settings.colors[coloridx % _settings.colors.Count];
                        //item.
                    }
                }



                chart.Legend.Visibility = (_settings.showLegend) ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False;

                LegendAlignmentHorizontal legend_h = new LegendAlignmentHorizontal();
                LegendAlignmentVertical   legend_v = new LegendAlignmentVertical();

                if (_settings.legend_pos_h == "Right")
                {
                    legend_h = LegendAlignmentHorizontal.Right;
                }
                else if (_settings.legend_pos_h == "RightOutside")
                {
                    legend_h = LegendAlignmentHorizontal.RightOutside;
                }
                else if (_settings.legend_pos_h == "Left")
                {
                    legend_h = LegendAlignmentHorizontal.Left;
                }
                else if (_settings.legend_pos_h == "LeftOutside")
                {
                    legend_h = LegendAlignmentHorizontal.LeftOutside;
                }
                else if (_settings.legend_pos_h == "Center")
                {
                    legend_h = LegendAlignmentHorizontal.Center;
                }

                if (_settings.legend_pos_v == "Top")
                {
                    legend_v = LegendAlignmentVertical.Top;
                }
                else if (_settings.legend_pos_v == "TopOutside")
                {
                    legend_v = LegendAlignmentVertical.TopOutside;
                }
                else if (_settings.legend_pos_v == "Bottom")
                {
                    legend_v = LegendAlignmentVertical.Bottom;
                }
                else if (_settings.legend_pos_v == "BottomOutside")
                {
                    legend_v = LegendAlignmentVertical.BottomOutside;
                }
                else if (_settings.legend_pos_v == "Center")
                {
                    legend_v = LegendAlignmentVertical.Center;
                }



                chart.Legend.AlignmentHorizontal = legend_h;
                chart.Legend.AlignmentVertical   = legend_v;

                // Set a value indicating that both autogenerated and custom items are displayed.
                chart.Legend.ItemVisibilityMode = LegendItemVisibilityMode.AutoGeneratedAndCustom;
            }
            else
            {
                //_emptymsg = String.Format("0 cases for{3}{0}{3}{1} by {2}", mytitle, xvar, yvar, Environment.NewLine);
                //return null;
            }
        }
Exemplo n.º 20
0
 private static void initializeSeriesView(PointSeriesView view)
 {
     view.PointMarkerOptions.Kind = MarkerKind.Circle;
     view.PointMarkerOptions.Size = 10;
 }
        private void ConfigureIndicatorCharts(ChartSettings chartSettings)
        {
            var indicatorSeriesSettingsSet = new List <IndicatorSeriesColorSettings>();
            var indicatorAddtionalPanels   = IndicatorPanelSettings.GetAdditionalPanelsSettings(chartSettings.Period);

            //Build Series
            var viewSettingsByIndicatorType = IndicatorSeriesViewSettings.GetIndicatorSeriesViewSettings(chartSettings)
                                              .GroupBy(viewSettings => new { viewSettings.IndicatorType, viewSettings.CandlePeriod });

            foreach (var seriesViewSettings in viewSettingsByIndicatorType)
            {
                var indicatorSerieses = new List <Series>();
                var seriesViews       = new List <SeriesViewColorEachSupportBase>();

                foreach (var viewSettings in seriesViewSettings)
                {
                    SeriesViewColorEachSupportBase seriesView;

                    switch (viewSettings.ViewType)
                    {
                    case ViewType.Line:
                        seriesView = new LineSeriesView();
                        break;

                    case ViewType.Bar:
                        seriesView = new StackedBarSeriesView();
                        break;

                    case ViewType.Point:
                        seriesView = new PointSeriesView();
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(viewSettings.ViewType));
                    }

                    var seriesSettings = new IndicatorSeriesColorSettings
                    {
                        IndicatorType = seriesViewSettings.Key.IndicatorType,
                        CandlePeriod  = seriesViewSettings.Key.CandlePeriod,
                    };
                    var availableColors = IndicatorSeriesColorSettings.AvailableSeriesColors
                                          .Where(color => indicatorSeriesSettingsSet
                                                 .Where(s => s.IndicatorType == seriesViewSettings.Key.IndicatorType && s.CandlePeriod == seriesViewSettings.Key.CandlePeriod)
                                                 .All(s => s.SeriesColor != color))
                                          .ToList();
                    seriesSettings.SeriesColor = availableColors.Any() ? availableColors.First() : IndicatorSeriesColorSettings.LastDefaultColor;
                    indicatorSeriesSettingsSet.Add(seriesSettings);

                    seriesView.Color = seriesSettings.SeriesColor;
                    seriesViews.Add(seriesView);

                    var indicatorSeries = new Series(viewSettings.IndicatorValue, viewSettings.ViewType);
                    indicatorSeries.ArgumentScaleType  = ScaleType.DateTime;
                    indicatorSeries.LabelsVisibility   = DevExpress.Utils.DefaultBoolean.False;
                    indicatorSeries.ArgumentDataMember = "Moment";
                    indicatorSeries.ValueDataMembers.AddRange(viewSettings.IndicatorValue);
                    indicatorSeries.View = seriesView;
                    indicatorSerieses.Add(indicatorSeries);
                }

                var panelSettings =
                    indicatorAddtionalPanels.FirstOrDefault(s =>
                                                            s.AssignedIndicators.Any(tuple => tuple.Item1 == seriesViewSettings.Key.IndicatorType && tuple.Item2 == seriesViewSettings.Key.CandlePeriod));
                if (panelSettings != null)
                {
                    if (panelSettings.Panel == null || panelSettings.AxisY == null)
                    {
                        var pane = new XYDiagramPane();
                        ((XYDiagram)chartControl.Diagram).Panes.Add(pane);
                        panelSettings.Panel = pane;

                        var axisY = new SecondaryAxisY();
                        ((XYDiagram)chartControl.Diagram).SecondaryAxesY.Add(axisY);
                        panelSettings.AxisY = axisY;
                    }
                    foreach (var seriesView in seriesViews)
                    {
                        seriesView.Pane  = panelSettings.Panel;
                        seriesView.AxisY = panelSettings.AxisY;
                    }
                }
                else
                {
                    foreach (var seriesView in seriesViews)
                    {
                        seriesView.Pane  = ((XYDiagram)chartControl.Diagram).DefaultPane;
                        seriesView.AxisY = ((XYDiagram)chartControl.Diagram).AxisY;
                    }
                }

                chartControl.Series.AddRange(indicatorSerieses.ToArray());
            }
        }
        private void Form2_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            //设置行号列宽度
            this.gridView1.IndicatorWidth = 40;
            DataTable datatable = DataBusiness.sql_PY.Get();

            gridControl1.DataSource = datatable;
            // this.gridView1.Columns["Well_Num"].Visible = false;
            refresh();
            #region 绘图

            //新建线
            Series series1 = new Series("压力", ViewType.Point);
            Series series2 = new Series("产量", ViewType.Line);

            #region 设置series的样式
            //设置series的样式
            PointSeriesView view1 = (PointSeriesView)series1.View;
            view1.Color = Color.Red;           //颜色
            view1.PointMarkerOptions.Size = 3; //大小
            // view1.PointMarkerOptions.Kind = Kind.Plus;//样式

            LineSeriesView view2 = (LineSeriesView)series2.View;
            view2.Color = Color.Green;
            #endregion

            #region 描点
            //描点
            for (int i = 0; i < datatable.Rows.Count; i++)
            {
                series1.Points.Add(new SeriesPoint(datatable.Rows[i][0], datatable.Rows[i][1]));
            }
            this.chartControl1.Series.Add(series1);

            for (int i = 0; i < datatable.Rows.Count; i++)
            {
                series2.Points.Add(new SeriesPoint(datatable.Rows[i][0], datatable.Rows[i][2]));
            }
            this.chartControl1.Series.Add(series2);
            #endregion

            XYDiagram diagram = chartControl1.Diagram as XYDiagram;

            //设置X滚动轴
            ((XYDiagram)this.chartControl1.Diagram).EnableAxisXZooming   = true;
            ((XYDiagram)this.chartControl1.Diagram).EnableAxisXScrolling = true;

            //新建pane
            XYDiagramPane Pane1 = new XYDiagramPane("per");
            diagram.Panes.Add(Pane1);


            diagram.AxisY.Alignment = AxisAlignment.Far;

            //翻转pane,即纵坐标为深度
            //  diagram.Rotated = true;
            //将两个pane横着排列
            // diagram.PaneLayoutDirection = PaneLayoutDirection.Horizontal;

            //将seeies放在Pane1里
            view2.Pane = Pane1;

            #region Pane1的坐标轴
            //设置Pane1的坐标轴,只设置Y轴
            diagram.SecondaryAxesY.Add(new SecondaryAxisY("PaneY"));
            diagram.SecondaryAxesY[0].Alignment         = AxisAlignment.Near;
            diagram.SecondaryAxesY[0].GridLines.Visible = true;

            diagram.SecondaryAxesY[0].Title.Visible   = true;
            diagram.SecondaryAxesY[0].Title.Alignment = StringAlignment.Center;
            diagram.SecondaryAxesY[0].Title.Text      = "产量";



            //这里只用Y轴,让X轴保持一样,才能同步变化
            view2.AxisY = diagram.SecondaryAxesY[0];
            #endregion

            //设置title
            //this.chartControl1.Titles.Add(new ChartTitle());
            //this.chartControl1.Titles[0].Text = "图";

            #region Pane1的坐标轴
            //设置defauPane的坐标轴
            diagram.AxisY.Alignment       = AxisAlignment.Near;
            diagram.AxisY.Title.Visible   = true;
            diagram.AxisY.Title.Alignment = StringAlignment.Center;
            diagram.AxisY.Title.Text      = "压力";

            diagram.AxisX.Title.Visible   = true;
            diagram.AxisX.Title.Alignment = StringAlignment.Center;
            diagram.AxisX.Title.Text      = "时间(小时)";
            #endregion

            #endregion
        }
Exemplo n.º 23
0
        //Given a list of subsets are passed in, these are displayed in a panes
        public void CreateHistogram_withPanes(List <DataSubset> subsets, string mysubtitle, string var)        //, Color mycolor)
        {
            List <HistBinsData> list_o_histdata = new List <HistBinsData>();
            List <string>       subtitle1       = new List <string>();
            string panelvar = "";

            //Create a series for each subset
            for (int i = 0; i < subsets.Count; i++)
            {
                DataSubset   subset   = subsets[i];
                HistBinsData histdata = new HistBinsData(subset.dt, var, _settings.numbins);
                if (histdata.N > 0)
                {
                    if (panelvar == "")
                    {
                        panelvar = subset.Cols_ToString();
                    }
                    list_o_histdata.Add(histdata);
                    subtitle1.Add(subset.Vals_ToString());
                }
            }

            //Panes
            this.AddPanes((list_o_histdata.Count - 1), _settings.panesLayoutDirection);

            List <string> subtitles = new List <string>();

            //Create a series for each subset
            for (int i = 0; i < list_o_histdata.Count; i++)
            {
                HistBinsData histdata = list_o_histdata[i];

                if (histdata.N > 0)
                {
                    Color          mypanelcolor = _settings.color(i);
                    Series         s            = CreateHistogramSeries(histdata.bins, mypanelcolor, false);
                    AreaSeriesView vw           = (AreaSeriesView)s.View;

                    if (i >= 1)
                    {
                        vw.Pane = this.xydiagram.Panes[(i - 1)];                          //Panes collection starts at index 0, but first series goes into default pane
                    }
                    chart.Series.Add(s);

                    //Normal Curve
                    if (_settings.shownormalcurve & histdata.normalX != null)
                    {
                        Series          s_nc  = CreateNormalCurveSeries(histdata.normalX, histdata.normalY, mypanelcolor, false);
                        PointSeriesView vw_nc = (PointSeriesView)s_nc.View;
                        if (i >= 1)
                        {
                            vw_nc.Pane = this.xydiagram.Panes[(i - 1)];
                        }
                        chart.Series.Add(s_nc);
                    }
                    //M SD
                    if (_settings.histMSD)
                    {
                        Series          s_msd  = CreateMSDSeries(histdata.mean, histdata.sd, 0, mypanelcolor, false);
                        PointSeriesView vw_msd = (PointSeriesView)s_msd.View;
                        if (i >= 1)
                        {
                            vw_msd.Pane = this.xydiagram.Panes[(i - 1)];
                        }
                        chart.Series.Add(s_msd);
                    }

                    string newline = Environment.NewLine;

                    string subtitle_text = String.Format("<color={0}><b>{1}</b> N={2} M={3} SD={4}</color>{5}",
                                                         ColorTranslator.ToHtml(mypanelcolor)
                                                         , subtitle1[i]
                                                         , histdata.N, Math.Round(histdata.mean, 2), Math.Round(histdata.sd, 2), newline);


                    subtitles.Add(subtitle_text);
                }
            }

            string subtitles_merged = String.Join(" ", subtitles);

            //this.AddTitles(String.Format("Histogram <b>{0}{1}* by {2} *</b>"
            //	, var
            //	, Environment.NewLine
            //	, panelvar), subtitles_merged, "", "Count");


            string maintitle = String.Format("Histogram <b>{0}{1}* by {2} *</b>"
                                             , var
                                             , Environment.NewLine
                                             , panelvar);

            this.AddTitles(maintitle);

            XYDiagramDefaultPane defpane = xydiagram.DefaultPane;

            defpane.Title.Text       = subtitles[0];
            defpane.Title.Visibility = DefaultBoolean.True;

            for (int p = 0; p < xydiagram.Panes.Count; p++)
            {
                XYDiagramPane pane = xydiagram.Panes[p];
                pane.Title.Text = subtitles[p + 1];
            }

            chart.Width  = _settings.W;
            chart.Height = _settings.H;

            chart.BorderOptions.Color = Color.White;
            chart.Legend.Visibility   = DevExpress.Utils.DefaultBoolean.True;
        }
        protected virtual Series CreateSeries(StrategyDataItemInfo info)
        {
            CheckAddPanel(info);
            Series res = null;

            if (info.ChartType == ChartType.ConstantX || info.ChartType == ChartType.ConstantY)
            {
                CreateConstantLines(info);
                return(null);
            }
            if (info.ChartType == ChartType.CandleStick)
            {
                res = CreateCandleStickSeries(info);
            }
            if (info.ChartType == ChartType.Line || info.ChartType == ChartType.StepLine)
            {
                res = CreateLineSeries(info);
            }
            if (info.ChartType == ChartType.Bar)
            {
                res = CreateBarSeries(info);
            }
            if (info.ChartType == ChartType.Area || info.ChartType == ChartType.StepArea)
            {
                res = CreateAreaSeries(info);
            }
            if (info.ChartType == ChartType.Dot)
            {
                res = CreatePointSeries(info);
            }

            if (res != null)
            {
                if (res.Points != null && res.Points.Count > BigDataCount)
                {
                    Chart.SelectionMode     = ElementSelectionMode.None;
                    Chart.RuntimeHitTesting = false;
                }
                res.DataSourceSorted    = true;
                res.SeriesPointsSorting = SortingMode.None;
            }
            IResizeableArray array = res.DataSource as IResizeableArray;

            if (array != null && array.Count > BigDataCount)  // optimization
            {
                PointSeriesView view2 = res.View as PointSeriesView;
                if (view2 != null)
                {
                    view2.AggregateFunction = SeriesAggregateFunction.None;
                }
            }
            XYDiagramSeriesViewBase view = (XYDiagramSeriesViewBase)res.View;

            if (info.PanelName != "Default")
            {
                view.Pane  = ((XYDiagram)Chart.Diagram).Panes[info.PanelName];
                view.AxisY = ((XYDiagram)Chart.Diagram).SecondaryAxesY[info.AxisYName];
                if (((XYDiagram)Chart.Diagram).SecondaryAxesX[info.AxisXName] != null)
                {
                    view.AxisX = ((XYDiagram)Chart.Diagram).SecondaryAxesX[info.AxisXName];
                }
                res.Legend = Chart.Legends[info.PanelName];
            }
            else
            {
            }

            return(res);
        }
Exemplo n.º 25
0
        public void DrawChart(
            StationLogin stationUser,
            WIPStationProductionStatus workUnit,
            string pwoNo,
            int t47LeafID,
            int t216LeafID,
            int t133LeafID,
            int t20LeafID)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            int    errCode = 0;
            string errText = "";


            #region 获取Xbar-R图数据
            EntitySPCChart data = new EntitySPCChart();
            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                IRAPMESClient.Instance.ufn_GetInfo_SPCChart(
                    stationUser.CommunityID, // 60010,
                    pwoNo,                   // "1C3PK1A7BA50422003",
                    t47LeafID,               // 373564,
                    t216LeafID,              // 2155621,
                    t133LeafID,              //2155684,
                    t20LeafID,               //352942,
                    stationUser.SysLogID,    //101,
                    ref data,
                    out errCode,
                    out errText);
                WriteLog.Instance.Write(
                    string.Format("({0}){1}", errCode, errText),
                    strProcedureName);
                if (errCode != 0)
                {
                    return;
                }
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
            #endregion

            if (data.UCL != 0 || data.LCL != 0)
            {
                chartType = XbarRChartType.Control;
            }

            Font font = new Font("新宋体", 12f);

            #region 填写表头
            picLogo.Image     = data.CompanyLogoImage;
            lblTitle.Text     = data.ChartTitle;
            lblChartCode.Text = data.FormCode;
            edtT1002Name.Text = data.T1002Name;
            edtT1Name.Text    = data.T1Name;
            edtT216Name.Text  = data.T216Name;
            edtT133Code.Text  = data.T133Code;
            edtOperator.Text  =
                string.Format(
                    "{0}[{1}]",
                    data.OperatorCode,
                    data.OperatorName);
            edtT102Name.Text         = data.T102Name;
            edtT102Code.Text         = data.T102Code;
            edtT20Name.Text          = data.T20Name;
            edtEngineeringSpec.Text  = data.EngineeringSpec;
            edtSamplingInterval.Text = data.SamplingInterval;
            edtMeasuredDate.Text     = data.MeasuredDate;
            #endregion

            #region 绘制彩虹图
            chartRainBow.Series.Clear();

            Series pointMeasureData = new Series("测量值", ViewType.Point)
            {
                ArgumentScaleType = ScaleType.Qualitative,
                LabelsVisibility  = DefaultBoolean.True,
            };
            PointSeriesView view = new PointSeriesView();
            view.Color = Color.Blue;
            view.PointMarkerOptions.BorderColor = Color.Blue;
            pointMeasureData.View = view;

            PointSeriesLabel label = pointMeasureData.Label as PointSeriesLabel;
            label.Font      = font;
            label.TextColor = Color.Black;

            double maxValue = 0;
            double minValue = 0;

            List <RainbowChartMeasureData> datas       = data.XMLToRainbowChartDataList();
            List <ConstantLine>            clineAxisXs = new List <ConstantLine>();
            int opType  = -1;
            int ocCount = 0;

            foreach (RainbowChartMeasureData pointData in datas)
            {
                if (maxValue == 0 || maxValue < pointData.Metric01.DoubleValue)
                {
                    maxValue = pointData.Metric01.DoubleValue;
                }
                if (minValue == 0 || minValue > pointData.Metric01.DoubleValue)
                {
                    minValue = pointData.Metric01.DoubleValue;
                }

                SeriesPoint point =
                    new SeriesPoint(
                        string.Format(
                            "{0}\n{1}",
                            pointData.Ordinal,
                            pointData.MeasureTime),
                        pointData.Metric01.DoubleValue);

                pointMeasureData.Points.Add(point);

                if (opType != pointData.OpType)
                {
                    ocCount = 0;
                    opType  = pointData.OpType;

                    if (opType == 4 || opType == 5 || opType == 6)
                    {
                        ConstantLine clineX = new ConstantLine();
                        clineX.ShowInLegend          = false;
                        clineX.AxisValueSerializable = point.Argument;
                        switch (opType)
                        {
                        case 4:
                            clineX.Title.Text = "首检开始";
                            break;

                        case 5:
                            clineX.Title.Text = "过程检开始";
                            break;

                        case 6:
                            clineX.Title.Text = "末检开始";
                            break;
                        }
                        clineX.Title.Alignment = ConstantLineTitleAlignment.Far;
                        clineX.Title.TextColor = Color.Black;
                        clineX.Title.Font      = font;

                        clineAxisXs.Add(clineX);
                    }
                }

                if (pointData.OpType == 5)
                {
                    if (ocCount >= 2)
                    {
                        if (ocCount % 2 == 0)
                        {
                            clineAxisXs.Add(
                                new ConstantLine()
                            {
                                ShowInLegend          = false,
                                AxisValueSerializable = point.Argument,
                            });
                        }
                    }

                    ocCount++;
                }
            }

            chartRainBow.Series.Add(pointMeasureData);

            XYDiagram xyDiagram = chartRainBow.Diagram as XYDiagram;
            if (xyDiagram != null)
            {
                double midValue =
                    (data.LCLData.DoubleValue +
                     data.UCLData.DoubleValue) / 2;
                double splitData =
                    (data.USLData.DoubleValue -
                     data.LSLData.DoubleValue) / 4;
                double ucl = data.USLData.DoubleValue - splitData;
                double lcl = data.LSLData.DoubleValue + splitData;

                xyDiagram.DefaultPane.BackColor = Color.Red;

                xyDiagram.AxisX.Label.Font = font;
                xyDiagram.AxisY.Label.Font = font;
                xyDiagram.AxisX.Title.Font = font;

                xyDiagram.AxisX.Title.Visibility = DefaultBoolean.True;
                xyDiagram.AxisX.Title.Text       = "时间点";

                xyDiagram.AxisY.Strips.Clear();
                xyDiagram.AxisY.ConstantLines.Clear();
                xyDiagram.AxisX.ConstantLines.Clear();

                #region 画中值线
                ConstantLine constantLine = new ConstantLine();
                constantLine.ShowInLegend          = false;
                constantLine.AxisValueSerializable = midValue.ToString();
                constantLine.Color = Color.Black;
                constantLine.LineStyle.Thickness = 3;
                constantLine.Title.Text          = "M";
                constantLine.Title.Font          = font;
                xyDiagram.AxisY.ConstantLines.Add(constantLine);
                #endregion

                constantLine = new ConstantLine();
                constantLine.ShowInLegend          = false;
                constantLine.AxisValueSerializable = data.UCLData.DoubleValue.ToString();// ucl.ToString();
                constantLine.Color = Color.Black;
                constantLine.LineStyle.Thickness = 2;
                constantLine.Title.Text          = "P-C";
                constantLine.Title.Font          = font;
                xyDiagram.AxisY.ConstantLines.Add(constantLine);

                constantLine = new ConstantLine();
                constantLine.ShowInLegend          = false;
                constantLine.AxisValueSerializable = data.LCLData.DoubleValue.ToString();// lcl.ToString();
                constantLine.Color = Color.Black;
                constantLine.LineStyle.Thickness = 2;
                constantLine.Title.Text          = "P-C";
                constantLine.Title.Font          = font;
                xyDiagram.AxisY.ConstantLines.Add(constantLine);

                constantLine = new ConstantLine();
                constantLine.ShowInLegend          = false;
                constantLine.AxisValueSerializable = data.USLData.DoubleValue.ToString();
                constantLine.Color = Color.Black;
                constantLine.LineStyle.Thickness = 2;
                constantLine.Title.Text          = "Tu";
                constantLine.Title.Font          = font;
                xyDiagram.AxisY.ConstantLines.Add(constantLine);

                constantLine = new ConstantLine();
                constantLine.ShowInLegend          = false;
                constantLine.AxisValueSerializable = data.LSLData.DoubleValue.ToString();
                constantLine.Color = Color.Black;
                constantLine.LineStyle.Thickness = 2;
                constantLine.Title.Text          = "Tl";
                constantLine.Title.Font          = font;
                xyDiagram.AxisY.ConstantLines.Add(constantLine);

                foreach (ConstantLine lineX in clineAxisXs)
                {
                    xyDiagram.AxisX.ConstantLines.Add(lineX);
                }

                WholeRange wholeRange = xyDiagram.AxisY.WholeRange;
                wholeRange.AlwaysShowZeroLevel = false;
                wholeRange.Auto = false;
                //if (minValue > data.LSLData.DoubleValue)
                //    wholeRange.MinValue = data.LSLData.DoubleValue;
                //else
                //    wholeRange.MinValue = minValue;
                //if (maxValue < data.USLData.DoubleValue)
                //    wholeRange.MaxValue = data.USLData.DoubleValue;
                //else
                //    wholeRange.MaxValue = maxValue;
                wholeRange.MinValue         = data.LSLData.DoubleValue;
                wholeRange.MaxValue         = data.USLData.DoubleValue;
                wholeRange.SideMarginsValue = splitData;
                wholeRange.AutoSideMargins  = false;

                //VisualRange visualRange = xyDiagram.AxisY.VisualRange;
                //visualRange.Auto = false;
                //visualRange.MinValue = data.LSLData.DoubleValue;
                //visualRange.MaxValue = data.USLData.DoubleValue;
                //visualRange.SideMarginsValue = 1;
                //visualRange.AutoSideMargins = true;

                Strip strip = new Strip();
                strip.Color = Color.Yellow;
                strip.MinLimit.AxisValue = data.LSLData.DoubleValue;
                strip.MaxLimit.AxisValue = data.USLData.DoubleValue;
                strip.ShowInLegend       = false;
                xyDiagram.AxisY.Strips.Add(strip);

                strip       = new Strip();
                strip.Color = Color.Lime;
                strip.MinLimit.AxisValue = data.LCLData.DoubleValue;
                strip.MaxLimit.AxisValue = data.UCLData.DoubleValue;
                strip.ShowInLegend       = false;
                xyDiagram.AxisY.Strips.Add(strip);

                //strip = new Strip();
                //strip.Color = Color.Yellow;
                //strip.MinLimit.AxisValue = data.UCLData.DoubleValue;
                //strip.MaxLimit.AxisValue = data.USLData.DoubleValue;
                //strip.ShowInLegend = false;
                //xyDiagram.AxisY.Strips.Add(strip);
            }

            chartRainBow.Legend.Font = font;
            #endregion

            #region 如果有需要报警的消息,则弹出报警对话框
            switch (data.AnomalyType)
            {
            case 0:
                #region 如果是正常,则根据首检5片及过程检2片之后启动超时报警
                if (datas.Count > 0)
                {
                    bool startCountdown = false;
                    int  lastOpType     = 0;
                    int  numCheckPoint  = 0;
                    for (int i = 0; i < datas.Count; i++)
                    {
                        if (lastOpType != datas[i].OpType)
                        {
                            lastOpType     = datas[i].OpType;
                            numCheckPoint  = 1;
                            startCountdown = false;
                            continue;
                        }
                        else
                        {
                            numCheckPoint++;
                        }

                        if (lastOpType == 4 && numCheckPoint % 5 == 0)
                        {
                            startCountdown = true;
                        }
                        else if (lastOpType == 5 && numCheckPoint % 2 == 0)
                        {
                            startCountdown = true;
                        }
                        else
                        {
                            startCountdown = false;
                        }
                    }

                    IRAPMessageBox.Instance.Hide();

                    if (startCountdown)
                    {
                        timerWarning.Enabled = false;
                        Thread.Sleep(100);
                        timerWarning.Enabled = true;
                    }
                }
                else
                {
                    IRAPMessageBox.Instance.Hide();
                    timerWarning.Enabled = false;
                }
                #endregion
                break;

            case 1:
            case 2:
            case 3:
            case 4:
                IRAPMessageBox.Instance.Hide();
                timerWarning.Enabled = false;

                IRAPMessageBox.Instance.Show(
                    //XtraMessageBox.Show(
                    data.AnomalyDesc,
                    "测量数据异常",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Exclamation);

#if !DEBUG
                #region 重置统计过程
                if (data.C1ID != 0)
                {
                    WriteLog.Instance.WriteBeginSplitter(strProcedureName);
                    try
                    {
                        IRAPMESClient.Instance.usp_WriteLog_SPCReset(
                            stationUser.CommunityID,
                            data.C1ID,
                            373564,
                            stationUser.SysLogID,
                            out errCode,
                            out errText);
                        WriteLog.Instance.Write(
                            string.Format("({0}){1}", errCode, errText),
                            strProcedureName);
                    }
                    finally
                    {
                        WriteLog.Instance.WriteEndSplitter(strProcedureName);
                    }

                    //DrawChart(stationUser, workUnit, pwoNo, t47LeafID, t216LeafID, t133LeafID, t20LeafID);
                }
                #endregion
#endif

                break;
            }
            #endregion
        }
Exemplo n.º 26
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 void InitializeComponent()
 {
     xyDiagram1       = new XYDiagram();
     series11         = new Series();
     pointSeriesView1 = new PointSeriesView();
     chartControl1    = new ChartControl();
     Form1layoutControl1ConvertedLayout = new LayoutControl();
     layoutControlGroup1 = new LayoutControlGroup();
     chartControl1item   = new LayoutControlItem();
     ((ISupportInitialize)(chartControl1)).BeginInit();
     ((ISupportInitialize)xyDiagram1).BeginInit();
     ((ISupportInitialize)(series11)).BeginInit();
     ((ISupportInitialize)pointSeriesView1).BeginInit();
     ((ISupportInitialize)(Form1layoutControl1ConvertedLayout)).BeginInit();
     Form1layoutControl1ConvertedLayout.SuspendLayout();
     ((ISupportInitialize)(layoutControlGroup1)).BeginInit();
     ((ISupportInitialize)(chartControl1item)).BeginInit();
     SuspendLayout();
     xyDiagram1.AxisX.VisibleInPanesSerializable = "-1";
     xyDiagram1.AxisY.VisibleInPanesSerializable = "-1";
     xyDiagram1.EnableAxisXScrolling             = true;
     xyDiagram1.EnableAxisXZooming   = true;
     xyDiagram1.EnableAxisYScrolling = true;
     xyDiagram1.EnableAxisYZooming   = true;
     chartControl1.Diagram           = xyDiagram1;
     chartControl1.Legend.Name       = "Default Legend";
     chartControl1.Location          = new Point(12, 12);
     chartControl1.Name = "chartControl1";
     series11.Name      = "Series 1";
     pointSeriesView1.PointMarkerOptions.Size = 4;
     pointSeriesView1.PointMarkerOptions.Kind = MarkerKind.Square;
     pointSeriesView1.Color           = Color.FromArgb(100, 0, 200, 10);
     series11.View                    = pointSeriesView1;
     chartControl1.SeriesSerializable = new Series[] {
         series11
     };
     chartControl1.Size     = new Size(776, 440);
     chartControl1.TabIndex = 0;
     Form1layoutControl1ConvertedLayout.Controls.Add(chartControl1);
     Form1layoutControl1ConvertedLayout.Dock         = DockStyle.Fill;
     Form1layoutControl1ConvertedLayout.Location     = new Point(0, 0);
     Form1layoutControl1ConvertedLayout.Name         = "Form1layoutControl1ConvertedLayout";
     Form1layoutControl1ConvertedLayout.Root         = layoutControlGroup1;
     Form1layoutControl1ConvertedLayout.Size         = new Size(800, 464);
     Form1layoutControl1ConvertedLayout.TabIndex     = 4;
     layoutControlGroup1.EnableIndentsWithoutBorders = DefaultBoolean.True;
     layoutControlGroup1.GroupBordersVisible         = false;
     layoutControlGroup1.Items.AddRange(new BaseLayoutItem[] {
         chartControl1item
     });
     layoutControlGroup1.Name        = "layoutControlGroup1";
     layoutControlGroup1.Size        = new Size(800, 464);
     layoutControlGroup1.TextVisible = false;
     chartControl1item.Control       = chartControl1;
     chartControl1item.Location      = new Point(0, 0);
     chartControl1item.Name          = "chartControl1item";
     chartControl1item.Size          = new Size(780, 444);
     chartControl1item.TextSize      = new Size(0, 0);
     chartControl1item.TextVisible   = false;
     AutoScaleDimensions             = new SizeF(6F, 13F);
     AutoScaleMode = AutoScaleMode.Font;
     ClientSize    = new Size(800, 464);
     Controls.Add(Form1layoutControl1ConvertedLayout);
     Name = "Form1";
     Text = "Form1";
     ((ISupportInitialize)(xyDiagram1)).EndInit();
     ((ISupportInitialize)(pointSeriesView1)).EndInit();
     ((ISupportInitialize)(series11)).EndInit();
     ((ISupportInitialize)(chartControl1)).EndInit();
     ((ISupportInitialize)(Form1layoutControl1ConvertedLayout)).EndInit();
     Form1layoutControl1ConvertedLayout.ResumeLayout(false);
     ((ISupportInitialize)(layoutControlGroup1)).EndInit();
     ((ISupportInitialize)(chartControl1item)).EndInit();
     ResumeLayout(false);
 }
Exemplo n.º 27
0
        protected void ConstructScatterplot(DataTable dataxy)
        {
            if (_settings.colorvar != "none")
            {
                _settings.colorLevels = dataxy.AsEnumerable().Select(x => x.Field <string>(_settings.colorvar)).Distinct().ToList();
            }
            if (_settings.panevar != "none")
            {
                _settings.paneLevels = dataxy.AsEnumerable().Select(x => x.Field <string>(_settings.panevar)).Distinct().ToList();
            }


            ScatterplotSeries scatseries = new ScatterplotSeries(dataxy, _settings);             //.xaxisvar, _settings.yaxisvar, _settings.colorvar, _settings.panevar, _settings.colors, _colorLevels);

            subtitles = scatseries.Subtitles();

            foreach (string s in subtitles)
            {
                Debug.WriteLine(s);
            }

            int regcounter = 0;

            foreach (DxSeriesPoints sp in scatseries.list_dxseriespoints)
            {
                Series          s = new Series();
                PointSeriesView pointSeriesView = new PointSeriesView();

                s.Points.AddRange(sp.seriesPoints);
                s.View = pointSeriesView;
                s.ToolTipPointPattern = "{HINT} x={A:F2} y={V:F2}";


                if (_settings.useMovAvg)
                {
                    SimpleMovingAverage sma = new SimpleMovingAverage();
                    sma.PointsCount         = _settings._movavgNumPts;;              // Convert.ToInt32(txtPtsCount.Text);
                    sma.Color               = sp.seriesPoints[0].Color;
                    sma.LineStyle.DashStyle = DashStyle.Dash;
                    HSLColor hsl = new HSLColor();
                    sma.Color = hsl.Darken(sp.seriesPoints[0].Color, .9, _settings.reglineAlpha);
                    ((PointSeriesView)s.View).Indicators.Add(sma);
                }


                if (_settings.showregline)
                {
                    RegressionLine regline = new RegressionLine();
                    HSLColor       hsl     = new HSLColor();
                    regline.LineStyle.Thickness = 4;
                    regline.Color = hsl.Darken(sp.seriesPoints[0].Color, .9, _settings.reglineAlpha);
                    regline.CrosshairTextOptions.TextColor = Color.Lime;
                    //regline.CrosshairTextOptions.

                    ((PointSeriesView)s.View).Indicators.Add(regline);
                }
                regcounter++;

                chart.Series.Add(s);
            }



            //Legend
            if (_settings.colorvar != "none" & dataxy.ContainsColumnName(_settings.colorvar))
            {
                LegendByColorLevels(_settings.colors, _settings.colorLevels);
            }


            if (_settings.colorvar != "none" & _settings.panevar != "none")
            {
                xydiagram.Panes.Clear();
                Debug.WriteLine(String.Format("***************************** After CLEAR # of Panes: {0}", xydiagram.Panes.Count));

                MakePanes(_settings.paneLevels, subtitles);
                AssignSeriesToPane(scatseries, _settings.paneLevels);
            }
            else if (_settings.colorvar == "none" & _settings.panevar != "none")
            {
                xydiagram.Panes.Clear();
                Debug.WriteLine(String.Format("***************************** After CLEAR # of Panes: {0}", xydiagram.Panes.Count));

                MakePanes(_settings.paneLevels, subtitles);
                AssignSeriesToPane(scatseries, _settings.paneLevels);
            }
            else if (_settings.colorvar != "none")
            {
                //xydiagram.Panes.Clear();
                //Debug.WriteLine(String.Format("***************************** After CLEAR # of Panes: {0}", xydiagram.Panes.Count));
                //MakePanes(_settings.colorLevels, subtitles);
                //AssignSeriesToPane(scatseries, _settings.colorLevels);
            }



            //No Additional Panes
            else
            {
                //for (int i = 0; i < chart.Series.Count; i++)
                //{
                //	XYDiagramSeriesViewBase view = (XYDiagramSeriesViewBase)chart.Series[i].View;
                //	view.Pane = xydiagram.DefaultPane;
                //}
            }
        }