Page 1 of 1

SelectionTool blocks

Posted: Tue Jul 20, 2010 3:23 am
by 13051032
7-19-2010 10-10-58 PM.png
7-19-2010 10-10-58 PM.png (2.72 KiB) Viewed 7991 times
As shown in above image, the selection tool puts too many black blocks. Is there a way I can have only at the beginning, middle and at end?

Also, is there a way I can set the transparency of these blocks. Sometimes they are pretty much cover the whole curve that is being selected.
Thanks,

Re: SelectionTool blocks

Posted: Tue Jul 20, 2010 1:10 pm
by yeray
Hi asupriya,
asupriya wrote:As shown in above image, the selection tool puts too many black blocks. Is there a way I can have only at the beginning, middle and at end?
I'm afraid it only can be done manually right now. You could use Selected event to calculate the points to draw and draw them using a Points series or drawing them manually at AfterDraw event.
asupriya wrote:Also, is there a way I can set the transparency of these blocks. Sometimes they are pretty much cover the whole curve that is being selected.
Yes, check the Selector tool's property: Brush.Transparency

Re: SelectionTool blocks

Posted: Tue Jul 20, 2010 2:05 pm
by 13051032
Yeray wrote:Hi asupriya,
asupriya wrote:As shown in above image, the selection tool puts too many black blocks. Is there a way I can have only at the beginning, middle and at end?
I'm afraid it only can be done manually right now. You could use Selected event to calculate the points to draw and draw them using a Points series or drawing them manually at AfterDraw event.
Can you please post a code snippet for this? I am using fastline series. Appreciate your help.

Re: SelectionTool blocks

Posted: Tue Jul 20, 2010 3:32 pm
by yeray
Hi asupriya ,

Here you have an example to start with:

Code: Select all

        private Steema.TeeChart.Tools.Selector select1;
        private Steema.TeeChart.Styles.Line line1;
        private Point[] points;

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;

            line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            line1.FillSampleValues(1000);

            select1 = new Steema.TeeChart.Tools.Selector(tChart1.Chart);
            select1.DrawHandles = false;

            points = new Point[3];
            select1.Selected += new Steema.TeeChart.Tools.SelectorSelectedEventHandler(select1_Selected);

            tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
        }

        void select1_Selected(object sender, EventArgs e)
        {
            if (select1.Selection == line1)
            {
                points[0].X = line1.CalcXPos(0);
                points[0].Y = line1.CalcYPos(0);

                points[1].X = line1.CalcXPos(line1.Count / 2);
                points[1].Y = line1.CalcYPos(line1.Count / 2);

                points[2].X = line1.CalcXPos(line1.Count-1);
                points[2].Y = line1.CalcYPos(line1.Count - 1);
            }
        }

        void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            if (select1.Selection == line1)
            {
                int width = 6;
                Steema.TeeChart.Drawing.Graphics3D gd = tChart1.Graphics3D;
                gd.Brush.Color = Color.Red;
                gd.Brush.Transparency = 50;
                
                for (int i = 0; i < points.Length; i++)
                {
                    gd.Rectangle(points[i].X - width, points[i].Y - width, points[i].X + width, points[i].Y + width);    
                }
                
            }
        }

Re: SelectionTool blocks

Posted: Mon Aug 09, 2010 10:12 pm
by 13051032
Thanks Yeray for the code snippet. Really appreciate it.

Re: SelectionTool blocks

Posted: Tue Aug 10, 2010 8:37 am
by yeray
Hi asupriya,

You're welcome! :)