Example #1
0
        public void Render(Graphics g)
        {
            PlotAreaStyle style = m_style;

            drawGrid(g, style);

            foreach (ConfigurationTargetLine line in m_config.TargetLines)
            {
                float fY1 = m_gy.ScaleValue(line.YValue, true);
                line.SetActiveValues(fY1);

                if (line.Enabled && line.Visible)
                {
                    Color      clrFill = Color.FromArgb(32, line.LineColor);
                    Pen        p       = m_colLinePens.Add(line.LineColor);
                    Brush      br      = m_colLineBrushes.Add(clrFill);
                    RectangleF rc;

                    if (!float.IsNaN(fY1) && !float.IsInfinity(fY1))
                    {
                        if (fY1 > Bounds.Top && fY1 < Bounds.Bottom)
                        {
                            if (line.YValueRange > 0)
                            {
                                float fYTop = m_gy.ScaleValue(line.YValue - (line.YValueRange / 2.0f), true);
                                float fYBtm = m_gy.ScaleValue(line.YValue + (line.YValueRange / 2.0f), true);

                                rc = new RectangleF(m_rcBounds.Left, fYBtm, m_rcBounds.Width, fYTop - fYBtm);
                            }
                            else
                            {
                                rc = new RectangleF(m_rcBounds.Left, fY1 - 2, m_rcBounds.Width, 5);
                            }

                            g.FillRectangle(br, rc);
                            g.DrawLine(p, m_rcBounds.Left, fY1, m_rcBounds.Right, fY1);

                            if (!string.IsNullOrEmpty(line.Note))
                            {
                                SizeF sz     = g.MeasureString(line.Note, m_fontNote);
                                Brush brNote = m_colLineBrushes.Add(line.NoteColor);

                                g.DrawString(line.Note, m_fontNote, brNote, new PointF(100, fY1 - sz.Height));
                            }
                        }
                    }
                }
            }

            g.SetClip(Bounds);

            // Draw the pre-render
            foreach (GraphPlot graphPlot in m_rgPlots)
            {
                graphPlot.PreRender(g, m_config.PlotArea.Lookahead);
            }

            // Draw the action actives (if any)
            foreach (GraphPlot graphPlot in m_rgPlots)
            {
                graphPlot.RenderActions(g, m_config.PlotArea.Lookahead);
            }

            // Draw the plots
            foreach (GraphPlot graphPlot in m_rgPlots)
            {
                graphPlot.Render(g, m_config.PlotArea.Lookahead);
            }

            // Draw the look ahead bar if one exists
            if (m_config.PlotArea.Lookahead > 0)
            {
                float fX1 = m_rgPlots[0].GetXPositionFromEnd(m_config.PlotArea.Lookahead);
                Pen   pen = new Pen(Color.FromArgb(64, 0, 0, 255), 1.0f);
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                g.DrawLine(pen, fX1, m_rcBounds.Top, fX1, m_rcBounds.Bottom);

                pen.Dispose();
            }

            g.ResetClip();

            float fX  = 3;
            float fY  = 3;
            float fHt = 0;

            foreach (GraphPlot graphPlot in m_rgPlots)
            {
                if (m_rcBounds.Y + fY + fHt > m_rcBounds.Bottom)
                {
                    break;
                }

                fHt = drawLabel(g, fX, fY, graphPlot);
                fY += fHt;
            }

            drawTitle(g, m_config, m_style);
        }
Example #2
0
 private void Gdz_OnScale(object sender, ScaleArgs e)
 {
     e.ScaledValue = m_gy.ScaleValue(e.Value, e.Invert);
 }