| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036 | 
							- using System;
 
- using System.Collections;
 
- using System.Collections.Generic;
 
- using System.Drawing;
 
- using System.Drawing.Imaging;
 
- using System.Globalization;
 
- using System.IO;
 
- using System.Linq;
 
- using System.Reflection.Emit;
 
- using System.Windows;
 
- using System.Windows.Controls;
 
- using System.Windows.Input;
 
- using System.Windows.Media;
 
- using System.Windows.Media.Animation;
 
- using System.Windows.Media.Imaging;
 
- namespace Venus_Themes.UserControls
 
- {
 
-     /// <summary>
 
-     /// DrawGraphicsControl.xaml 的交互逻辑
 
-     /// </summary>
 
-     public partial class DrawGraphicsControl : UserControl
 
-     {
 
-         private double m_WavePlotX = 0;//x轴起始点
 
-         private double m_WavePlotY = 0;//y轴起始点
 
-         private double m_WavePlotWidth = 5000;//x轴长度
 
-         private double m_WavePlotHeight = 100;//y轴长度
 
-         private double m_WavePlotMinX = double.MaxValue;
 
-         private double m_WavePlotMaxX = double.MinValue;
 
-         private double m_WavePlotMinY = double.MaxValue;
 
-         private double m_WavePlotMaxY = double.MinValue;
 
-         private double m_StartDrawLineX = 0;
 
-         private System.Drawing.Brush m_BrushText = System.Drawing.Brushes.Black;
 
-         private System.Drawing.Brush m_BrushXYText = System.Drawing.Brushes.DarkRed;
 
-         private System.Drawing.Pen m_PenLine;
 
-         private System.Drawing.Pen m_PenLightGray;
 
-         private System.Drawing.Pen m_PenBlue;
 
-         private System.Drawing.Pen m_PenData;
 
-         private System.Drawing.Pen m_PenSData;
 
-         private System.Drawing.Pen m_PenASData;
 
-         public System.Drawing.Pen[] m_PenCollencteions;
 
-         private bool m_StartMouseMove = false;
 
-         private bool m_MouseMove = false;
 
-         private bool m_MouseEnter = false;
 
-         private System.Windows.Point m_StartPoint;
 
-         private System.Windows.Point m_EndPoint;
 
-         private System.Windows.Point m_CurrentPoint;
 
-         private float LineThickness = 2.0f;
 
-         #region Property
 
-         public PointCollection PlotDataPoints
 
-         {
 
-             get { return (PointCollection)GetValue(PlotDataProperty); }
 
-             set { SetValue(PlotDataProperty, value); GraphicDraw(); }
 
-         }
 
-         /// <summary>
 
-         /// Identifies the DrawGraphicsControl.PlotDataPoints attached property. 
 
-         /// </summary>
 
-         public static readonly DependencyProperty PlotDataProperty =
 
-             DependencyProperty.RegisterAttached("PlotDataPoints", typeof(PointCollection), typeof(DrawGraphicsControl));
 
-         public PointCollection PlotSDataPoints
 
-         {
 
-             get { return (PointCollection)GetValue(PlotSDataProperty); }
 
-             set { SetValue(PlotSDataProperty, value); GraphicDraw(); }
 
-         }
 
-         /// <summary>
 
-         /// Identifies the DrawGraphicsControl.PlotSDataPoints attached property. 
 
-         /// </summary>
 
-         public static readonly DependencyProperty PlotSDataProperty =
 
-             DependencyProperty.RegisterAttached("PlotSDataPoints", typeof(PointCollection), typeof(DrawGraphicsControl));
 
-         public PointCollection PlotASDataPoints
 
-         {
 
-             get { return (PointCollection)GetValue(PlotASDataProperty); }
 
-             set { SetValue(PlotASDataProperty, value); GraphicDraw(); }
 
-         }
 
-         /// <summary>
 
-         /// Identifies the DrawGraphicsControl.PlotASDataPoints attached property. 
 
-         /// </summary>
 
-         public static readonly DependencyProperty PlotASDataProperty =
 
-             DependencyProperty.RegisterAttached("PlotASDataPoints", typeof(PointCollection), typeof(DrawGraphicsControl));
 
-         public List<PointCollection> PointCollections
 
-         {
 
-             get { return (List<PointCollection>)GetValue(PointCollectionsProperty); }
 
-             set { SetValue(PointCollectionsProperty, value); GraphicDraw(); }
 
-         }
 
-         /// <summary>
 
-         /// Identifies the DrawGraphicsControl.PointCollections attached property. 
 
-         /// </summary>
 
-         public static readonly DependencyProperty PointCollectionsProperty =
 
-             DependencyProperty.RegisterAttached("PointCollections", typeof(List<PointCollection>), typeof(DrawGraphicsControl));
 
-         public PointCollection Points
 
-         {
 
-             get { return (PointCollection)GetValue(PointsProperty); }
 
-             set { SetValue(PointsProperty, value); GraphicDraw(); }
 
-         }
 
-         /// <summary>
 
-         /// Identifies the DrawGraphicsControl.Points attached property. 
 
-         /// </summary>
 
-         public static readonly DependencyProperty PointsProperty =
 
-             DependencyProperty.RegisterAttached("Points", typeof(PointCollection), typeof(DrawGraphicsControl));
 
-         #region 起始坐标轴
 
-         public double WavePlotOriginX
 
-         {
 
-             get { return (double)GetValue(WavePlotOriginXProperty); }
 
-             set { SetValue(WavePlotOriginXProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty WavePlotOriginXProperty =
 
-             DependencyProperty.Register("WavePlotOriginX", typeof(double), typeof(DrawGraphicsControl), new PropertyMetadata(0.0));
 
-         public double WavePlotOriginY
 
-         {
 
-             get { return (double)GetValue(WavePlotOriginYProperty); }
 
-             set { SetValue(WavePlotOriginYProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty WavePlotOriginYProperty =
 
-             DependencyProperty.Register("WavePlotOriginY", typeof(double), typeof(DrawGraphicsControl), new PropertyMetadata(0.0));
 
-         public double WavePlotOriginWidth
 
-         {
 
-             get { return (double)GetValue(WavePlotOriginWidthProperty); }
 
-             set { SetValue(WavePlotOriginWidthProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty WavePlotOriginWidthProperty =
 
-            DependencyProperty.Register("WavePlotOriginWidth", typeof(double), typeof(DrawGraphicsControl), new PropertyMetadata(1000.0));
 
-         public double WavePlotOriginHeight
 
-         {
 
-             get { return (double)GetValue(WavePlotOriginHeightProperty); }
 
-             set { SetValue(WavePlotOriginHeightProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty WavePlotOriginHeightProperty =
 
-             DependencyProperty.Register("WavePlotOriginHeight", typeof(double), typeof(DrawGraphicsControl), new PropertyMetadata(1000.0));
 
-         #endregion
 
-         public bool IsHorizontalNavigationEnabled
 
-         {
 
-             get { return (bool)GetValue(IsHorizontalNavigationEnabledProperty); }
 
-             set { SetValue(IsHorizontalNavigationEnabledProperty, value); }
 
-         }
 
-         /// <summary>Identifies <see cref="IsHorizontalNavigationEnabled"/> property</summary>
 
-         public static readonly DependencyProperty IsHorizontalNavigationEnabledProperty =
 
-             DependencyProperty.Register("IsHorizontalNavigationEnabled", typeof(bool), typeof(DrawGraphicsControl), new PropertyMetadata(true));
 
-         public bool IsVerticalNavigationEnabled
 
-         {
 
-             get { return (bool)GetValue(IsVerticalNavigationEnabledProperty); }
 
-             set { SetValue(IsVerticalNavigationEnabledProperty, value); }
 
-         }
 
-         /// <summary>Identifies <see cref="IsVerticalNavigationEnabled"/> property</summary>
 
-         public static readonly DependencyProperty IsVerticalNavigationEnabledProperty =
 
-             DependencyProperty.Register("IsVerticalNavigationEnabled", typeof(bool), typeof(DrawGraphicsControl), new PropertyMetadata(true));
 
-         public bool IsHorizontalDateTimeAxis
 
-         {
 
-             get { return (bool)GetValue(IsHorizontalDateTimeAxisProperty); }
 
-             set { SetValue(IsHorizontalDateTimeAxisProperty, value); }
 
-         }
 
-         /// <summary>Identifies <see cref="IsVerticalNavigationEnabled"/> property</summary>
 
-         public static readonly DependencyProperty IsHorizontalDateTimeAxisProperty =
 
-             DependencyProperty.Register("IsHorizontalDateTimeAxis", typeof(bool), typeof(DrawGraphicsControl), new PropertyMetadata(false));
 
-         #endregion Property
 
-         public DrawGraphicsControl()
 
-         {
 
-             InitializeComponent();
 
-             m_PenLine = new System.Drawing.Pen(System.Drawing.Brushes.Black, 1);
 
-             m_PenLightGray = new System.Drawing.Pen(System.Drawing.Brushes.DarkGray, 1);
 
-             m_PenBlue = new System.Drawing.Pen(System.Drawing.Brushes.DarkBlue, 1);
 
-             m_PenData = new System.Drawing.Pen(System.Drawing.Brushes.Green, 1);
 
-             m_PenSData = new System.Drawing.Pen(System.Drawing.Brushes.Blue, 1);
 
-             m_PenASData = new System.Drawing.Pen(System.Drawing.Brushes.Red, 1);
 
-             m_PenCollencteions = new System.Drawing.Pen[]
 
-             {
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Green,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Red,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Blue,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Orange,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Yellow,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.YellowGreen,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.AliceBlue,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Chocolate,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Cyan,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.DarkGreen,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.LightBlue,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.DarkBlue,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Pink,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.DarkViolet,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Cyan,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.HotPink,LineThickness),
 
-             };
 
-             IsHorizontalNavigationEnabled = false;
 
-             IsVerticalNavigationEnabled = false;
 
-         }
 
-         #region Public
 
-         public void ResetCoordinate()
 
-         {
 
-             m_WavePlotX = WavePlotOriginX;
 
-             m_WavePlotY = WavePlotOriginY;
 
-             m_WavePlotWidth = WavePlotOriginWidth;
 
-             m_WavePlotHeight = WavePlotOriginHeight;
 
-             GraphicDraw();
 
-         }
 
-         public void ResetControl()
 
-         {
 
-             GraphicDraw();
 
-         }
 
-         public void FitControl()
 
-         {
 
-             if (!double.IsNaN(m_WavePlotMinX) && !double.IsNaN(m_WavePlotMaxX) && !double.IsNaN(m_WavePlotMinY) && !double.IsNaN(m_WavePlotMaxY)
 
-                 && m_WavePlotMinX != double.MaxValue && m_WavePlotMaxX != double.MinValue && m_WavePlotMinY != double.MaxValue && m_WavePlotMaxY != double.MinValue)
 
-             {
 
-                 m_WavePlotX = m_WavePlotMinX;
 
-                 m_WavePlotWidth = m_WavePlotMaxX - m_WavePlotMinX;
 
-                 m_WavePlotY = m_WavePlotMinY-1;
 
-                 m_WavePlotHeight = m_WavePlotMaxY - m_WavePlotMinY+2;
 
-                 GraphicDraw();
 
-             }
 
-         }
 
-         public void FitControlWithoutDrawing()
 
-         {
 
-             m_WavePlotX = m_WavePlotMinX;
 
-             m_WavePlotWidth = m_WavePlotMaxX - m_WavePlotMinX;
 
-             m_WavePlotY = m_WavePlotMinY - 1;
 
-             m_WavePlotHeight = m_WavePlotMaxY - m_WavePlotMinY + 2;
 
-         }
 
-         public void ClearPlot()
 
-         {
 
-             Points = new PointCollection();
 
-         }
 
-         public void ClearPlotPoints()
 
-         {
 
-             PointCollections = new List<PointCollection>();
 
-         }
 
-         public void Plot(IEnumerable x, IEnumerable y, int count = 0)
 
-         {
 
-             if (x == null || y == null) return;
 
-             if (Points == null || count == 0) Points = new PointCollection();
 
-             var enx = x.GetEnumerator();
 
-             var eny = y.GetEnumerator();
 
-             while (true)
 
-             {
 
-                 var nx = enx.MoveNext();
 
-                 var ny = eny.MoveNext();
 
-                 if (nx && ny)
 
-                     Points.Add(new System.Windows.Point(Convert.ToSingle(enx.Current, CultureInfo.InvariantCulture),
 
-                         Convert.ToSingle(eny.Current, CultureInfo.InvariantCulture)));
 
-                 else if (!nx && !ny)
 
-                     break;
 
-                 else
 
-                     throw new ArgumentException("x and y have different lengthes");
 
-                 if (count > 0 && Points.Count > count) Points.RemoveAt(0);
 
-             }
 
-         }
 
-         public void PlotY(IEnumerable y, int count = 0)
 
-         {
 
-             if (y == null) return;
 
-             if (Points == null || count == 0) Points = new PointCollection();
 
-             int x = 0;
 
-             var en = y.GetEnumerator();
 
-             while (en.MoveNext())
 
-             {
 
-                 Points.Add(new System.Windows.Point(x++, Convert.ToSingle(en.Current, CultureInfo.InvariantCulture)));
 
-                 if (count > 0 && Points.Count > count) Points.RemoveAt(0);
 
-             }
 
-         }
 
-         public void PlotPoints(IEnumerable x, IEnumerable y, int count = 0)
 
-         {
 
-             if (x == null || y == null)
 
-             {
 
-                 PointCollections = new List<PointCollection>();
 
-                 return;
 
-             }
 
-             if (PointCollections == null || count == 0) PointCollections = new List<PointCollection>();
 
-             var points = new PointCollection();
 
-             var enx = x.GetEnumerator();
 
-             var eny = y.GetEnumerator();
 
-             while (true)
 
-             {
 
-                 var nx = enx.MoveNext();
 
-                 var ny = eny.MoveNext();
 
-                 if (nx && ny)
 
-                     points.Add(new System.Windows.Point(Convert.ToSingle(enx.Current, CultureInfo.InvariantCulture),
 
-                         Convert.ToSingle(eny.Current, CultureInfo.InvariantCulture)));
 
-                 else if (!nx && !ny)
 
-                     break;
 
-                 else
 
-                     throw new ArgumentException("x and y have different lengthes");
 
-             }
 
-             PointCollections.Add(points);
 
-             if (count > 0 && PointCollections.Count > count) PointCollections.RemoveAt(0);
 
-             PointCollections = PointCollections;
 
-         }
 
-         public void PlotPointYs(IEnumerable y, int count = 0)
 
-         {
 
-             if (y == null) return;
 
-             if (PointCollections == null || count == 0) PointCollections = new List<PointCollection>();
 
-             var points = new PointCollection();
 
-             int x = 0;
 
-             var en = y.GetEnumerator();
 
-             while (en.MoveNext())
 
-             {
 
-                 points.Add(new System.Windows.Point(x++, Convert.ToSingle(en.Current, CultureInfo.InvariantCulture)));
 
-             }
 
-             PointCollections.Add(points);
 
-             if (count > 0 && PointCollections.Count > count) PointCollections.RemoveAt(0);
 
-         }
 
-         public void PlotData(IEnumerable x, IEnumerable y)
 
-         {
 
-             if (x == null || y == null)
 
-             {
 
-                 PlotDataPoints = new PointCollection();
 
-                 return;
 
-             }
 
-             var points = new PointCollection();
 
-             var enx = x.GetEnumerator();
 
-             var eny = y.GetEnumerator();
 
-             while (true)
 
-             {
 
-                 var nx = enx.MoveNext();
 
-                 var ny = eny.MoveNext();
 
-                 if (nx && ny)
 
-                     points.Add(new System.Windows.Point(Convert.ToDouble(enx.Current, CultureInfo.InvariantCulture),
 
-                         Convert.ToDouble(eny.Current, CultureInfo.InvariantCulture)));
 
-                 else if (!nx && !ny)
 
-                     break;
 
-                 else
 
-                     throw new ArgumentException("x and y have different lengthes");
 
-             }
 
-             PlotDataPoints = points;
 
-         }
 
-         public void PlotSData(IEnumerable x, IEnumerable y)
 
-         {
 
-             if (x == null || y == null)
 
-             {
 
-                 PlotSDataPoints = new PointCollection();
 
-                 return;
 
-             }
 
-             var points = new PointCollection();
 
-             var enx = x.GetEnumerator();
 
-             var eny = y.GetEnumerator();
 
-             while (true)
 
-             {
 
-                 var nx = enx.MoveNext();
 
-                 var ny = eny.MoveNext();
 
-                 if (nx && ny)
 
-                     points.Add(new System.Windows.Point(Convert.ToDouble(enx.Current, CultureInfo.InvariantCulture),
 
-                         Convert.ToDouble(eny.Current, CultureInfo.InvariantCulture)));
 
-                 else if (!nx && !ny)
 
-                     break;
 
-                 else
 
-                     throw new ArgumentException("x and y have different lengthes");
 
-             }
 
-             PlotSDataPoints = points;
 
-         }
 
-         public void PlotASData(IEnumerable x, IEnumerable y)
 
-         {
 
-             if (x == null || y == null)
 
-             {
 
-                 PlotASDataPoints = new PointCollection();
 
-                 return;
 
-             }
 
-             var points = new PointCollection();
 
-             var enx = x.GetEnumerator();
 
-             var eny = y.GetEnumerator();
 
-             while (true)
 
-             {
 
-                 var nx = enx.MoveNext();
 
-                 var ny = eny.MoveNext();
 
-                 if (nx && ny)
 
-                     points.Add(new System.Windows.Point(Convert.ToDouble(enx.Current, CultureInfo.InvariantCulture),
 
-                         Convert.ToDouble(eny.Current, CultureInfo.InvariantCulture)));
 
-                 else if (!nx && !ny)
 
-                     break;
 
-                 else
 
-                     throw new ArgumentException("x and y have different lengthes");
 
-             }
 
-             PlotASDataPoints = points;
 
-         }
 
-         /// <summary>
 
-         /// 获取小数位数
 
-         /// </summary>
 
-         /// <param name="decimalV">小数</param>
 
-         /// <returns></returns>
 
-         public int GetNumberOfDecimalPlaces(double decimalV)
 
-         {
 
-             string[] temp = decimalV.ToString().Split('.');
 
-             if (temp.Length == 2 && temp[1].Length > 0)
 
-             {
 
-                 int index = temp[1].Length - 1;
 
-                 while (temp[1][index] == '0' && index-- > 0) ;
 
-                 return index + 1;
 
-             }
 
-             return 0;
 
-         }
 
-         #endregion Public
 
-         #region Private Draw
 
-         //public void GraphicDrawplotsally()
 
-         //{
 
-         //    if (Canvas_Main.ActualWidth <= 0 || Canvas_Main.ActualHeight <= 0) return;
 
-         //    m_WavePlotMinX = double.MaxValue;
 
-         //    m_WavePlotMaxX = double.MinValue;
 
-         //    m_WavePlotMinY = double.MaxValue;
 
-         //    m_WavePlotMaxY = double.MinValue;
 
-         //    using (Bitmap bitmap = new Bitmap((int)Canvas_Main.ActualWidth, (int)Canvas_Main.ActualHeight))
 
-         //    {
 
-         //        Graphics graphics = Graphics.FromImage(bitmap);
 
-         //        if (m_WavePlotHeight < Math.Pow(10, -4))
 
-         //        {
 
-         //            double Min = m_WavePlotY;
 
-         //            double Max = m_WavePlotY + m_WavePlotHeight;
 
-         //            double delta = (Max - Min) / 2;
 
-         //            double center = (Max + Min) / 2;
 
-         //            Min = center - delta * 1.2;
 
-         //            Max = center + delta * 1.2;
 
-         //            m_WavePlotY = Min;
 
-         //            m_WavePlotHeight = Max - Min;
 
-         //        }
 
-         //    }
 
-         //}
 
-         private void GraphicDraw()
 
-         {
 
-             if (Canvas_Main.ActualWidth <= 0 || Canvas_Main.ActualHeight <= 0) return;
 
-             m_WavePlotMinX = double.MaxValue;
 
-             m_WavePlotMaxX = double.MinValue;
 
-             m_WavePlotMinY = double.MaxValue;
 
-             m_WavePlotMaxY = double.MinValue;
 
-             using (Bitmap bitmap = new Bitmap((int)Canvas_Main.ActualWidth, (int)Canvas_Main.ActualHeight))
 
-             {
 
-                 Graphics graphics = Graphics.FromImage(bitmap);
 
-                 //纵坐标 
 
-                 if (m_WavePlotHeight < Math.Pow(10, -4))
 
-                 {
 
-                     double Min = m_WavePlotY;
 
-                     double Max = m_WavePlotY + m_WavePlotHeight;
 
-                     double delta = (Max - Min) / 2;
 
-                     double center = (Max + Min) / 2;
 
-                     Min = center - delta * 1.2;
 
-                     Max = center + delta * 1.2;
 
-                     m_WavePlotY = Min;
 
-                     m_WavePlotHeight = Max - Min;
 
-                 }
 
-                 if (m_WavePlotHeight > Math.Pow(10, -4))
 
-                 {
 
-                     int IntervalTextY; int ExpCountY;
 
-                     GetIntervalValue(m_WavePlotY, m_WavePlotY + m_WavePlotHeight, out IntervalTextY, out ExpCountY);
 
-                     int StartIndexY = (int)(m_WavePlotY / (IntervalTextY * Math.Pow(10, ExpCountY)));
 
-                     int EndIndexY = (int)((m_WavePlotY + m_WavePlotHeight) / (IntervalTextY * Math.Pow(10, ExpCountY)));
 
-                     int DrawStringLength = 0;
 
-                     //寻找显示最长字符串
 
-                     for (int i = StartIndexY; i <= EndIndexY; i++)
 
-                     {
 
-                         if (DrawStringLength < ChangeDataToD((i * IntervalTextY * Math.Pow(10, ExpCountY)).ToString()).ToString().Length) DrawStringLength = ChangeDataToD((i * IntervalTextY * Math.Pow(10, ExpCountY)).ToString()).ToString().Length;
 
-                     }
 
-                     m_StartDrawLineX = (DrawStringLength + 5) * 5;
 
-                     for (int i = StartIndexY; i <= EndIndexY; i++)
 
-                     {
 
-                         if (i == StartIndexY && (i * IntervalTextY * Math.Pow(10, ExpCountY)) < m_WavePlotY) continue;
 
-                         if (i == EndIndexY && (i * IntervalTextY * Math.Pow(10, ExpCountY)) > m_WavePlotY + m_WavePlotHeight) continue;
 
-                         double Y = Canvas_Main.ActualHeight - 50 - ((Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight) * (i * IntervalTextY * Math.Pow(10, ExpCountY) - m_WavePlotY);
 
-                         if (Y < 0) Y = 0;
 
-                         if (Y > Canvas_Main.ActualHeight - 50) Y = Canvas_Main.ActualHeight - 50;
 
-                         graphics.DrawLine(m_PenLightGray, new PointF((float)m_StartDrawLineX, (float)Y), new PointF((float)(Canvas_Main.ActualWidth), (float)Y));
 
-                         graphics.DrawLine(m_PenLine, new PointF((float)m_StartDrawLineX, (float)Y), new PointF((float)m_StartDrawLineX - 10, (float)Y));
 
-                         graphics.DrawString(ChangeDataToD((i * IntervalTextY * Math.Pow(10, ExpCountY)).ToString()).ToString(), System.Drawing.SystemFonts.DefaultFont, m_BrushText, new PointF(0, (float)(Y - 5)));
 
-                     }
 
-                 }
 
-                 //横坐标
 
-                 if (m_WavePlotWidth < Math.Pow(10, -4))
 
-                 {
 
-                     double Min = m_WavePlotX;
 
-                     double Max = m_WavePlotX + m_WavePlotWidth;
 
-                     double delta = (Max - Min) / 2;
 
-                     double center = (Max + Min) / 2;
 
-                     Min = center - delta * 1.2;
 
-                     Max = center + delta * 1.2;
 
-                     m_WavePlotX = Min;
 
-                     m_WavePlotWidth = Max - Min;
 
-                 }
 
-                 if (m_WavePlotWidth > Math.Pow(10, -4))
 
-                 {
 
-                     int IntervalTextX; int ExpCountX;
 
-                     GetIntervalValue(m_WavePlotX, m_WavePlotX + m_WavePlotWidth, out IntervalTextX, out ExpCountX);
 
-                     int StartIndexX = (int)(m_WavePlotX / (IntervalTextX * Math.Pow(10, ExpCountX)));
 
-                     int EndIndexX = (int)((m_WavePlotX + m_WavePlotWidth) / (IntervalTextX * Math.Pow(10, ExpCountX)));
 
-                     for (int i = StartIndexX; i <= EndIndexX; i++)
 
-                     {
 
-                         if (i == StartIndexX && (i * IntervalTextX * Math.Pow(10, ExpCountX)) < m_WavePlotX) continue;
 
-                         if (i == EndIndexX && (i * IntervalTextX * Math.Pow(10, ExpCountX)) > m_WavePlotX + m_WavePlotWidth) continue;
 
-                         double X = m_StartDrawLineX + ((Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth) * (i * IntervalTextX * Math.Pow(10, ExpCountX) - m_WavePlotX);
 
-                         if (X < m_StartDrawLineX) X = m_StartDrawLineX;
 
-                         if (X > Canvas_Main.ActualWidth) X = Canvas_Main.ActualWidth;
 
-                         graphics.DrawLine(m_PenLightGray, new PointF((float)X, 0), new PointF((float)X, (float)Canvas_Main.ActualHeight - 50));
 
-                         graphics.DrawLine(m_PenLine, new PointF((float)X, (float)Canvas_Main.ActualHeight - 30), new PointF((float)X, (float)Canvas_Main.ActualHeight - 50));
 
-                         if (IsHorizontalDateTimeAxis)
 
-                         {
 
-                             graphics.DrawString(DateTime.FromOADate((double)ChangeDataToD((i * IntervalTextX * Math.Pow(10, ExpCountX)).ToString())).ToString("yyyy-MM-dd HH:mm:ss"), System.Drawing.SystemFonts.DefaultFont, m_BrushText, new PointF((float)X - 10, (float)Canvas_Main.ActualHeight - 30));
 
-                         }
 
-                         else
 
-                         {
 
-                             graphics.DrawString(ChangeDataToD((i * IntervalTextX * Math.Pow(10, ExpCountX)).ToString()).ToString(), System.Drawing.SystemFonts.DefaultFont, m_BrushText, new PointF((float)X - 10, (float)Canvas_Main.ActualHeight - 30));
 
-                         }
 
-                     }
 
-                 }
 
-                 //画边框
 
-                 graphics.DrawLine(m_PenLine, new PointF((float)m_StartDrawLineX, 0), new PointF((float)m_StartDrawLineX, (float)Canvas_Main.ActualHeight - 50));
 
-                 graphics.DrawLine(m_PenLine, new PointF((float)m_StartDrawLineX, 0), new PointF((float)(Canvas_Main.ActualWidth), 0));
 
-                 graphics.DrawLine(m_PenLine, new PointF((float)m_StartDrawLineX, (float)(Canvas_Main.ActualHeight - 50)), new PointF((float)Canvas_Main.ActualWidth, (float)(Canvas_Main.ActualHeight - 50)));
 
-                 graphics.DrawLine(m_PenLine, new PointF((float)Canvas_Main.ActualWidth - 1, 0), new PointF((float)Canvas_Main.ActualWidth - 1, (float)(Canvas_Main.ActualHeight - 50)));
 
-                
 
-                 if (this.PlotDataPoints != null && this.PlotDataPoints.Count > 0)
 
-                 {
 
-                     List<PointF> points = new List<PointF>();
 
-                     for (int i = 0; i < PlotDataPoints.Count; i++)
 
-                     {
 
-                         if (PlotDataPoints[i].X >= m_WavePlotX && PlotDataPoints[i].X <= m_WavePlotX + m_WavePlotWidth)
 
-                         {
 
-                             double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotDataPoints[i].X - m_WavePlotX);
 
-                             if (StartX < m_StartDrawLineX || PlotDataPoints[i].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                             if (StartX > Canvas_Main.ActualWidth || PlotDataPoints[i].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                             double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotDataPoints[i].Y - m_WavePlotY);
 
-                             if (StartY < 0 || PlotDataPoints[i].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                             if (StartY > Canvas_Main.ActualHeight - 50 || PlotDataPoints[i].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                             points.Add(new PointF((float)StartX, (float)StartY));
 
-                         }
 
-                         if (m_WavePlotMinX == double.MaxValue || m_WavePlotMinX > PlotDataPoints[i].X) m_WavePlotMinX = PlotDataPoints[i].X;
 
-                         if (m_WavePlotMaxX == double.MinValue || m_WavePlotMaxX < PlotDataPoints[i].X) m_WavePlotMaxX = PlotDataPoints[i].X;
 
-                         if (m_WavePlotMinY == double.MaxValue || m_WavePlotMinY > PlotDataPoints[i].Y) m_WavePlotMinY = PlotDataPoints[i].Y;
 
-                         if (m_WavePlotMaxY == double.MinValue || m_WavePlotMaxY < PlotDataPoints[i].Y) m_WavePlotMaxY = PlotDataPoints[i].Y;
 
-                     }
 
-                     if (points.Count > 1 && points.Where(_ => float.IsNaN(_.X) || float.IsNaN(_.Y)).ToList<PointF>().Count == 0) graphics.DrawLines(m_PenData, points.ToArray());
 
-                 }
 
-                 if (this.PlotSDataPoints != null && this.PlotSDataPoints.Count > 0)
 
-                 {
 
-                     List<PointF> points = new List<PointF>();
 
-                     for (int i = 0; i < PlotSDataPoints.Count; i++)
 
-                     {
 
-                         if (PlotSDataPoints[i].X >= m_WavePlotX && PlotSDataPoints[i].X <= m_WavePlotX + m_WavePlotWidth)
 
-                         {
 
-                             double StartX = 50 + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotSDataPoints[i].X - m_WavePlotX);
 
-                             if (StartX < m_StartDrawLineX || PlotSDataPoints[i].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                             if (StartX > Canvas_Main.ActualWidth || PlotSDataPoints[i].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                             double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotSDataPoints[i].Y - m_WavePlotY);
 
-                             if (StartY < 0 || PlotSDataPoints[i].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                             if (StartY > Canvas_Main.ActualHeight - 50 || PlotSDataPoints[i].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                             points.Add(new PointF((float)StartX, (float)StartY));
 
-                         }
 
-                         if (double.IsNaN(m_WavePlotMinX) || m_WavePlotMinX > PlotSDataPoints[i].X) m_WavePlotMinX = PlotSDataPoints[i].X;
 
-                         if (double.IsNaN(m_WavePlotMaxX) || m_WavePlotMaxX < PlotSDataPoints[i].X) m_WavePlotMaxX = PlotSDataPoints[i].X;
 
-                         if (double.IsNaN(m_WavePlotMinY) || m_WavePlotMinY > PlotSDataPoints[i].Y) m_WavePlotMinY = PlotSDataPoints[i].Y;
 
-                         if (double.IsNaN(m_WavePlotMaxY) || m_WavePlotMaxY < PlotSDataPoints[i].Y) m_WavePlotMaxY = PlotSDataPoints[i].Y;
 
-                     }
 
-                     if (points.Count > 1 && points.Where(_ => float.IsNaN(_.X) || float.IsNaN(_.Y)).ToList<PointF>().Count == 0) graphics.DrawLines(m_PenSData, points.ToArray());
 
-                 }
 
-                 if (this.PlotASDataPoints != null && this.PlotASDataPoints.Count > 0)
 
-                 {
 
-                     List<PointF> points = new List<PointF>();
 
-                     for (int i = 0; i < PlotASDataPoints.Count; i++)
 
-                     {
 
-                         if (PlotASDataPoints[i].X >= m_WavePlotX && PlotASDataPoints[i].X <= m_WavePlotX + m_WavePlotWidth)
 
-                         {
 
-                             double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotASDataPoints[i].X - m_WavePlotX);
 
-                             if (StartX < m_StartDrawLineX || PlotASDataPoints[i].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                             if (StartX > Canvas_Main.ActualWidth || PlotASDataPoints[i].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                             double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotASDataPoints[i].Y - m_WavePlotY);
 
-                             if (StartY < 0 || PlotASDataPoints[i].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                             if (StartY > Canvas_Main.ActualHeight - 50 || PlotASDataPoints[i].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                             points.Add(new PointF((float)StartX, (float)StartY));
 
-                         }
 
-                         if (m_WavePlotMinX == double.MaxValue || m_WavePlotMinX > PlotASDataPoints[i].X) m_WavePlotMinX = PlotASDataPoints[i].X;
 
-                         if (m_WavePlotMaxX == double.MinValue || m_WavePlotMaxX < PlotASDataPoints[i].X) m_WavePlotMaxX = PlotASDataPoints[i].X;
 
-                         if (m_WavePlotMinY == double.MaxValue || m_WavePlotMinY > PlotASDataPoints[i].Y) m_WavePlotMinY = PlotASDataPoints[i].Y;
 
-                         if (m_WavePlotMaxY == double.MinValue || m_WavePlotMaxY < PlotASDataPoints[i].Y) m_WavePlotMaxY = PlotASDataPoints[i].Y;
 
-                     }
 
-                     if (points.Count > 1 && points.Where(_ => float.IsNaN(_.X) || float.IsNaN(_.Y)).ToList<PointF>().Count == 0) graphics.DrawLines(m_PenASData, points.ToArray());
 
-                 }
 
-                 if (this.Points != null && this.Points.Count > 0)
 
-                 {
 
-                     List<PointF> points = new List<PointF>();
 
-                     for (int i = 0; i < Points.Count; i++)
 
-                     {
 
-                         if (Points[i].X >= m_WavePlotX && Points[i].X <= m_WavePlotX + m_WavePlotWidth)
 
-                         {
 
-                             double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (Points[i].X - m_WavePlotX);
 
-                             if (StartX < m_StartDrawLineX || Points[i].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                             if (StartX > Canvas_Main.ActualWidth || Points[i].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                             double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (Points[i].Y - m_WavePlotY);
 
-                             if (StartY < 0 || Points[i].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                             if (StartY > Canvas_Main.ActualHeight - 50 || Points[i].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                             points.Add(new PointF((float)StartX, (float)StartY));
 
-                         }
 
-                         if (m_WavePlotMinX == double.MaxValue || m_WavePlotMinX > Points[i].X) m_WavePlotMinX = Points[i].X;
 
-                         if (m_WavePlotMaxX == double.MinValue || m_WavePlotMaxX < Points[i].X) m_WavePlotMaxX = Points[i].X;
 
-                         if (m_WavePlotMinY == double.MaxValue || m_WavePlotMinY > Points[i].Y) m_WavePlotMinY = Points[i].Y;
 
-                         if (m_WavePlotMaxY == double.MinValue || m_WavePlotMaxY < Points[i].Y) m_WavePlotMaxY = Points[i].Y;
 
-                     }
 
-                     if (points.Count > 1 && points.Where(_ => float.IsNaN(_.X) || float.IsNaN(_.Y)).ToList<PointF>().Count == 0) graphics.DrawLines(m_PenData, points.ToArray());
 
-                 }
 
-                 if (this.PointCollections != null && this.PointCollections.Count > 0)
 
-                 {
 
-                     for (int i = 0; i < this.PointCollections.Count; i++)
 
-                     {
 
-                         List<PointF> points = new List<PointF>();
 
-                         for (int j = 0; j < this.PointCollections[i].Count; j++)
 
-                         {
 
-                             if (this.PointCollections[i][j].X >= m_WavePlotX && this.PointCollections[i][j].X <= m_WavePlotX + m_WavePlotWidth)
 
-                             {
 
-                                 double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (this.PointCollections[i][j].X - m_WavePlotX);
 
-                                 if (StartX < m_StartDrawLineX || this.PointCollections[i][j].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                                 if (StartX > Canvas_Main.ActualWidth || this.PointCollections[i][j].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                                 double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (this.PointCollections[i][j].Y - m_WavePlotY);
 
-                                 if (StartY < 0 || this.PointCollections[i][j].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                                 if (StartY > Canvas_Main.ActualHeight - 50 || this.PointCollections[i][j].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                                 points.Add(new PointF((float)StartX, (float)StartY));
 
-                             }
 
-                             if (m_WavePlotMinX == double.MaxValue || m_WavePlotMinX > this.PointCollections[i][j].X) m_WavePlotMinX = this.PointCollections[i][j].X;
 
-                             if (m_WavePlotMaxX == double.MinValue || m_WavePlotMaxX < this.PointCollections[i][j].X) m_WavePlotMaxX = this.PointCollections[i][j].X;
 
-                             if (m_WavePlotMinY == double.MaxValue || m_WavePlotMinY > this.PointCollections[i][j].Y) m_WavePlotMinY = this.PointCollections[i][j].Y;
 
-                             if (m_WavePlotMaxY == double.MinValue || m_WavePlotMaxY < this.PointCollections[i][j].Y) m_WavePlotMaxY = this.PointCollections[i][j].Y;
 
-                         }
 
-                         if (points.Count > 1 && points.Where(_ => float.IsNaN(_.X) || float.IsNaN(_.Y)).ToList<PointF>().Count == 0)
 
-                         {
 
-                             graphics.DrawLines(m_PenCollencteions[i % 10], points.ToArray());
 
-                         }
 
-                     }
 
-                 }
 
-                 //框选
 
-                 if (m_StartMouseMove && m_MouseMove)
 
-                 {
 
-                     if (m_StartPoint != null && m_EndPoint != null)
 
-                     {
 
-                         int x = m_StartPoint.X > m_EndPoint.X ? (int)m_EndPoint.X : (int)m_StartPoint.X;
 
-                         int y = m_StartPoint.Y > m_EndPoint.Y ? (int)m_EndPoint.Y : (int)m_StartPoint.Y;
 
-                         int width = (int)Math.Abs(m_EndPoint.X - m_StartPoint.X);
 
-                         int height = (int)Math.Abs(m_EndPoint.Y - m_StartPoint.Y);
 
-                         System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(x, y, width, height);
 
-                         
 
-                         graphics.FillRectangle(System.Drawing.Brushes.LightGray, rectangle);
 
-                         graphics.DrawRectangle(new System.Drawing.Pen (System.Drawing.Color.Transparent), rectangle);
 
-                     }
 
-                 }
 
-                 else
 
-                 {
 
-                     //拾取坐标
 
-                     if (m_MouseEnter && m_CurrentPoint != null)
 
-                     {
 
-                         double X = m_WavePlotX + (m_CurrentPoint.X - m_StartDrawLineX) / ((this.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth);
 
-                         double Y = m_WavePlotY + (this.ActualHeight - 50 - m_CurrentPoint.Y) / ((this.ActualHeight - 50) / m_WavePlotHeight);
 
-                         if (this.PointCollections == null || this.PointCollections.Count <= 10)
 
-                         {
 
-                             graphics.DrawLine(m_PenBlue, new System.Drawing.PointF((float)m_StartDrawLineX, (float)m_CurrentPoint.Y), new PointF((float)Canvas_Main.ActualWidth, (float)m_CurrentPoint.Y));
 
-                             graphics.DrawLine(m_PenBlue, new System.Drawing.PointF((float)m_CurrentPoint.X, 0), new PointF((float)m_CurrentPoint.X, (float)Canvas_Main.ActualHeight - 50));
 
-                             //if (IsHorizontalDateTimeAxis)
 
-                             //{
 
-                             //    graphics.DrawString(string.Format("X={0};Y={1}", DateTime.FromOADate(X), Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)m_CurrentPoint.X + 10, (float)m_CurrentPoint.Y + 10));
 
-                             //}
 
-                             //else
 
-                             //{
 
-                             //    graphics.DrawString(string.Format("X={0};Y={1}", X.ToString("0.00"), Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)m_CurrentPoint.X + 10, (float)m_CurrentPoint.Y + 10));
 
-                             //}
 
-                         }
 
-                         //
 
-                         if (this.PlotDataPoints != null && this.PlotDataPoints.Count > 0)
 
-                         {
 
-                             if (X >= this.PlotDataPoints[0].X && X <= this.PlotDataPoints[this.PlotDataPoints.Count - 1].X)
 
-                             {
 
-                                 //int index = this.PlotDataX.IndexOf((int)Math.Round(X, 0));
 
-                                 var minDistance = this.PlotDataPoints.Min(x => Math.Abs(x.X - X));
 
-                                 var closest = this.PlotDataPoints.First(x => Math.Abs(Math.Abs(x.X - X) - minDistance) < 0.0001f);
 
-                                 int index = this.PlotDataPoints.IndexOf(closest);
 
-                                 if (index >= 0)
 
-                                 {
 
-                                     double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotDataPoints[index].X - m_WavePlotX);
 
-                                     if (StartX < m_StartDrawLineX || PlotDataPoints[index].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                                     if (StartX > Canvas_Main.ActualWidth || PlotDataPoints[index].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                                     double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotDataPoints[index].Y - m_WavePlotY);
 
-                                     if (StartY < 0 || PlotDataPoints[index].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                                     if (StartY > Canvas_Main.ActualHeight - 50 || PlotDataPoints[index].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                                     if (!double.IsNaN(StartX) && !double.IsNaN(StartY))
 
-                                     {
 
-                                         System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle((int)StartX, (int)StartY, 5, 5);
 
-                                         graphics.FillRectangle(System.Drawing.Brushes.Blue, rectangle);
 
-                                         graphics.DrawEllipse(m_PenBlue, rectangle);
 
-                                         if (IsHorizontalDateTimeAxis)
 
-                                         {
 
-                                             graphics.DrawString(string.Format("X={0};Y={1}", DateTime.FromOADate(PlotDataPoints[index].X), PlotDataPoints[index].Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                         }
 
-                                         else
 
-                                         {
 
-                                             graphics.DrawString(string.Format("X={0};Y={1}", PlotDataPoints[index].X.ToString("0.00"), PlotDataPoints[index].Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                         }
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                         //
 
-                         if (this.PlotSDataPoints != null && this.PlotSDataPoints.Count > 0)
 
-                         {
 
-                             if (X >= this.PlotSDataPoints[0].X && X <= this.PlotSDataPoints[this.PlotSDataPoints.Count - 1].X)
 
-                             {
 
-                                 //int index = this.PlotSDataX.IndexOf((int)Math.Round(X, 0));
 
-                                 var minDistance = this.PlotSDataPoints.Min(x => Math.Abs(x.X - X));
 
-                                 var closest = this.PlotSDataPoints.First(x => Math.Abs(Math.Abs(x.X - X) - minDistance) < 0.0001f);
 
-                                 int index = this.PlotSDataPoints.IndexOf(closest);
 
-                                 if (index >= 0)
 
-                                 {
 
-                                     double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotSDataPoints[index].X - m_WavePlotX);
 
-                                     if (StartX < m_StartDrawLineX || PlotSDataPoints[index].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                                     if (StartX > Canvas_Main.ActualWidth || PlotSDataPoints[index].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                                     double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotSDataPoints[index].Y - m_WavePlotY);
 
-                                     if (StartY < 0 || PlotSDataPoints[index].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                                     if (StartY > Canvas_Main.ActualHeight - 50 || PlotSDataPoints[index].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                                     if (!double.IsNaN(StartX) && !double.IsNaN(StartY))
 
-                                     {
 
-                                         System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle((int)StartX, (int)StartY, 5, 5);
 
-                                         graphics.FillRectangle(System.Drawing.Brushes.Blue, rectangle);
 
-                                         graphics.DrawEllipse(m_PenBlue, rectangle);
 
-                                         graphics.DrawString(string.Format("X={0};Y={1}", PlotSDataPoints[index].X.ToString("0.00"), PlotSDataPoints[index].Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                         //
 
-                         if (this.PlotASDataPoints != null && this.PlotASDataPoints.Count > 0)
 
-                         {
 
-                             if (X >= this.PlotASDataPoints[0].X && X <= this.PlotASDataPoints[this.PlotASDataPoints.Count - 1].X)
 
-                             {
 
-                                 //int index = this.PlotASDataX.IndexOf((int)Math.Round(X, 0));
 
-                                 var minDistance = this.PlotASDataPoints.Min(x => Math.Abs(x.X - X));
 
-                                 var closest = this.PlotASDataPoints.First(x => Math.Abs(x.X - X) == minDistance);
 
-                                 int index = this.PlotASDataPoints.IndexOf(closest);
 
-                                 if (index >= 0)
 
-                                 {
 
-                                     double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotASDataPoints[index].X - m_WavePlotX);
 
-                                     if (StartX < m_StartDrawLineX || PlotASDataPoints[index].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                                     if (StartX > Canvas_Main.ActualWidth || PlotASDataPoints[index].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                                     double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotASDataPoints[index].Y - m_WavePlotY);
 
-                                     if (StartY < 0 || PlotASDataPoints[index].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                                     if (StartY > Canvas_Main.ActualHeight - 50 || PlotASDataPoints[index].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                                     if (!double.IsNaN(StartX) && !double.IsNaN(StartY))
 
-                                     {
 
-                                         System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle((int)StartX, (int)StartY, 5, 5);
 
-                                         graphics.FillRectangle(System.Drawing.Brushes.Blue, rectangle);
 
-                                         graphics.DrawEllipse(m_PenBlue, rectangle);
 
-                                         graphics.DrawString(string.Format("X={0};Y={1}", PlotASDataPoints[index].X.ToString("0.00"), PlotASDataPoints[index].Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                         //
 
-                         if (this.PointCollections != null && this.PointCollections.Count <= 10)
 
-                         {
 
-                             foreach (PointCollection point in this.PointCollections)
 
-                             {
 
-                                 //if (X >= point[0].X && X <= point[point.Count - 1].X)
 
-                                 {
 
-                                     //int index = this.PlotASDataX.IndexOf((int)Math.Round(X, 0));
 
-                                     var minDistance = point.Min(x => Math.Abs(x.X - X));
 
-                                     var closest = point.First(x => Math.Abs(x.X - X) == minDistance);
 
-                                     int index = point.IndexOf(closest);
 
-                                     if (index >= 0)
 
-                                     {
 
-                                         double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (point[index].X - m_WavePlotX);
 
-                                         if (StartX < m_StartDrawLineX || point[index].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                                         if (StartX > Canvas_Main.ActualWidth || point[index].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                                         double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (point[index].Y - m_WavePlotY);
 
-                                         if (StartY < 0 || point[index].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                                         if (StartY > Canvas_Main.ActualHeight - 50 || point[index].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                                         if (!double.IsNaN(StartX) && !double.IsNaN(StartY))
 
-                                         {
 
-                                             System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle((int)StartX, (int)StartY, 5, 5);
 
-                                             graphics.FillRectangle(System.Drawing.Brushes.Blue, rectangle);
 
-                                             graphics.DrawEllipse(m_PenBlue, rectangle);
 
-                                             if (IsHorizontalDateTimeAxis)
 
-                                             {
 
-                                                 graphics.DrawString(string.Format("X={0};Y={1}", DateTime.FromOADate(point[index].X), point[index].Y.ToString("0.00")), new Font("Times New Roman", 15.0F), m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                             }
 
-                                             else
 
-                                             {
 
-                                                 graphics.DrawString(string.Format("X={0};Y={1}", point[index].X.ToString("0.00"), point[index].Y.ToString("0.00")),     new Font("Times New Roman", 15.0F),   m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                             }
 
-                                         }
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-                 ImageBrush_BK.ImageSource = BitmapToBitmapImage(bitmap);
 
-             }
 
-             this.InvalidateVisual();
 
-         }
 
-         #endregion Private Draw
 
-         #region Private
 
-         private void Canvas_Main_SizeChanged(object sender, SizeChangedEventArgs e)
 
-         {
 
-             GraphicDraw();
 
-         }
 
-         private void Canvas_Main_MouseWheel(object sender, MouseWheelEventArgs e)
 
-         {
 
-             double factor = e.Delta < 0 ? 1.2 : 1 / 1.2;
 
-             if (IsVerticalNavigationEnabled)
 
-             {
 
-                 double Min = m_WavePlotY;
 
-                 double Max = m_WavePlotY + m_WavePlotHeight;
 
-                 double delta = (Max - Min) / 2;
 
-                 double center = (Max + Min) / 2;
 
-                 Min = center - delta * factor;
 
-                 Max = center + delta * factor;
 
-                 m_WavePlotY = Min;
 
-                 m_WavePlotHeight = Max - Min;
 
-             }
 
-             if (IsHorizontalNavigationEnabled)
 
-             {
 
-                 double Min = m_WavePlotX;
 
-                 double Max = m_WavePlotX + m_WavePlotWidth;
 
-                 double delta = (Max - Min) / 2;
 
-                 double center = (Max + Min) / 2;
 
-                 Min = center - delta * factor;
 
-                 Max = center + delta * factor;
 
-                 m_WavePlotX = Min;
 
-                 m_WavePlotWidth = Max - Min;
 
-             }
 
-             GraphicDraw();
 
-         }
 
-         private void Canvas_Main_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 
-         {
 
-             this.Cursor = Cursors.Hand;
 
-             if (e.ClickCount == 2)
 
-             {
 
-                 FitControl();
 
-             }
 
-             else
 
-             {
 
-                 m_StartPoint = Mouse.GetPosition(e.Source as FrameworkElement);
 
-                 if (e.LeftButton == MouseButtonState.Pressed)
 
-                 {
 
-                     m_StartMouseMove = true;
 
-                 }//开始绘制矩形
 
-             }
 
-         }
 
-         private void Canvas_Main_MouseMove(object sender, MouseEventArgs e)
 
-         {
 
-             m_EndPoint = Mouse.GetPosition(e.Source as FrameworkElement);
 
-             m_CurrentPoint = Mouse.GetPosition(e.Source as FrameworkElement);
 
-             if ((Keyboard.Modifiers == ModifierKeys.Control || m_MouseMove) && m_StartMouseMove)
 
-             {
 
-                 m_MouseMove = true;
 
-                 GraphicDraw();
 
-             }//移动矩形位置
 
-             else if (m_StartMouseMove)
 
-             {
 
-                 m_WavePlotX = m_WavePlotX - (m_EndPoint.X - m_StartPoint.X) / (this.ActualWidth - 50) * m_WavePlotWidth;
 
-                 m_WavePlotY = m_WavePlotY + (m_EndPoint.Y - m_StartPoint.Y) / (this.ActualHeight - 50) * m_WavePlotHeight;
 
-                 m_StartPoint = m_EndPoint;
 
-                 GraphicDraw();
 
-             }
 
-             else if (this.PointCollections == null || this.PointCollections.Count <= 10)
 
-             {
 
-                 GraphicDraw();
 
-             }
 
-         }
 
-         private void Canvas_Main_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 
-         {
 
-             this.Cursor = Cursors.Arrow;
 
-             if (m_StartMouseMove && m_MouseMove && e.LeftButton == MouseButtonState.Released)
 
-             {
 
-                 m_StartMouseMove = false;
 
-                 m_MouseMove = false;
 
-                 if (m_StartPoint.X == m_EndPoint.X || m_StartPoint.Y == m_EndPoint.Y) return;
 
-                 double x = m_StartPoint.X > m_EndPoint.X ? m_EndPoint.X : m_StartPoint.X;
 
-                 double y = m_StartPoint.Y < m_EndPoint.Y ? m_EndPoint.Y : m_StartPoint.Y;
 
-                 double width = Math.Abs(m_EndPoint.X - m_StartPoint.X);
 
-                 double height = Math.Abs(m_EndPoint.Y - m_StartPoint.Y);
 
-                 //设置坐标轴起始位置
 
-                 this.m_WavePlotX = this.m_WavePlotX + (x - m_StartDrawLineX) / ((this.ActualWidth - m_StartDrawLineX) / this.m_WavePlotWidth);
 
-                 this.m_WavePlotY = this.m_WavePlotY + (this.ActualHeight - 50 - y) / ((this.ActualHeight - 50) / this.m_WavePlotHeight);
 
-                 this.m_WavePlotWidth = this.m_WavePlotWidth * (width / (this.ActualWidth - m_StartDrawLineX));
 
-                 this.m_WavePlotHeight = this.m_WavePlotHeight * (height / (this.ActualHeight - 50));
 
-                 GraphicDraw();
 
-             }//结束绘制矩形
 
-             m_StartMouseMove = false;
 
-             m_MouseMove = false;
 
-         }
 
-         private void Canvas_Main_MouseEnter(object sender, MouseEventArgs e)
 
-         {
 
-             if (this.PointCollections == null || this.PointCollections.Count <= 10)
 
-             {
 
-                 m_MouseEnter = true;
 
-             } 
 
-         }
 
-         private void Canvas_Main_MouseLeave(object sender, MouseEventArgs e)
 
-         {
 
-             if (this.PointCollections == null || this.PointCollections.Count <= 10) m_MouseEnter = false;
 
-             GraphicDraw();
 
-         }
 
-         private void Canvas_Main_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
 
-         {
 
-             m_WavePlotX = WavePlotOriginX;
 
-             m_WavePlotY = WavePlotOriginY;
 
-             m_WavePlotWidth = WavePlotOriginWidth;
 
-             m_WavePlotHeight = WavePlotOriginHeight;
 
-             ResetControl();
 
-         }
 
-         /// <summary>
 
-         /// 获取坐标间隔
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private void GetIntervalValue(double min, double max, out int IntervalValue, out int expCount)
 
-         {
 
-             IntervalValue = 0;
 
-             expCount = 0;
 
-             double ActualValue = Math.Abs(max - min);
 
-             if (ActualValue < 1)
 
-             {
 
-                 while (ActualValue < 1)
 
-                 {
 
-                     ActualValue *= 10;
 
-                     expCount -= 1;
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 while (ActualValue >= 10)
 
-                 {
 
-                     ActualValue /= 10;
 
-                     expCount += 1;
 
-                 }
 
-             }
 
-             if (ActualValue <= 1.2)
 
-             {
 
-                 IntervalValue = 1;
 
-                 expCount -= 1;
 
-             }
 
-             else if (ActualValue <= 3)
 
-             {
 
-                 IntervalValue = 2;
 
-                 expCount -= 1;
 
-             }
 
-             else if (ActualValue <= 5)
 
-             {
 
-                 IntervalValue = 5;
 
-                 expCount -= 1;
 
-             }
 
-             else
 
-             {
 
-                 IntervalValue = 1;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 字符串值中包含E等科学计数法
 
-         /// </summary>
 
-         /// <param name="strData"></param>
 
-         /// <returns></returns>
 
-         private Decimal ChangeDataToD(string strData)
 
-         {
 
-             Decimal dData = 0.0M;
 
-             if (strData.ToString().Contains("E"))
 
-             {
 
-                 dData = Decimal.Parse(strData, System.Globalization.NumberStyles.Float);
 
-             }
 
-             else
 
-             {
 
-                 dData = Decimal.Parse(strData);
 
-             }
 
-             return dData;
 
-         }
 
-         /// <summary>
 
-         /// Bitmap --> BitmapImage
 
-         /// </summary>
 
-         /// <param name="bitmap"></param>
 
-         /// <returns></returns>
 
-         private BitmapImage BitmapToBitmapImage(Bitmap bitmap)
 
-         {
 
-             using (MemoryStream stream = new MemoryStream())
 
-             {
 
-                 bitmap.Save(stream, ImageFormat.Png); // 坑点:格式选Bmp时,不带透明度
 
-                 stream.Position = 0;
 
-                 BitmapImage result = new BitmapImage();
 
-                 result.BeginInit();
 
-                 // According to MSDN, "The default OnDemand cache option retains access to the stream until the image is needed."
 
-                 // Force the bitmap to load right now so we can dispose the stream.
 
-                 result.CacheOption = BitmapCacheOption.OnLoad;
 
-                 result.StreamSource = stream;
 
-                 result.EndInit();
 
-                 result.Freeze();
 
-                 return result;
 
-             }
 
-         }
 
-         #endregion Private
 
-     }
 
- }
 
 
  |