///<summary>
        ///Renders the Column type Sparkline.
        ///</summary>
        ///<param name="paint">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param>
        ///<param name="sparkline">The Sparkline.</param>
        public void DrawSparkColumn(Graphics paint, Syncfusion.Windows.Forms.Chart.SparkLine sparkline)
        {
            int             areaMarginX = 3;
            int             areaMarginY = 3;
            var             isNegative = false;
            int             centerY = sparkline.ControlHeight / 2;
            double          firstPointX = 0, firstPointY = 0;
            double          areaWidth       = sparkline.ControlWidth - areaMarginX * areaMarginX;
            double          areaHeight      = sparkline.ControlHeight - areaMarginY * areaMarginX;
            SparkLineSource sparkLineSource = new SparkLineSource();
            var             sourceList      = (List <object>)sparkLineSource.GetSourceList(sparkline.Source, sparkline);

            if (sourceList.Count == 0)
            {
                return;
            }

            double lineInterval = areaWidth / (sourceList.Count);
            double lineRange    = sparkline.HighPoint - 0;
            int    valueY       = 0;

            sparkline.NegativeItem = new double[sourceList.Count];

            for (int k = 0; k < sourceList.Count; k++)
            {
                double Value = Convert.ToDouble(sourceList[k]);
                valueY = (int)Math.Abs(Value);
                if (Value < 0)
                {
                    isNegative = true;
                }

                firstPointX = this.Sparkline.Location.X + lineInterval * k + (lineInterval / 2);
                firstPointY = this.Sparkline.Location.Y + (areaHeight * Value / lineRange);
                if (!isNegative)
                {
                    if (Value > 0)
                    {
                        Rectangle rect     = new Rectangle(((int)(areaMarginX + firstPointX - lineInterval / 2)), (int)(areaHeight - firstPointY), (int)(lineInterval), (int)Math.Abs(Value));
                        BrushInfo interior = GetInteriorColumn(Value, sparkline, isNegative);
                        rect.Y = rect.Y - (int)Math.Abs(Value);
                        BrushPaint.FillRectangle(paint, rect, interior);
                    }
                }
                else
                {
                    lineRange   = sparkline.HighPoint - sparkline.LowPoint;
                    firstPointX = this.Sparkline.Location.X + lineInterval * k + (lineInterval / 2);
                    firstPointY = this.Sparkline.Location.Y + (areaHeight * Value / lineRange);
                    Rectangle rect     = new Rectangle((int)(areaMarginX + firstPointX - lineInterval / 2 + sparkline.ColumnStyle.ColumnSpace), (int)(firstPointY + areaMarginY), (int)(lineInterval), (int)Math.Abs(Value));
                    BrushInfo interior = GetInteriorColumn(Value, sparkline, isNegative);
                    BrushPaint.FillRectangle(paint, rect, interior);
                }
            }
        }
        ///<summary>
        ///Renders the Column type Sparkline.
        ///</summary>
        ///<param name="paint">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param>
        ///<param name="sparkline">The spakrline.</param>
        public void DrawSparkWinLossColumn(Graphics paint, Syncfusion.Windows.Forms.Chart.SparkLine sparkline)
        {
            SparkLineSource sparkLineSource = new SparkLineSource();
            int             areaMarginX     = 3;
            int             areaMarginY     = 3;
            var             sourceList      = (List <object>)sparkLineSource.GetSourceList(sparkline.Source, sparkline);

            if (sourceList.Count > 0)
            {
                double areaWidth  = sparkline.ControlWidth - areaMarginX * 2;
                double areaHeight = sparkline.ControlHeight - areaMarginY * 2;

                double areaHeightCenter = areaHeight / 2;
                int    valueY = 0, pointY = 0;
                double lineInterval = areaWidth / (sourceList.Count);

                for (int i = 0; i < sourceList.Count; i++)
                {
                    double Value       = Convert.ToDouble(sourceList[i]);
                    double firstPointX = this.Sparkline.Location.X + lineInterval * i + (lineInterval / 2);
                    double firstPointY = this.Sparkline.Location.Y + (lineInterval / 2);
                    if (Value > 0)
                    {
                        valueY = (int)Math.Abs(Value);
                        Rectangle rect     = new Rectangle((int)(areaMarginX + firstPointX - lineInterval / 2 + sparkline.ColumnStyle.ColumnSpace), (int)(firstPointY + lineInterval), (int)(lineInterval - sparkline.ColumnStyle.ColumnSpace * 2), (int)Math.Abs(Value));
                        BrushInfo interior = GetInteriorWinLoss(Value, sparkline);
                        rect.Y = rect.Y - (int)Math.Abs(Value);
                        BrushPaint.FillRectangle(paint, rect, interior);
                        pointY = rect.Y + (int)Math.Abs(Value);
                    }
                    else
                    {
                        Rectangle rect     = new Rectangle((int)(areaMarginX + firstPointX - lineInterval / 2 + sparkline.ColumnStyle.ColumnSpace), pointY, (int)(lineInterval - sparkline.ColumnStyle.ColumnSpace * 2), (int)Math.Abs(Value));
                        BrushInfo interior = GetInteriorWinLoss(Value, sparkline);
                        BrushPaint.FillRectangle(paint, rect, interior);
                    }
                }
            }
        }
        /// <summary>
        /// Get interior BrushInfo points.
        /// </summary>
        /// <param name="curValue">The current value of the cell.</param>
        /// <param name="sparkline">The sparkline</param>
        /// <param name="isNegative">The value indicating whether the source value is negative or not.</param>
        /// <returns>returns the BrushInfo interior</returns>
        private BrushInfo GetInteriorColumn(double curValue, Syncfusion.Windows.Forms.Chart.SparkLine sparkline, bool isNegative)
        {
            BrushInfo interior = sparkline.ColumnStyle.ColumnColor;

            if (Convert.ToDouble(curValue) == sparkline.StartPoint && sparkline.Markers.ShowStartPoint)
            {
                interior = sparkline.Markers.StartPointColor;
            }
            if (Convert.ToDouble(curValue) == sparkline.EndPoint && sparkline.Markers.ShowEndPoint)
            {
                interior = sparkline.Markers.EndPointColor;
            }

            int count = sparkline.GetNegativePoint().GetUpperBound(0);

            if (isNegative)
            {
                for (int index = 0; index <= count; index++)
                {
                    if (Convert.ToDouble(curValue) == (double)sparkline.GetNegativePoint().GetValue(index) && sparkline.Markers.ShowNegativePoint)
                    {
                        interior = sparkline.Markers.NegativePointColor;
                    }
                }
            }

            if (Convert.ToDouble(curValue) == sparkline.HighPoint && sparkline.Markers.ShowHighPoint)
            {
                interior = sparkline.Markers.HighPointColor;
            }
            if (Convert.ToDouble(curValue) == sparkline.LowPoint && sparkline.Markers.ShowLowPoint)
            {
                interior = sparkline.Markers.LowPointColor;
            }
            return(interior);
        }
        ///<summary>
        ///Renders the line type Sparkline.
        ///</summary>
        ///<param name="graphics">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param>
        ///<param name="sparkline">The Sparkline.</param>
        public void DrawSparkline(Graphics graphics, Syncfusion.Windows.Forms.Chart.SparkLine sparkline)
        {
            SparkLineSource sparkLineSource = new SparkLineSource();
            int             areaMarginX = 3;
            int             areaMarginY = 3;
            double          firstPointX = 0, firstPointY = 0, secondPointX = 0, secondPointY = 0;
            double          areaWidth  = sparkline.ControlWidth - areaMarginX * areaMarginX;
            double          areaHeight = sparkline.ControlHeight - areaMarginY * areaMarginY;

            var sourceList = (List <object>)sparkLineSource.GetSourceList(sparkline.Source, sparkline);

            if (sourceList.Count == 0)
            {
                return;
            }

            double lineInterval = areaWidth / (sourceList.Count);
            double lineRange    = sparkline.HighPoint - sparkline.LowPoint;

            for (int i = 0; i < sourceList.Count; i++)
            {
                double Value = Convert.ToDouble(sourceList[i]) - sparkline.LowPoint;

                secondPointX = firstPointX;
                secondPointY = firstPointY;

                firstPointX = this.Sparkline.Location.X + (lineInterval * i + (lineInterval / 2));
                firstPointY = this.Sparkline.Location.Y + (areaHeight - (areaHeight * (Value / lineRange)));

                if (i > 0)
                {
                    graphics.DrawLine(new Pen(sparkline.LineStyle.LineColor, 1), (float)(areaMarginX + firstPointX), (float)(areaMarginY + firstPointY), (float)(areaMarginX + secondPointX), (float)(areaMarginY + secondPointY));
                }

                if (sparkline.Markers.ShowMarker)
                {
                    graphics.FillEllipse(new SolidBrush(sparkline.Markers.MarkerColor.BackColor), (float)(areaMarginX + firstPointX - 2), (float)(areaMarginY + firstPointY - 2), 5, 5);
                }
                if (Convert.ToDouble(sourceList[i]) == sparkline.StartPoint && sparkline.Markers.ShowStartPoint)
                {
                    graphics.FillEllipse(new SolidBrush(sparkline.Markers.StartPointColor.BackColor), (float)(areaMarginX + firstPointX - 2), (float)(areaMarginY + firstPointY - 2), 5, 5);
                }
                if (Convert.ToDouble(sourceList[i]) == sparkline.EndPoint && sparkline.Markers.ShowEndPoint)
                {
                    graphics.FillEllipse(new SolidBrush(sparkline.Markers.EndPointColor.BackColor), (float)(areaMarginX + firstPointX - 2), (float)(areaMarginY + firstPointY - 2), 5, 5);
                }

                if (sparkline.GetNegativePoint() != null)
                {
                    int count = sparkline.GetNegativePoint().GetUpperBound(0);
                    for (int k = 0; k <= count; k++)
                    {
                        if (Convert.ToDouble(sourceList[i]) == (double)sparkline.GetNegativePoint().GetValue(k) && sparkline.Markers.ShowNegativePoint)
                        {
                            graphics.FillEllipse(new SolidBrush(sparkline.Markers.NegativePointColor.BackColor), (float)(areaMarginX + firstPointX - 2), (float)(areaMarginY + firstPointY - 2), 5, 5);
                        }
                    }
                }

                if (Convert.ToDouble(sourceList[i]) == sparkline.HighPoint && sparkline.Markers.ShowHighPoint)
                {
                    graphics.FillEllipse(new SolidBrush(sparkline.Markers.HighPointColor.BackColor), (float)(areaMarginX + firstPointX - 2), (float)(areaMarginY + firstPointY - 2), 5, 5);
                }
                if (Convert.ToDouble(sourceList[i]) == sparkline.LowPoint && sparkline.Markers.ShowLowPoint)
                {
                    graphics.FillEllipse(new SolidBrush(sparkline.Markers.LowPointColor.BackColor), (float)(areaMarginX + firstPointX - 2), (float)(areaMarginY + firstPointY - 2), 5, 5);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="GridSparklineCellRenderer"/> class.
 /// </summary>
 /// <param name="sparkline">The sparkline.</param>
 /// <param name="dataGrid">The DataGrid.</param>
 public GridSparklineCellRenderer(Syncfusion.Windows.Forms.Chart.SparkLine sparkline, SfDataGrid dataGrid)
 {
     Sparkline  = sparkline;
     DataGrid   = dataGrid;
     IsEditable = false;
 }