SelectionTool blocks

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
asupriya
Advanced
Posts: 179
Joined: Mon Dec 01, 2008 12:00 am

SelectionTool blocks

Post by asupriya » Tue Jul 20, 2010 3:23 am

7-19-2010 10-10-58 PM.png
7-19-2010 10-10-58 PM.png (2.72 KiB) Viewed 8078 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,

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: SelectionTool blocks

Post by Yeray » Tue Jul 20, 2010 1:10 pm

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
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

asupriya
Advanced
Posts: 179
Joined: Mon Dec 01, 2008 12:00 am

Re: SelectionTool blocks

Post by asupriya » Tue Jul 20, 2010 2:05 pm

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.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: SelectionTool blocks

Post by Yeray » Tue Jul 20, 2010 3:32 pm

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);    
                }
                
            }
        }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

asupriya
Advanced
Posts: 179
Joined: Mon Dec 01, 2008 12:00 am

Re: SelectionTool blocks

Post by asupriya » Mon Aug 09, 2010 10:12 pm

Thanks Yeray for the code snippet. Really appreciate it.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: SelectionTool blocks

Post by Yeray » Tue Aug 10, 2010 8:37 am

Hi asupriya,

You're welcome! :)
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply