Пример #1
0
        protected virtual void DrawSeries(Graphics g, Color color, UILineSeries series)
        {
            if (series.Points.Count == 0)
            {
                return;
            }

            if (series.Points.Count == 1 && series.Symbol == UILinePointSymbol.None)
            {
                g.DrawPoint(color, series.Points[0], 4);
                return;
            }

            using (Pen pen = new Pen(color, series.Width))
            {
                g.SetHighQuality();
                if (series.Smooth)
                {
                    g.DrawCurve(pen, series.Points.ToArray());
                }
                else
                {
                    g.DrawLines(pen, series.Points.ToArray());
                }
                g.SetDefaultQuality();
            }
        }
Пример #2
0
 public UILineSeries AddSeries(UILineSeries series)
 {
     if (series.Name.IsNullOrEmpty())
     {
         return(null);
     }
     series.Index = Series.Count;
     Series.TryAdd(series.Name, series);
     return(series);
 }
Пример #3
0
        public UILineSeries AddSeries(string name)
        {
            if (name.IsNullOrEmpty())
            {
                return(null);
            }
            UILineSeries series = new UILineSeries(name);

            AddSeries(series);
            return(series);
        }
Пример #4
0
        public UILineSeries AddSeries(string seriesName, bool isY2 = false)
        {
            if (seriesName.IsNullOrEmpty())
            {
                return(null);
            }
            UILineSeries series = new UILineSeries(seriesName, isY2);

            AddSeries(series);
            return(series);
        }
Пример #5
0
        protected virtual void DrawSeries(Graphics g, Color color, UILineSeries series)
        {
            if (series.Points.Count == 0 || !series.Visible)
            {
                return;
            }

            if (series.Points.Count == 1)
            {
                g.DrawPoint(color, series.Points[0], 4);
                return;
            }

            if (series.Points.Count == 2)
            {
                using (Pen pen = new Pen(color, series.Width))
                {
                    g.DrawTwoPoints(pen, series.Points[0], series.Points[1], DrawRect);
                }

                return;
            }

            if (series.ShowLine || series.Symbol == UILinePointSymbol.None)
            {
                using (Pen pen = new Pen(color, series.Width))
                {
                    g.SetHighQuality();
                    //if (series.ContainsNan || !series.Smooth)
                    //{
                    for (int i = 0; i < series.Points.Count - 1; i++)
                    {
                        g.DrawTwoPoints(pen, series.Points[i], series.Points[i + 1], DrawRect);
                    }
                    //}
                    //else
                    //{
                    //    g.DrawCurve(pen, series.Points.ToArray());
                    //}

                    g.SetDefaultQuality();
                }
            }
        }