Page 1 of 1

Dragging a color line has trailing line.

Posted: Tue Jun 16, 2009 8:58 pm
by 13048149
Hi There,

How to achieve smooth dragging of color line?
Using the below code a trailing line is visible on dragging the color line, that is undesirable.

Best Regards
Srinivas Avancha

Code: Select all

        private void Form1_Load(object sender, EventArgs e)
        {

            Steema.TeeChart.TChart tChart1 = new Steema.TeeChart.TChart();
            this.Controls.Add(tChart1);
            tChart1.Dock = DockStyle.Fill;
            tChart1.Aspect.View3D = false;

            Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            line1.FillSampleValues(2);
            line1.LinePen.Width = 3;

            Steema.TeeChart.Tools.ColorLine colorLine = new Steema.TeeChart.Tools.ColorLine(tChart1.Chart);
            colorLine.Active = true;
            colorLine.Axis = tChart1.Axes.Left;
            colorLine.Pen.Color = Color.Black;
            colorLine.Pen.Width = 2;
            colorLine.Pen.Style = System.Drawing.Drawing2D.DashStyle.Dash;

            colorLine.Value = (tChart1.Axes.Left.MaxYValue - tChart1.Axes.Left.MinYValue) / 2 + tChart1.Axes.Left.MinYValue;

        }


Re: Dragging a color line has trailing line.

Posted: Wed Jun 17, 2009 8:23 am
by 10050769
Hello Srinivas Avancha,

Please add next line in your code and check that works fine:

Code: Select all

    colorLine.DragRepaint = true;
I hope that will helps,


Thanks,

Re: Dragging a color line has trailing line.

Posted: Wed Jun 17, 2009 12:32 pm
by 13048149
Hi Sandra,

It did work like a charm! But I thought it is counter intuitive as the documentation states “Repaints the Chart while moving the ColorLine when DragRepaint is True” should cause more delay, what is the logic behind?

Thanks.

Re: Dragging a color line has trailing line.

Posted: Wed Jun 17, 2009 2:46 pm
by yeray
Hi Srinivas Avancha,

The problem isn't a real delay but looks if it was. If the chart draws the line in the new position without repainting the whole chart, the line drawn in the old position isn't removed. I mean, when the chart is repainted, all the old lines disappear and then the line is drawn in the new position.

Of course, forcing the chart to be repainted more times is slower but if you don't have much points, you won't note any difference.

Re: Dragging a color line has trailing line.

Posted: Wed Jun 17, 2009 2:50 pm
by 13048149
Hi Yeray,

Thanks for the explanation.