Page 1 of 1

Questions regarding TCursorTool

Posted: Fri Feb 17, 2006 8:23 pm
by 9336115
Hi,

I am using TChartPro 7 and BCB 5 to plot electrophysiology data acquired
from the analog-to-digital acquisition board. The data are plotted as
several fixed-length sweeps with TChartFastLineSeries (it is a lot of data
points). I'm using several vertical/horizontal cursors to restrict the area
for data analysis. And I have got several questions regarding the
TCursorTool.

Could you tell me if it is possible to have a text identifier (like a label
box) for each cursor in the Chat area, so I can see which cursor is which.
The problem is I can have up to 10 vertical cursors and they are working in
pairs (cursors: 1-2, 3-4 and so on) to restrict the area for data analysis.
It is really hard to keep track which cursor is which.
I tried to associate TAnotationTool/TRectangleTool with TCursorTool, but it
is working awful. I add TAnotationTool/TRectangleTool in the ChartEditor and
make it 'stick' to the particular TCursorTool with Left and Top properties.
Then I wrote the OnChange event to keep changing their position when I'm
moving Cursor, so that they would stay together. However, when I'm moving
Cursor the text box of TAnotationTool/TRectangleTool flickering, slow down
the movement of Cursor and not keeping up with Cursor movement. Same thing
is happening if I add the TLabel to the TChart window. But if I put TLabel
out of TChart window, it is working fine (no slow down).
So,I would really like to know if there is any way around to have the text
box or label in the TChart window and move it easily together with
TCursorTool.

I also need to know exactly what TCursotTool.SnapToPoint() return. Does it
return the index (count starts from 0) or the point number (count starts
from 1) in the data array (TChartSeries). As I think, it return the value
index, but maybe I'm wrong. Could you make it clear for me?

Thank you in advance,

Evgeny

Re: Questions regarding TCursorTool

Posted: Fri Feb 17, 2006 8:25 pm
by 9336115
Hi Evgeny,

>Could you tell me if it is possible to have a text identifier (like a label
>box) for each cursor in the Chat area, so I can see which cursor is which.
>The problem is I can have up to 10 vertical cursors and they are working in
>pairs (cursors: 1-2, 3-4 and so on) to restrict the area for data analysis.
>It is really hard to keep track which cursor is which.
>I tried to associate TAnotationTool/TRectangleTool with TCursorTool, but it
>is working awful. I add TAnotationTool/TRectangleTool in the ChartEditor
>and make it 'stick' to the particular TCursorTool with Left and Top
>properties. Then I wrote the OnChange event to keep changing their
>position when I'm moving Cursor, so that they would stay together. However,
>when I'm moving Cursor the text box of TAnotationTool/TRectangleTool
>flickering, slow down the movement of Cursor and not keeping up with Cursor
>movement. Same thing is happening if I add the TLabel to the TChart window.
>But if I put TLabel out of TChart window, it is working fine (no slow
>down).
>So,I would really like to know if there is any way around to have the text
>box or label in the TChart window and move it easily together with
>TCursorTool.

Yes, you can do it custom drawing on TChart's canvas, doing something like:

void __fastcall TForm1::Chart1AfterDraw(TObject *Sender)
{
int x,y;

x=Chart1->Axes->Bottom->CalcPosValue(ChartTool1->XValue);
y=Chart1->Height / 2;
Chart1->Canvas->RotateLabel(x,y,"Cursor 1",90);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ChartTool1Change(TCursorTool *Sender, int x, int y,
const double XValue, const double YValue, TChartSeries *Series,
int ValueIndex)
{
Chart1->Draw();
}

For what you request you may also be interested in using a TColorBandTool.


>I also need to know exactly what TCursotTool.SnapToPoint() return. Does it
>return the index (count starts from 0) or the point number (count starts
>from 1) in the data array (TChartSeries). As I think, it return the value
>index, but maybe I'm wrong. Could you make it clear for me?

Yes, you are right but with some observations as you can read in TeeChart's
help file:

This function returns the series point nearest to the cursor tool.
SnapToPoint can only be used when series property is not nil, otherwise the
result will be always -1.

See OnSnapChange event and Snap property.

--
Best Regards,

Narcís Calvet
http://support.steema.com

Posted: Fri Feb 17, 2006 8:55 pm
by 9336115
Hi Narcís,

Thank you very much for your help.
Apparently it is not difficult to have a tag for the cursor. It is really
nice short code. Thanks! But... there is still a problem.

When I used this example for my project I've got the same problem as with TAnotationTool/TRectangleTool. The Label do not keep up with Cursor when I'm moving it and it is slowing down Cursor movement (the cursor movement becomes jittering). I guess, it is happening because I have to many data points in the chart (10 Series x 100000 points).

As I wrote before, there is no problem if I use a TLabel located out of TChart canvas (as well as dragging TCursorTool on the chart). So, my guess is that TChart redrawing is responsible for this problem.
I can not reduce the number points per chart, the end-user has to see the whole traces in one chart view.
I tried the DrawAllPoints property set to false (TFastLineSeries). It does not work at all the way I expected. It cut out all high frequency signal from the traces to the point that meaningful signal disappears (nice filter I would say :D ).
I also tried all other tricks described in 'Real-time charting in TeeChart VCL' (like setting up default chart capacity, buffered display, Axes->FastCalc = true, etc.). It does not help a lot.

I'm not an expert in Windows GDI, but would be chart redrawing and chart time-response faster if chart would be drawn as a MF/EMF/Indexed color as compare to Bitmap. Or maybe something else. I really don't have a clue.
The other commercial program we are using for data analysis (pClamp 9, Axon Instruments - http://www.moleculardevices.com/pages/s ... amp90.html) handles the same data very easily. I would really like to have a chart component like in this program. Maybe even at the cost of sacrificing some TeeChart functionality and features.

If there is no solution to optimize TChart right now, would you consider developing a new TFastChart component for the next TeeChart releases? I would like to have a chart component that is optimized to handle a large number of data and have a fast time-response (in my case, that would be a real-time charting of digitized signal from the analog-to-digital board + real-time analysis of the recorded signal).

Thanks again for your help!

Evgeny.

Posted: Thu Feb 23, 2006 8:55 am
by 9339785
Hi,
Just to tell that I'm also VERY VERY interested by a new TFastChart with fast time-response for displaying series with more than 1 000 000 points. The actual TFastChart is not fast enough at all for my application, even with the tricks described in 'Real-time charting'.
I hope this will be included in the next version of TeeChart.

Franck

Posted: Mon Feb 27, 2006 3:59 pm
by narcis
Hello everyone,

For now, there is nothing else that can be done. I'll add your request to our wish list to be considered for future versions.