Page 1 of 1

TColorGrid Cursor Tracking

Posted: Fri Jun 24, 2011 7:32 pm
by 10054271
I have a chart with a TColorGridSeries. I'd like to be able to display x, y, z values on the screen as the mouse cursor moves about the chart. I've tried using the Mark Tips Tool, but got no results. I've also tried writing a handler for the MouseMove event of the chart. In the handler, I call Series->GetCursorValueIndex(), but it always returns -1. What is the best way to accomplish what I'm trying to do? I'm using TeeChart Pro 8.06.

Re: TColorGrid Cursor Tracking

Posted: Thu Jun 30, 2011 8:55 am
by narcis
Hi skassan,

Sorry for the delayed reply. You can do as in the example I posted here.

Re: TColorGrid Cursor Tracking

Posted: Thu Jun 30, 2011 1:10 pm
by 10054271
Narcis,
Thanks for the reply. It appears that Clicked() is working the same as GetCursorValueIndex(). I still get -1 for a majority of the points on the grid. The grid contains about 230K points. I am getting values for points where the X value is less than 0.735. The points were added with the X value varying last (the outer loop). If it matters, please also note that I had to set IrregularGrid to true, because the X values are floats. They are regular, but separated by 0.105474 seconds. There are 1327 such time values, and the left axis consists of integer values from 10 to 186.

Re: TColorGrid Cursor Tracking

Posted: Thu Jun 30, 2011 1:45 pm
by narcis
Hi skassan,

Can you please try with TeeChart Pro v8.08 VCL, which is the last v8 release? Does this work fine for you? Otherwise, can you please attach a simple example project we can run "as-is" to reproduce the problem here?

Thanks in advance.

Re: TColorGrid Cursor Tracking

Posted: Thu Jun 30, 2011 5:37 pm
by 10054271
Narcis,
Before downloading a new version of the software, I wanted to be sure I could create a small project that reproduces the problem. It turns out that the problem happens when I turn the Pen off for the Grid.

Below is some code, and the form file to recreate the problem. As shown below, the code exhibits the exact problem I see. But by simply removing the line in the form file that says: Pen.Visible = False, the problem goes away.

Unit1.cpp

Code: Select all

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Chart"
#pragma link "TeEngine"
#pragma link "TeeProcs"
#pragma link "TeeSurfa"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
  for (int i = 0; i < 1327; ++i)
  {
    for (int j = 10; j < 187; ++j)
    {
      Series1->AddXYZ(0.105474 * i, Random(), j);
    }
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Chart1MouseMove(TObject *Sender, TShiftState Shift, int X,
          int Y)
{
  Label1->Caption = Series1->Clicked(X, Y);
}
//---------------------------------------------------------------------------

Unit1.dfm:

Code: Select all

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 286
  ClientWidth = 426
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 128
    Top = 264
    Width = 31
    Height = 13
    Caption = 'Label1'
  end
  object Chart1: TChart
    Left = 0
    Top = 0
    Width = 418
    Height = 250
    Title.Text.Strings = (
      'TChart')
    View3D = False
    TabOrder = 0
    OnMouseMove = Chart1MouseMove
    ColorPaletteIndex = 8
    object Series1: TColorGridSeries
      Marks.Arrow.Visible = True
      Marks.Callout.Brush.Color = clBlack
      Marks.Callout.Arrow.Visible = True
      Marks.Callout.Length = 0
      Marks.Visible = False
      EndColor = clBlue
      IrregularGrid = True
      MidColor = clYellow
      Pen.Visible = False
      StartColor = clRed
      XValues.Name = 'X'
      XValues.Order = loNone
      YValues.Name = 'Y'
      YValues.Order = loNone
      ZValues.Name = 'Z'
      ZValues.Order = loNone
    end
  end
end

Re: TColorGrid Cursor Tracking

Posted: Fri Jul 01, 2011 12:01 pm
by narcis
Hi skassan,

I'm having problems assembling the sample project. Would you mind attaching the complete project?

Thanks in advance.

Re: TColorGrid Cursor Tracking

Posted: Fri Jul 01, 2011 12:38 pm
by 10054271
Narcis,
I've uploaded a zip file with all of the project files.

In the mean time, I've been experimenting with the problem. Since it seemed to be related to the Pen.Visible property, I set that to True, and changed the PenStyle to psClear. That helped. But I ran into the same problem when I had to change the IrregularGrid property to True. I need to do this because sometimes my data interval along the X-axis is larger than one. In the attached example, the interval is 63.488. In that case, if IrregularGrid is False, the graph is not contiguous. It only shows bars one unit wide every 63.488 units. But when I set IrregularGrid to True, the problem with Clicked() not working correctly reappears.

Thanks for all of your help.

Re: TColorGrid Cursor Tracking

Posted: Fri Jul 01, 2011 12:43 pm
by narcis
Hi skassan,

Where did you send the files? Did you press the "Add the file" button after browsing for attachments?

Thanks in advance.

Re: TColorGrid Cursor Tracking

Posted: Fri Jul 01, 2011 12:48 pm
by 10054271
Yes, I did. And I watched in Task Manager as the Network Activity for outgoing messages increased, and then went idle again. Then the screen refreshed, wiping out my reply. So I typed it in again, and hit submit.
Trying again...

Re: TColorGrid Cursor Tracking

Posted: Fri Jul 01, 2011 1:03 pm
by narcis
Hi skassan,

No luck yet. Can you see the file attached here? Please be aware that you didn't get any error message. The forums board doesn't allow certain file types and displays an error message. Alternatively you can send your files at http://www.steema.net/upload/.

Thanks in advance.

Re: TColorGrid Cursor Tracking

Posted: Fri Jul 01, 2011 1:11 pm
by 10054271
Ok. Using the web link, I got a file size too big error. I included the Debug folder in the zip file. I'll remove that and try again.

Re: TColorGrid Cursor Tracking

Posted: Fri Jul 01, 2011 1:59 pm
by narcis
Hi skassan,

Thanks for the example project. I couldn't get it working here either toggling IrregularGrid or Pen visibility. I could reproduce the problem using code snippet below to so I have added this issue (TV52015637) to the defect list to be investigated for future releases.

Code: Select all

uses TeeSurfa;

procedure TForm1.FormCreate(Sender: TObject);
var Series1: TColorGridSeries;
    x, z   : Integer;
begin
  Series1:=TColorGridSeries.Create(Self);
  Series1.IrregularGrid:=True;

  Chart1.AddSeries(Series1);

  for x:=0 to 101 do
    for z:=0 to 2139 do
      Series1.AddXYZ(63.488 * x, Random, z);
end;

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Caption:=IntToStr(Chart1[0].Clicked(X,Y));
end;

Re: TColorGrid Cursor Tracking

Posted: Fri Jul 01, 2011 2:08 pm
by 10054271
Is there public access to your bug tracking tool? Will I be notified when a fix is available?

Re: TColorGrid Cursor Tracking

Posted: Fri Jul 01, 2011 2:23 pm
by narcis
Hi skassan,
Is there public access to your bug tracking tool?


No but asking for this ticket number we can inform you about its status anytime.
Will I be notified when a fix is available?
We don't use to do that. When a new release is published it comes with what we call the release notes. This is a list with the bug fixes and new features included in the release. I recommend you to be aware at this forum, our RSS news feed, twitter and facebook accounts for new release announcements and what's implemented on them.