Exemple #1
0
 /// <summary>
 /// Draw line with the width and height scale.
 /// </summary>
 public static void Draw(Graphics g, Point pos, System.Drawing.PointF[] points, System.Drawing.Color color, float wScale, float hScale, float opacity = 1, float width = 1, Charting.Base.LineDrawPattern linePattern = Charting.Base.LineDrawPattern.SOLID)
 {
     if (g != null)
     {
         Pen pen = new Pen(BrushMaker.SetOpacity(color, opacity), width);
         if (linePattern != Charting.Base.LineDrawPattern.SOLID)
         {
             pen.DashPattern = Charting.Base.GetLineDrawPattern.ForD2D1(linePattern);
         }
         g.TranslateTransform(pos.X, pos.Y);
         g.ScaleTransform(wScale, hScale);
         g.DrawLines(pen, points);
     }
 }
Exemple #2
0
        /// <summary>
        /// Draw line with the data point collection.
        /// </summary>
        public static void Draw(Graphics g, Point pos, Charting.Base.DataPointCollection points, float xAxesCenterHeight, float yAxesCenterWidth, float HeightRate, float WidthRate, float xAxesMaxValue, System.Drawing.Color color, float opacity = 1, bool autoShift = true, bool keepInRightOfYAxis = false, float width = 1, Charting.Base.LineDrawPattern linePattern = Charting.Base.LineDrawPattern.SOLID)
        {
            PointF[] tmpPointArray;
            float    MinX;
            float    tmpYAxesCenterWidth = yAxesCenterWidth;

            tmpPointArray = DrawingBase.Convertor.convertDataPointToPointFArray(points, HeightRate, WidthRate, out MinX);
            if (tmpPointArray.Length > 1)
            {
                if (autoShift)
                {
                    if (points.GetLast().XValue > xAxesMaxValue)
                    {
                        tmpYAxesCenterWidth = -((float)points.GetLast().XValue - xAxesMaxValue) * WidthRate + yAxesCenterWidth;
                    }
                    else
                    {
                        tmpYAxesCenterWidth = -tmpPointArray[0].X + yAxesCenterWidth;
                    }
                }
                if (keepInRightOfYAxis)
                {
                    if (MinX < 0)
                    {
                        tmpYAxesCenterWidth = tmpYAxesCenterWidth - MinX;
                    }
                }
                var oldTrans = g.Transform;
                g.TranslateTransform(tmpYAxesCenterWidth + pos.X, xAxesCenterHeight + pos.Y);
                Pen pen = new Pen(BrushMaker.SetOpacity(color, opacity), width);
                if (linePattern != Charting.Base.LineDrawPattern.SOLID)
                {
                    pen.DashPattern = Charting.Base.GetLineDrawPattern.ForD2D1(linePattern);
                }
                g.DrawLines(pen, tmpPointArray);
                //g.TranslateTransform(-tmpYAxesCenterWidth, -xAxesCenterHeight);
                g.Transform = oldTrans;
            }
        }
Exemple #3
0
 /// <summary>
 /// Draw the Line.
 /// </summary>
 public static void Draw(Graphics g, Point pos, System.Drawing.PointF[] points, System.Drawing.Color color, float opacity = 1, float width = 1, Charting.Base.LineDrawPattern linePattern = Charting.Base.LineDrawPattern.SOLID)
 {
     try
     {
         Pen pen = new Pen(BrushMaker.SetOpacity(color, opacity), width);
         if (linePattern != Charting.Base.LineDrawPattern.SOLID)
         {
             pen.DashPattern = Charting.Base.GetLineDrawPattern.ForD2D1(linePattern);
             pen.DashOffset  = width;
         }
         g.TranslateTransform(pos.X, pos.Y);
         g.DrawLines(pen, points);
         g.ResetTransform();
     }
     catch { }
 }