示例#1
0
        private void cmbChooseChart_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cmbChooseChart.SelectedIndex)
            {
            case 0:
            {
                var shape = new SideBySideBarSeriesView();
                ccTaskStatisticalFigure.Series[0].View = shape;
            } break;

            case 1:
            {
                var shape        = new PieSeriesView();
                var label        = ccTaskStatisticalFigure.Series[0].Label;
                var pointOptions = label.PointOptions;
                pointOptions.PointView = PointView.ArgumentAndValues;
                pointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
                ccTaskStatisticalFigure.Series[0].View  = shape;
            } break;

            case 2:
            {
                var shape = new LineSeriesView();
                ccTaskStatisticalFigure.Series[0].View = shape;
            } break;

            case 3:
            {
                var shape = new AreaSeriesView();
                shape.Transparency = (byte)135;
                ccTaskStatisticalFigure.Series[0].View = shape;
            } break;
            }
        }
示例#2
0
        protected virtual Series CreateAreaSeries(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;
            s.ShowInLegend   = true;
            AreaSeriesView view = null;

            if (info.ChartType == ChartType.Area)
            {
                view = new AreaSeriesView();
            }
            else
            {
                view = new StepAreaSeriesView();
            }
            view.Color   = info.Color;
            s.View       = view;
            s.DataSource = GetDataSource(info);
            return(s);
        }
        protected virtual Series CreateAreaSeries(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;
            s.ShowInLegend   = true;
            AreaSeriesView view = null;

            if (info.ChartType == ChartType.Area)
            {
                view = new AreaSeriesView();
            }
            else
            {
                view = new StepAreaSeriesView();
            }
            view.Color = info.Color;
            s.View     = view;
            object           dataSource = GetDataSource(info);
            IResizeableArray array      = dataSource as IResizeableArray;

            if (array == null || array.Count < BigDataCount)
            {
                s.DataSource = dataSource;
            }
            else
            {
                s.Points.AddRange(CreateSeriesPoints(info));
            }
            return(s);
        }
 private void cmbChooseChart_SelectedIndexChanged(object sender, EventArgs e)
 {
     switch (cmbChooseChart.SelectedIndex)
     {
         case 0:
             {
                 var shape = new SideBySideBarSeriesView();
                 ccTaskStatisticalFigure.Series[0].View = shape;
             } break;
         case 1:
             {
                 var shape = new PieSeriesView();
                 var label = ccTaskStatisticalFigure.Series[0].Label;
                 var pointOptions = label.PointOptions;
                 pointOptions.PointView = PointView.ArgumentAndValues;
                 pointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
                 ccTaskStatisticalFigure.Series[0].View = shape;
             } break;
         case 2:
             {
                 var shape = new LineSeriesView();
                 ccTaskStatisticalFigure.Series[0].View = shape;
             } break;
         case 3:
             {
                 var shape = new AreaSeriesView();
                 shape.Transparency = (byte)135;
                 ccTaskStatisticalFigure.Series[0].View = shape;
             } break;
     }
 }
示例#5
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;
            }
        }
        protected virtual Series CreateAreaSeries(StrategyDataItemInfo info)
        {
            Series s = new Series();

            s.Name = info.FieldName;
            s.ArgumentDataMember = "Time";
            s.ValueDataMembers.AddRange(info.FieldName);
            s.ValueScaleType = ScaleType.Numerical;
            s.ShowInLegend   = true;
            AreaSeriesView view = new AreaSeriesView();

            view.Color   = info.Color;
            s.View       = view;
            s.DataSource = Strategy.StrategyData;
            return(s);
        }
示例#7
0
        Series CreateAreaSeries(List <TickerHistoryItem> list, string str, Color color)
        {
            Series s = new Series();

            s.Name = str;
            s.ArgumentDataMember = "Time";
            s.ValueDataMembers.AddRange(str);
            s.ValueScaleType = ScaleType.Numerical;
            s.ShowInLegend   = true;
            AreaSeriesView view = new AreaSeriesView();

            view.Color   = color;
            s.View       = view;
            s.DataSource = list;
            return(s);
        }
示例#8
0
        private Series CreateHistogramSeries(List <LinqStatistics.Bin> bins, Color c, bool reflect)
        {
            Series         series         = new Series();
            AreaSeriesView areaSeriesView = new AreaSeriesView();

            areaSeriesView.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False;

            for (int i = 0; i < bins.Count(); i++)
            {
                LinqStatistics.Bin bin = bins[i];

                double min   = bin.Range.Min;
                double max   = bin.Range.Max;
                double count = bin.Count;

                if (Double.IsInfinity(max))
                {
                    double binwidth = bins[1].Range.Max - bins[1].Range.Min;
                    max = min + binwidth;
                }

                int         reflection_multiplier = (reflect) ? -1 : 1;
                SeriesPoint p1 = new SeriesPoint(min, count * reflection_multiplier);
                SeriesPoint p2 = new SeriesPoint(max, count * reflection_multiplier);

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


            //areaSeriesView.Color = c;
            areaSeriesView.Color        = Color.FromArgb(50, c);
            areaSeriesView.Transparency = 180;
            series.View = areaSeriesView;



            return(series);
        }
示例#9
0
        private void InitChartControl()
        {
            //Series series1 = new Series("1", ViewType.Line);
            //for (int rowIdx = 0; rowIdx < 10; rowIdx++)
            //{
            //    series1.Points.Add(new SeriesPoint(rowIdx, rowIdx));
            //}

            //Series series2 = new Series("1", ViewType.Line);
            //for (int rowIdx = 0; rowIdx < 10; rowIdx++)
            //{
            //    series2.Points.Add(new SeriesPoint(rowIdx, rowIdx + 10));
            //}

            //Series series3 = new Series("1", ViewType.Line);
            //for (int rowIdx = 0; rowIdx < 10; rowIdx++)
            //{
            //    series3.Points.Add(new SeriesPoint(rowIdx, rowIdx + 20));
            //}

            XYDiagram        xyDiagram1        = new XYDiagram();
            var              xyDiagramPane1    = new XYDiagramPane();
            SecondaryAxisY   secondaryAxisY1   = new SecondaryAxisY();
            Series           series1           = new Series();
            PointSeriesLabel pointSeriesLabel1 = new PointSeriesLabel();
            SeriesPoint      seriesPoint1      = new SeriesPoint(new DateTime(2008, 6, 11, 6, 0, 0, 0), new object[] {
                ((object)(56.48D))
            });
            SeriesPoint seriesPoint2 = new SeriesPoint(new DateTime(2008, 6, 11, 3, 0, 0, 0), new object[] {
                ((object)(53.78D))
            });
            LineSeriesView   lineSeriesView1   = new LineSeriesView();
            Series           series2           = new Series();
            PointSeriesLabel pointSeriesLabel2 = new PointSeriesLabel();
            SeriesPoint      seriesPoint3      = new SeriesPoint(new DateTime(2008, 6, 11, 6, 0, 0, 0), new object[] {
                ((object)(1023D))
            });
            SeriesPoint seriesPoint4 = new SeriesPoint(new System.DateTime(2008, 6, 11, 3, 0, 0, 0), new object[] {
                ((object)(1021D))
            });
            AreaSeriesView areaSeriesView1 = new AreaSeriesView();
            ChartTitle     chartTitle1     = new ChartTitle();

            ((ISupportInitialize)(chartControl4)).BeginInit();
            ((ISupportInitialize)(xyDiagram1)).BeginInit();
            ((ISupportInitialize)(xyDiagramPane1)).BeginInit();
            ((ISupportInitialize)(secondaryAxisY1)).BeginInit();
            ((ISupportInitialize)(series1)).BeginInit();
            ((ISupportInitialize)(pointSeriesLabel1)).BeginInit();
            ((ISupportInitialize)(lineSeriesView1)).BeginInit();
            ((ISupportInitialize)(series2)).BeginInit();
            ((ISupportInitialize)(pointSeriesLabel2)).BeginInit();
            ((ISupportInitialize)(areaSeriesView1)).BeginInit();
            this.SuspendLayout();


            chartControl4.AutoLayout = false;
            chartControl4.CrosshairOptions.ArgumentLineColor           = System.Drawing.Color.DeepSkyBlue;
            chartControl4.CrosshairOptions.ArgumentLineStyle.Thickness = 2;
            chartControl4.CrosshairOptions.GroupHeaderPattern          = "{A:d MMMM,  H:mm}";
            chartControl4.CrosshairOptions.ShowOnlyInFocusedPane       = false;
            chartControl4.DataBindings = null;


            xyDiagram1.AxisX.DateTimeScaleOptions.AutoGrid      = false;
            xyDiagram1.AxisX.DateTimeScaleOptions.GridAlignment = DevExpress.XtraCharts.DateTimeGridAlignment.Hour;
            xyDiagram1.AxisX.DateTimeScaleOptions.GridSpacing   = 6D;
            xyDiagram1.AxisX.DateTimeScaleOptions.MeasureUnit   = DevExpress.XtraCharts.DateTimeMeasureUnit.Hour;
            xyDiagram1.AxisX.GridLines.Visible                            = true;
            xyDiagram1.AxisX.Interlaced                                   = true;
            xyDiagram1.AxisX.Label.Staggered                              = true;
            xyDiagram1.AxisX.Label.TextPattern                            = "{A:dd/MM HH:mm}";
            xyDiagram1.AxisX.Title.Text                                   = "Date";
            xyDiagram1.AxisX.VisibleInPanesSerializable                   = "";
            xyDiagram1.AxisX.VisualRange.Auto                             = false;
            xyDiagram1.AxisX.VisualRange.MaxValueSerializable             = "06/11/2008 06:00:00.000";
            xyDiagram1.AxisX.VisualRange.MinValueSerializable             = "06/11/2008 03:00:00.000";
            xyDiagram1.AxisY.GridLines.MinorVisible                       = true;
            xyDiagram1.AxisY.Title.Font                                   = new System.Drawing.Font("Tahoma", 10F);
            xyDiagram1.AxisY.Title.Text                                   = "Temperature, F";
            xyDiagram1.AxisY.Title.Visibility                             = DevExpress.Utils.DefaultBoolean.True;
            xyDiagram1.AxisY.VisibleInPanesSerializable                   = "-1";
            xyDiagram1.AxisY.WholeRange.AlwaysShowZeroLevel               = false;
            xyDiagram1.DefaultPane.ScrollBarOptions.XAxisScrollBarVisible = false;
            xyDiagram1.DefaultPane.ScrollBarOptions.YAxisScrollBarVisible = false;
            xyDiagram1.DefaultPane.Weight                                 = 2D;
            xyDiagram1.EnableAxisXScrolling                               = true;
            xyDiagram1.PaneDistance = 4;
            xyDiagramPane1.Name     = "Pane 1";
            xyDiagramPane1.PaneID   = 0;
            xyDiagramPane1.ScrollBarOptions.XAxisScrollBarVisible = false;
            xyDiagramPane1.ScrollBarOptions.YAxisScrollBarVisible = false;
            xyDiagram1.Panes.AddRange(new DevExpress.XtraCharts.XYDiagramPane[] {
                xyDiagramPane1
            });


            secondaryAxisY1.Alignment = DevExpress.XtraCharts.AxisAlignment.Near;
            secondaryAxisY1.AxisID    = 0;
            secondaryAxisY1.GridLines.MinorVisible = true;
            secondaryAxisY1.GridLines.Visible      = true;
            secondaryAxisY1.Name = "secondaryAxisY1";
            secondaryAxisY1.NumericScaleOptions.AutoGrid    = false;
            secondaryAxisY1.NumericScaleOptions.GridSpacing = 4D;
            secondaryAxisY1.Title.Font                       = new System.Drawing.Font("Tahoma", 10F);
            secondaryAxisY1.Title.Text                       = "Pressure, mbar";
            secondaryAxisY1.Title.Visibility                 = DevExpress.Utils.DefaultBoolean.True;
            secondaryAxisY1.VisibleInPanesSerializable       = "0";
            secondaryAxisY1.VisualRange.Auto                 = false;
            secondaryAxisY1.VisualRange.AutoSideMargins      = false;
            secondaryAxisY1.VisualRange.MaxValueSerializable = "1025";
            secondaryAxisY1.VisualRange.MinValueSerializable = "1014";
            secondaryAxisY1.VisualRange.SideMarginsValue     = 0D;
            secondaryAxisY1.WholeRange.AlwaysShowZeroLevel   = false;
            secondaryAxisY1.WholeRange.Auto                  = false;
            secondaryAxisY1.WholeRange.AutoSideMargins       = false;
            secondaryAxisY1.WholeRange.MaxValueSerializable  = "1025";
            secondaryAxisY1.WholeRange.MinValueSerializable  = "1014";
            secondaryAxisY1.WholeRange.SideMarginsValue      = 0D;
            xyDiagram1.SecondaryAxesY.AddRange(new DevExpress.XtraCharts.SecondaryAxisY[] {
                secondaryAxisY1
            });



            chartControl4.Diagram = xyDiagram1;
            chartControl4.Dock    = System.Windows.Forms.DockStyle.Fill;
            chartControl4.Legend.AlignmentHorizontal = DevExpress.XtraCharts.LegendAlignmentHorizontal.Left;
            chartControl4.Legend.AlignmentVertical   = DevExpress.XtraCharts.LegendAlignmentVertical.BottomOutside;
            chartControl4.Legend.Direction           = DevExpress.XtraCharts.LegendDirection.LeftToRight;
            chartControl4.Legend.Name = "Default Legend";
            chartControl4.Location    = new System.Drawing.Point(0, 0);
            chartControl4.Name        = "chart04";


            series1.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.DateTime;
            pointSeriesLabel1.Angle   = 90;
            series1.Label             = pointSeriesLabel1;
            series1.Name = "Temperature (F)";
            series1.Points.AddRange(new DevExpress.XtraCharts.SeriesPoint[] {
                seriesPoint1,
                seriesPoint2
            });
            series1.View = lineSeriesView1;
            series2.ArgumentScaleType    = DevExpress.XtraCharts.ScaleType.DateTime;
            pointSeriesLabel2.Angle      = 90;
            pointSeriesLabel2.LineLength = 5;
            series2.Label            = pointSeriesLabel2;
            series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
            series2.Name             = "Pressure (mbar)";
            series2.Points.AddRange(new DevExpress.XtraCharts.SeriesPoint[] {
                seriesPoint3,
                seriesPoint4
            });
            areaSeriesView1.AxisYName        = "secondaryAxisY1";
            areaSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False;
            areaSeriesView1.PaneName         = "Pane 1";
            areaSeriesView1.Transparency     = ((byte)(0));
            series2.View = areaSeriesView1;

            this.chartControl4.SeriesSerializable = new DevExpress.XtraCharts.Series[] {
                series1,
                series2
            };
            chartControl4.Size     = new System.Drawing.Size(1333, 548);
            chartControl4.TabIndex = 3;
            chartTitle1.Text       = "Weather in London";
            chartControl4.Titles.AddRange(new DevExpress.XtraCharts.ChartTitle[] {
                chartTitle1
            });
            chartControl4.ToolTipOptions.ShowForPoints = false;


            ((ISupportInitialize)(xyDiagramPane1)).EndInit();
            ((ISupportInitialize)(secondaryAxisY1)).EndInit();
            ((ISupportInitialize)(xyDiagram1)).EndInit();
            ((ISupportInitialize)(pointSeriesLabel1)).EndInit();
            ((ISupportInitialize)(lineSeriesView1)).EndInit();
            ((ISupportInitialize)(series1)).EndInit();
            ((ISupportInitialize)(pointSeriesLabel2)).EndInit();
            ((ISupportInitialize)(areaSeriesView1)).EndInit();
            ((ISupportInitialize)(series2)).EndInit();
            ((ISupportInitialize)(this.chartControl4)).EndInit();
            this.ResumeLayout(false);
        }
示例#10
0
        private void InitChartControl3()
        {
            chartControl4.CrosshairOptions.ArgumentLineColor           = System.Drawing.Color.DeepSkyBlue;
            chartControl4.CrosshairOptions.ArgumentLineStyle.Thickness = 2;
            //chartControl4.CrosshairOptions.GroupHeaderPattern = "{A:d MMMM,  H:mm}";
            chartControl4.CrosshairOptions.ShowOnlyInFocusedPane = false;



            WebClient wc = new WebClient();

            wc.Encoding = Encoding.UTF8;

            var json = wc.DownloadString("http://localhost/eqpMaxLoad/100218/2020120308/2020120322");

            string    strJson  = json.ToString();
            JObject   arrJson  = JObject.Parse(strJson);
            JArray    arrJsons = JArray.Parse(arrJson["data"].ToString());
            DataTable dt       = JsonConvert.DeserializeObject <DataTable>(arrJson["data"].ToString());

            Series series1 = new Series("1", ViewType.Bar);
            Series series2 = new Series("2", ViewType.Area);
            Series series3 = new Series("3", ViewType.Line);

            for (int cdIdx = 0; cdIdx < cdList.Count; cdIdx++)
            {
                Series series = new Series(cdList[cdIdx], ViewType.Line);
                for (int rowIdx = 0; rowIdx < dt.Rows.Count; rowIdx++)
                {
                    if (dt.Rows[rowIdx]["ITEM_CD"].ToString() == cdList[cdIdx])
                    {
                        if (cdIdx == 0)
                        {
                            series1.Points.Add(new SeriesPoint(DateTime.ParseExact(dt.Rows[rowIdx]["PER_MIN"].ToString(), "yyyyMMdd HHmm", null), dt.Rows[rowIdx]["ITEM_VALUE"]));
                        }
                        if (cdIdx == 1)
                        {
                            series2.Points.Add(new SeriesPoint(DateTime.ParseExact(dt.Rows[rowIdx]["PER_MIN"].ToString(), "yyyyMMdd HHmm", null), dt.Rows[rowIdx]["ITEM_VALUE"]));
                        }
                        if (cdIdx == 2)
                        {
                            series3.Points.Add(new SeriesPoint(DateTime.ParseExact(dt.Rows[rowIdx]["PER_MIN"].ToString(), "yyyyMMdd HHmm", null), dt.Rows[rowIdx]["ITEM_VALUE"]));
                        }
                    }
                }
            }


            // Add both series to the chart.
            chartControl4.Series.AddRange(new Series[] { series1, series2, series3 });

            // Cast the second series's view to the LineSeriesView type.
            AreaSeriesView myView  = (AreaSeriesView)series2.View;
            LineSeriesView myView2 = (LineSeriesView)series3.View;

            // Hide the legend (optional).
            //chartControl4.Legend.Visibility = DefaultBoolean.False;

            // Cast the chart's diagram to the XYDiagram type,
            // to access its axes and panes.
            XYDiagram diagram = (XYDiagram)chartControl4.Diagram;

            // Add a new additional pane to the diagram.
            diagram.Panes.Add(new XYDiagramPane("My Pane1"));
            diagram.Panes.Add(new XYDiagramPane("My Pane2"));

            // Note that the created pane has the zero index in the collection,
            // because the existing Default pane is a separate entity.
            myView.Pane  = diagram.Panes[0];
            myView2.Pane = diagram.Panes[1];
            // Add titles to panes.

            // Customize the pane layout.
            diagram.PaneDistance = 10;

            // Add secondary axes to the diagram, and adjust their options.
            diagram.SecondaryAxesX.Add(new SecondaryAxisX("My Axis X"));
            diagram.SecondaryAxesY.Add(new SecondaryAxisY("My Axis Y"));
            diagram.SecondaryAxesX[0].Alignment = AxisAlignment.Near;
            diagram.SecondaryAxesY[0].Alignment = AxisAlignment.Near;
            //diagram.SecondaryAxesY[0].GridLines.Visible = true;

            diagram.SecondaryAxesX.Add(new SecondaryAxisX("My Axis X"));
            diagram.SecondaryAxesY.Add(new SecondaryAxisY("My Axis Y"));
            diagram.SecondaryAxesX[1].Alignment = AxisAlignment.Near;
            diagram.SecondaryAxesY[1].Alignment = AxisAlignment.Near;



            //
            diagram.EnableAxisXScrolling = true;
            diagram.EnableAxisXZooming   = true;
            diagram.EnableAxisYScrolling = true;
            diagram.EnableAxisYZooming   = true;


            diagram.AxisX.DateTimeOptions.Format             = DateTimeFormat.ShortTime;
            diagram.AxisX.Label.TextPattern                  = "{A:HH:mm}";
            diagram.AxisX.DateTimeScaleOptions.MeasureUnit   = DevExpress.XtraCharts.DateTimeMeasureUnit.Minute;
            diagram.AxisX.DateTimeScaleOptions.GridAlignment = DevExpress.XtraCharts.DateTimeGridAlignment.Hour;
            diagram.AxisX.WholeRange.SetMinMaxValues(new DateTime(2020, 12, 03, 9, 0, 0), new DateTime(2020, 12, 03, 17, 59, 0));
            diagram.AxisX.WholeRange.SideMarginsValue  = 20;
            diagram.AxisX.VisualRange.SideMarginsValue = 20;
            //diagram.AxisX.VisualRange.SetMinMaxValues(new DateTime(2020, 12, 03, 9, 0, 0), new DateTime(2020, 12, 03, 14, 59, 0));

            diagram.AxisY.Title.Font       = new System.Drawing.Font("Tahoma", 10F);
            diagram.AxisY.Title.Text       = "Temperature, F";
            diagram.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;



            myView.AxisX = diagram.SecondaryAxesX[0];
            myView.AxisY = diagram.SecondaryAxesY[0];
            myView.AxisX.DateTimeOptions.Format             = DateTimeFormat.ShortTime;
            myView.AxisX.Label.TextPattern                  = "{A:HH:mm}";
            myView.AxisX.DateTimeScaleOptions.MeasureUnit   = DevExpress.XtraCharts.DateTimeMeasureUnit.Minute;
            myView.AxisX.DateTimeScaleOptions.GridAlignment = DevExpress.XtraCharts.DateTimeGridAlignment.Hour;
            myView.AxisX.WholeRange.SetMinMaxValues(new DateTime(2020, 12, 03, 9, 0, 0), new DateTime(2020, 12, 03, 17, 59, 0));
            //myView.AxisX.VisualRange.SetMinMaxValues(new DateTime(2020, 12, 03, 9, 0, 0), new DateTime(2020, 12, 03, 14, 59, 0));
            myView.AxisX.WholeRange.SideMarginsValue  = 20;
            myView.AxisX.VisualRange.SideMarginsValue = 20;

            diagram.SecondaryAxesY[0].Title.Font       = new System.Drawing.Font("Tahoma", 10F);
            diagram.SecondaryAxesY[0].Title.Text       = "Pressure, mbar";
            diagram.SecondaryAxesY[0].Title.Visibility = DevExpress.Utils.DefaultBoolean.True;


            myView2.AxisX = diagram.SecondaryAxesX[1];
            myView2.AxisY = diagram.SecondaryAxesY[1];
            myView2.AxisX.DateTimeOptions.Format             = DateTimeFormat.ShortTime;
            myView2.AxisX.Label.TextPattern                  = "{A:HH:mm}";
            myView2.AxisX.DateTimeScaleOptions.MeasureUnit   = DevExpress.XtraCharts.DateTimeMeasureUnit.Minute;
            myView2.AxisX.DateTimeScaleOptions.GridAlignment = DevExpress.XtraCharts.DateTimeGridAlignment.Hour;
            myView2.AxisX.WholeRange.SetMinMaxValues(new DateTime(2020, 12, 03, 9, 0, 0), new DateTime(2020, 12, 03, 17, 59, 0));
            //myView2.AxisX.VisualRange.SetMinMaxValues(new DateTime(2020, 12, 03, 9, 0, 0), new DateTime(2020, 12, 03, 14, 59, 0));
            myView2.AxisX.WholeRange.SideMarginsValue  = 20;
            myView2.AxisX.VisualRange.SideMarginsValue = 20;


            diagram.SecondaryAxesY[1].Title.Font       = new System.Drawing.Font("Tahoma", 10F);
            diagram.SecondaryAxesY[1].Title.Text       = "Pressure, mbar";
            diagram.SecondaryAxesY[1].Title.Visibility = DevExpress.Utils.DefaultBoolean.True;


            // Add the chart to the form.
            chartControl4.Dock = DockStyle.Fill;
        }
示例#11
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;
        }