Reference line in plotarea

Oystein Bjorke 10 jaar geleden 0
This discussion was imported from CodePlex

Firefox360 wrote at 2013-09-25 14:35:

Hey there,

What i'm supposed to make is a reference line in the plot area where the graphs are shown in.
But when the program draws the line, it draws the line over
the complete oxyplot area. So also under the x-axis.

I wanted to add a picture of it in here, so it would be easier to understand, but it's only possible to add pictures from the internet.

Code:
    private float lijnStartX, lijnEndX;
    private float lijnStartY, lijnEndY;
    lijnStartY  = (float)0;
    lijnEndY    = (float)plotBSITotalA.Height; 

    private void plot_MouseDown(object sender, MouseEventArgs e)
    {
        if (e.Button == MouseButtons.Left)
        {
            lijnStartX = e.X;
            lijnEndX = e.X;
            Draw(lijnStartX, lijnEndX, lijnStartY, lijnEndY);
        }
    }

    private void Draw(float startF, float endF, float startY, float endY)
    {
        this.Refresh();

        float startX        = startF;
        float endX          = endF;
        float[] dValue      = { 5, 5 };
        PointF startP       = new PointF(startX, startY);
        PointF endP         = new PointF(endX, endY);
        Graphics g          = plotBSITotalA.CreateGraphics();
        Pen p               = new Pen(Color.Red);
        p.DashPattern       = dValue;

        g.DrawLine(p, startP, endP);
    }