protected static void DrawRectangle(IRenderContext2D renderContext, IPen2D pen, IBrush2D brush, ICoordinateCalculator<double> xcal,
			ICoordinateCalculator<double> ycal, float xv, float yv, float wv, float hv)
        {
            var x1 = xcal.GetCoordinate(xv);
            var y1 = ycal.GetCoordinate(yv);
            var x2 = xcal.GetCoordinate(xv + wv);
            var y2 = ycal.GetCoordinate(yv + hv);
            var pt1 = new Point(x1, y1);
            var pt2 = new Point(x2, y2);
            renderContext.FillRectangle(brush, pt1, pt2);
            renderContext.DrawQuad(pen, pt1, pt2);
        }
        protected static void DrawRectangle(IRenderContext2D renderContext, IPen2D pen, IBrush2D brush, ICoordinateCalculator <double> xcal,
                                            ICoordinateCalculator <double> ycal, float xv, float yv, float wv, float hv)
        {
            var x1  = xcal.GetCoordinate(xv);
            var y1  = ycal.GetCoordinate(yv);
            var x2  = xcal.GetCoordinate(xv + wv);
            var y2  = ycal.GetCoordinate(yv + hv);
            var pt1 = new Point(x1, y1);
            var pt2 = new Point(x2, y2);

            renderContext.FillRectangle(brush, pt1, pt2);
            renderContext.DrawQuad(pen, pt1, pt2);
        }
        protected override void Draw(IRenderContext2D renderContext, IRenderPassData renderPassData)
        {
            base.Draw(renderContext, renderPassData);

            // Do the drawing for our timeline here
            //

            // Input data is type XyzPointSeries so must be cast
            var inputData = renderPassData.PointSeries as XyzPointSeries;

            // Get X,Y axis calculators
            var xCalc = renderPassData.XCoordinateCalculator;
            var yCalc = renderPassData.YCoordinateCalculator;

            // Compute some constants
            double yMid       = YOffset;
            double halfHeight = Height * 0.5;

            // Iterate over the data
            for (int i = 0; i < inputData.Count; i++)
            {
                // Now compute the bounds of the box to draw for one data-points
                // XStart = X, XEnd = XStart + Y (we use Y for the length of the box)
                // YTop, YBottom defined by Height + YOffset properties
                double xStartCoord = xCalc.GetCoordinate(inputData.XValues[i]);
                double xEndCoord   = xStartCoord + xCalc.GetCoordinate(inputData.YValues[i]);
                double yTop        = yCalc.GetCoordinate(yMid + halfHeight);
                double yBottom     = yCalc.GetCoordinate(yMid - halfHeight);

                // Get the color for this block
                int   iColor = (int)inputData.ZPoints[i];
                Color fill   = iColor.ToColor();

                // Brush creation can be expensive, cache brushes keyed on int color if you find this
                using (var scichartBrush = renderContext.CreateBrush(fill))
                {
                    // Draw a rectangle
                    renderContext.FillRectangle(scichartBrush, new Point(xStartCoord, yBottom), new Point(xEndCoord, yTop));

                    // NOTE:
                    // You can draw fill, stroke, and fills can be linear gradient brushes if you want.
                    // Extra data can be passed through the Metadata parameter in XyzDataSeries
                }
            }
        }