Page 1 of 1

color grid cell value

Posted: Thu Jul 07, 2011 12:41 pm
by 9641422
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

Re: color grid cell value

Posted: Thu Jul 07, 2011 4:04 pm
by 10050769
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,

Re: color grid cell value

Posted: Fri Jul 08, 2011 1:20 pm
by 9641422
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

Re: color grid cell value

Posted: Fri Jul 08, 2011 2:29 pm
by 10050769
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