color grid cell value

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Amol
Advanced
Posts: 176
Joined: Mon May 29, 2006 12:00 am

color grid cell value

Post by Amol » Thu Jul 07, 2011 12:41 pm

hi

i am working on colorgrid for heat map.is there any way to show actual value when the user clicks on one of the cells in the colorGrid ?




thanks&Regards

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: color grid cell value

Post by Sandra » Thu Jul 07, 2011 4:04 pm

Hello Amol,

I have made a simple code that calculate using Event MouseClick the values X and Y of ColorGrid Series when you do click, I think you can do something us next:

Code: Select all

  private void InitializeChart()
        {

            Steema.TeeChart.Styles.ColorGrid colorgrid = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
            colorgrid.FillSampleValues(5);
            tChart1.MouseClick += new MouseEventHandler(tChart1_MouseClick);
         }

   
             void tChart1_MouseClick(object sender, MouseEventArgs e)
            {
            Steema.TeeChart.Styles.ColorGrid color = (tChart1[0] as Steema.TeeChart.Styles.ColorGrid);
            int index = color.Clicked(e.X,e.Y);
            if (index != -1)
            {
                this.Text = "Value X: " + color.XValues[index].ToString() + " " + " Value Y: " + color.YValues[index].ToString();
            }
        }
Could you tell us if previous code works as you want?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Amol
Advanced
Posts: 176
Joined: Mon May 29, 2006 12:00 am

Re: color grid cell value

Post by Amol » Fri Jul 08, 2011 1:20 pm

thanks for code its working but i want to show the value which is getting on mouse click.
please tell me method by which i can show the value.




thanks & Regards

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: color grid cell value

Post by Sandra » Fri Jul 08, 2011 2:29 pm

Hello Amol,

Sorry, I understanood that you needed the XValues and YValues of series instead of values in pixels; so if you want get mouseClick values it is very easy, you have only use e.X and e.Y. You can do something as next:

Code: Select all

  void tChart1_MouseClick(object sender, MouseEventArgs e)
        {
            Steema.TeeChart.Styles.ColorGrid color = (tChart1[0] as Steema.TeeChart.Styles.ColorGrid);
            int index = color.Clicked(e.X,e.Y);
            if (index != -1)
            {
                this.Text = "Value X: " + e.X.ToString() + " " + " Value Y: " + e.Y.ToString();
            }
        }
Can you confirm us,if previous code works as you expected?

I hope will helps.

Thanks
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply