Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1051 - ColorGrid Clicked method not working
Summary: ColorGrid Clicked method not working
Status: RESOLVED FIXED
Alias: None
Product: .NET TeeChart
Classification: Unclassified
Component: Series (show other bugs)
Version: TeeChart.NET 2014 4.1.2014.02060
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Steema Issue Manager
URL: http://www.teechart.net/support/viewt...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-16 07:12 EST by narcís calvet
Modified: 2015-01-15 06:13 EST (History)
2 users (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments
client project (17.10 KB, application/x-zip-compressed)
2014-12-16 07:12 EST, narcís calvet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description narcís calvet 2014-12-16 07:12:28 EST
Created attachment 364 [details]
client project

The attached program draws two ColorGrids one with 640,000 data points and one with 640,800 data points. Both have a X axis of 0 to 200. The first Colour grid has one vertical and one horizontal line of values that are non-zero, with a Z range of 0 to 800. The first Colour grid has two vertical and two horizontal lines of values that are non-zero, with a Z range of 0 to 801. 

The mark text values on the first ColorGrid are incorrect, the vertical line demonstrates this, while the mark text values on the second ColorGrid are correct. I have changed the Z range on the second ColorGrid from 800, mark text incorrect, to 1600, mart text correct. And from other tests I have done on my application it seems to me that the correctness or otherwise of the mark text values is dependant on the number of data points plotted. Could you confirm that this is the case, or can you tell be if I am drawing the ColorGrid incorrectly.

I'm afraid it's ColorGrid.Clicked which doesn't work correctly as the code snippet below doesn't work fine either.

        void _dataSeriesContour1_Click(object sender, MouseEventArgs e)
        {
          var colorGrid1 = (Steema.TeeChart.Styles.ColorGrid)sender;
          var index = colorGrid1.Clicked(e.X, e.Y);

          if (index != -1)
          {
            _plotChartContour1.Header.Text = colorGrid1.YValues[index].ToString() + ", " + colorGrid1.XValues[index].ToString() + ", " + colorGrid1.ZValues[index].ToString();
          }
          else
          {
            _plotChartContour1.Header.Text = "no point clicked";
          }
        }
Comment 1 narcís calvet 2015-01-14 04:17:41 EST
Below there's a simpler code snippet reproducing the problem, which occurs when IrregularGrid is set to true.

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    ColorGrid series;

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      series = new ColorGrid(tChart1.Chart);
      series.Click += series_Click;
      series.IrregularGrid = true;

      Random rnd = new Random();
      double x, y, z;

      for (int i = 0; i < 10; i++)
      {
        z = i;
        x = 0;
        for (int j = 0; j < 20; j++)
        {
          y = rnd.Next(10, 100);
          series.Add(x, y, z);
          x += 0.25;
        }
      }
    }

    void series_Click(object sender, MouseEventArgs e)
    {
      ColorGrid series = sender as ColorGrid;
      Chart chart = series.Chart;
      int index = series.Clicked(e.X, e.Y);
      chart.Header.Text = "Index = " + index.ToString();
    }

now change x += 0.25 to x+=1 and IrregularGrid to false, the index should now work fine.