SurfaceNearestTool with ColorGrid

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
jenb
Newbie
Newbie
Posts: 50
Joined: Thu Jun 21, 2007 12:00 am

SurfaceNearestTool with ColorGrid

Post by jenb » Fri Jul 06, 2007 8:29 am

Dear All

I would like to add something like the SurfaceNearestTool with a ColorGrid series. Is this possible? (I've tried to get it to work but program crashes when I select a cell on the ColorGrid). If not possible can someone suggest the best approach to achieve a similar effect (e.g. draw custom shape on the chart?). I would like to highlight just the selected cell, not the whole column and row. Also with the SurfaceNearestTool I couldn't find how to set the Column Color to clNone (I couldn't find where clNone is defined).

Regards

jenb

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Fri Jul 06, 2007 10:06 am

Hi Jenb

The SurfaceNearestTool doesn't work with ColorGrid Series, I've added it (TF02012323) in our wish list to be fixed for future release.

In the meantime, you can use the method clicked in the MouseMove event of the chart, as below code. But method clicked of the ColorGrid Series doesn't work to the perfection, I've added it (TF02012324) to our defect list to be fixed for future releases.

Code: Select all

private void Form1_Load(object sender, EventArgs e)
        {
            tChart1.Aspect.View3D = false;
            colorGrid1.FillSampleValues(16);
        }

        private int tmpIndex;
        private Color tmpColor;

        private void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            int index = colorGrid1.Clicked(e.X, e.Y);
            if (index != -1)
            {
                tmpColor = colorGrid1.Colors[index];
                colorGrid1.Colors[index] = Color.Tomato;
                colorGrid1.Colors[tmpIndex] = tmpColor;
                tmpIndex = index;               
            }
            colorGrid1.Repaint();
        }
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

jenb
Newbie
Newbie
Posts: 50
Joined: Thu Jun 21, 2007 12:00 am

Post by jenb » Fri Jul 06, 2007 12:01 pm

Thanks Edu

For now I'm using the Cursor Tool, it's not exactly what I want, but not a bad work-around.

jenb

Post Reply