Exemplo n.º 1
0
        // 初始化曲线
        private void InitSeries()
        {
            chartControl_Main.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right;

            chartControl_Main.Series.Clear();
            Equipment ep = new Equipment();

            if (mainList.Count > 0)
            {
                ep = mainList.First();
            }
            seriesOne     = new Series(string.Format(ep.EName), ViewType.SwiftPlot);
            seriesOne.Tag = ep.ID;
            seriesOne.ArgumentScaleType = ScaleType.DateTime;
            SwiftPlotSeriesView spsv1 = new SwiftPlotSeriesView();

            spsv1.LineStyle.Thickness = 2;
            seriesOne.View            = spsv1;
            chartControl_Main.Series.Add(seriesOne);

            SwiftPlotDiagram diagram_Tem = chartControl_Main.Diagram as SwiftPlotDiagram;

            diagram_Tem.Margins.Right = 15;
            //diagram_Tem.AxisX.
            diagram_Tem.AxisX.DateTimeGridAlignment        = DateTimeMeasurementUnit.Minute;
            diagram_Tem.AxisX.DateTimeMeasureUnit          = DateTimeMeasurementUnit.Second;
            diagram_Tem.AxisX.DateTimeOptions.Format       = DateTimeFormat.Custom;
            diagram_Tem.AxisX.DateTimeOptions.FormatString = "HH:mm:ss";
            //diagram_Tem.AxisX.GridLines.Visible = true;
            diagram_Tem.AxisX.Range.SideMarginsEnabled = false;
            diagram_Tem.AxisX.Range.ScrollingRange.SideMarginsEnabled = true;
            diagram_Tem.AxisX.Title.Text         = "时间";
            diagram_Tem.AxisX.Title.Visible      = true;
            diagram_Tem.AxisX.Title.Alignment    = StringAlignment.Far;
            diagram_Tem.AxisX.Title.Antialiasing = false;
            diagram_Tem.AxisX.Title.Font         = new System.Drawing.Font("Tahoma", 8);

            diagram_Tem.AxisY.Range.AlwaysShowZeroLevel = false;
            //diagram_Tem.EnableAxisYZooming = true;
            //diagram_Tem.EnableAxisYScrolling = true;
            diagram_Tem.AxisY.Interlaced = true;
            diagram_Tem.AxisY.Range.SideMarginsEnabled = true;
            diagram_Tem.AxisY.Range.ScrollingRange.SideMarginsEnabled = true;
            diagram_Tem.AxisY.Title.Text         = string.Format("浓度({0})", ep.Unit);
            diagram_Tem.AxisY.Title.Visible      = true;
            diagram_Tem.AxisY.Title.Alignment    = StringAlignment.Far;
            diagram_Tem.AxisY.Title.Antialiasing = false;
            diagram_Tem.AxisY.Title.Font         = new System.Drawing.Font("Tahoma", 8);
            //if (diagram_Tem != null && diagram_Tem.AxisX.DateTimeMeasureUnit == DateTimeMeasurementUnit.Millisecond)
            //    diagram_Tem.AxisX.Range.SetMinMaxValues(minDate, argument);
        }
Exemplo n.º 2
0
 static RegressionLine GetRegressionLine(Series series)
 {
     if (series != null)
     {
         SwiftPlotSeriesView swiftPlotView = series.View as SwiftPlotSeriesView;
         if (swiftPlotView != null)
         {
             foreach (Indicator indicator in swiftPlotView.Indicators)
             {
                 RegressionLine regressionLine = indicator as RegressionLine;
                 if (regressionLine != null)
                 {
                     return(regressionLine);
                 }
             }
         }
     }
     return(null);
 }