TColorLineTool problem
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 am
TColorLineTool problem
I'm trying to use the TColorLineTool to display vertical lines (markers in my terms) on a chart. I create a line at the cursor position when the user selects "drop marker" from a context menu. These markers are used to mark points of interest in the data being displayed, and are saved in a database table so they persist across application runs. This all works fine.
The problem I'm having is that when the chart is scrolled, the marker line move with the data as expected until it runs into the right or left edge of the chart. It then drags along the chart edge until the scrolling stops, and its initial position is lost.
If I set the NoDragLimit property to true, the line stays with the data, but doesn't vanish at the right or left chart axes - instead it is displayed over the right or left axis.
I want the line to travel with the data, and vanish when the associated data point is no longer visible on the chart.
How can I make this happen?
I am using BCB6 patch level 4 and TeeChartPro version 7.
The problem I'm having is that when the chart is scrolled, the marker line move with the data as expected until it runs into the right or left edge of the chart. It then drags along the chart edge until the scrolling stops, and its initial position is lost.
If I set the NoDragLimit property to true, the line stays with the data, but doesn't vanish at the right or left chart axes - instead it is displayed over the right or left axis.
I want the line to travel with the data, and vanish when the associated data point is no longer visible on the chart.
How can I make this happen?
I am using BCB6 patch level 4 and TeeChartPro version 7.
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 am
Hi Leroy,
you can solve this using the following code, also seting the NoDragLimit property to true :I want the line to travel with the data, and vanish when the associated data point is no longer visible on the chart.
How can I make this happen?
Code: Select all
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
if (Charttool1.Value > Chart1.Axes.Bottom.Maximum) or (Charttool1.Value < Chart1.Axes.Bottom.Minimum) then
Charttool1.Visible := false
else
Charttool1.Visible := true;
end;
This can be simulated by using the following code :One more thing. When the line I'm dragging hits the left or right edge of the chart, I'd like the chart to scroll so the user doesn't have to drag the marker to an edge, drop it, scroll the chart manually, then drag again.
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(1000);
Chart1.MaxPointsPerPage := 100;
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
if (Charttool1.Value > Chart1.Axes.Bottom.Maximum) or (Charttool1.Value < Chart1.Axes.Bottom.Minimum) then
Charttool1.Visible := false
else
Charttool1.Visible := true;
end;
procedure TForm1.ChartTool1DragLine(Sender: TColorLineTool);
begin
if charttool1.Value < Chart1.Axes.Bottom.Minimum +10 then
Chart1.Axes.Bottom.SetMinMax(Chart1.Axes.Bottom.Minimum-10,Chart1.Axes.bottom.Maximum-10)
else
if charttool1.Value > Chart1.Axes.Bottom.Maximum - 10 then
Chart1.Axes.Bottom.SetMinMax(Chart1.Axes.Bottom.Minimum+10,Chart1.Axes.bottom.Maximum+10);
end;
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 am
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 am
We must have been posting at the same time. Your answer wasn't visible when I posted my latest message.Pep wrote:Hi Leroy,
have you seen my post ?
I realize that I can do this manually as you have pointed out. I was hoping that the TColorLineTool could handle this on its own. As it apparently can't, could you please add this behavior to the wish-list?
Thanks!
-Leroy
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 am
I have one more question on the TColorLineTool. I need to display a hint where the cursor passes over or is held over the line.
I see that since I have drag enabled for the line, the cursor changes to a drag cursor when it is over the line and changes back to the default cursor when it is moved away. If I could get the line to fire events when the cursor changes I could show/hide my hints at that time.
Is there a way to display a hint or fire events when the cursor changes?
I see that since I have drag enabled for the line, the cursor changes to a drag cursor when it is over the line and changes back to the default cursor when it is moved away. If I could get the line to fire events when the cursor changes I could show/hide my hints at that time.
Is there a way to display a hint or fire events when the cursor changes?
Hi Leroy,
Ok, I've added on our wish list to be considered for the next releases.I realize that I can do this manually as you have pointed out. I was hoping that the TColorLineTool could handle this on its own. As it apparently can't, could you please add this behavior to the wish-list?
You could use similar code that in the example I've posted into the steema.public.attachments newsgroup.Is there a way to display a hint or fire events when the cursor changes?
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 am
But this doesn't.Pep wrote:Hi Leroy,
you can solve this using the following code, also seting the NoDragLimit property to true :I want the line to travel with the data, and vanish when the associated data point is no longer visible on the chart.
How can I make this happen?This works fine.Code: Select all
procedure TForm1.Chart1AfterDraw(Sender: TObject); begin if (Charttool1.Value > Chart1.Axes.Bottom.Maximum) or (Charttool1.Value < Chart1.Axes.Bottom.Minimum) then Charttool1.Visible := false else Charttool1.Visible := true; end;
This can be simulated by using the following code :One more thing. When the line I'm dragging hits the left or right edge of the chart, I'd like the chart to scroll so the user doesn't have to drag the marker to an edge, drop it, scroll the chart manually, then drag again.Code: Select all
procedure TForm1.FormCreate(Sender: TObject); begin Series1.FillSampleValues(1000); Chart1.MaxPointsPerPage := 100; end; procedure TForm1.Chart1AfterDraw(Sender: TObject); begin if (Charttool1.Value > Chart1.Axes.Bottom.Maximum) or (Charttool1.Value < Chart1.Axes.Bottom.Minimum) then Charttool1.Visible := false else Charttool1.Visible := true; end; procedure TForm1.ChartTool1DragLine(Sender: TColorLineTool); begin if charttool1.Value < Chart1.Axes.Bottom.Minimum +10 then Chart1.Axes.Bottom.SetMinMax(Chart1.Axes.Bottom.Minimum-10,Chart1.Axes.bottom.Maximum-10) else if charttool1.Value > Chart1.Axes.Bottom.Maximum - 10 then Chart1.Axes.Bottom.SetMinMax(Chart1.Axes.Bottom.Minimum+10,Chart1.Axes.bottom.Maximum+10); end;
As the line I am dragging approaches within 10 units of either side of the chart, the chart scrolls as expected. The line I am dragging also scrolls, but the Drag Cursor does not travel with the line - it stays where the line was before the scroll.
Hi Leroy,
I'm sorry, I'm not quite sure what you refer here when you says "Drag Cursor". Is that you're using one more Tool (Cursor Tool) ? Could you please be more specific ?As the line I am dragging approaches within 10 units of either side of the chart, the chart scrolls as expected. The line I am dragging also scrolls, but the Drag Cursor does not travel with the line - it stays where the line was before the scroll.
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 am
When I move the cursor over the line, it changes to indicate that you can drag the line. This is what I was calling a Drag Cursor. The proper name for it is crHSplit.Pep wrote:Hi Leroy,
I'm sorry, I'm not quite sure what you refer here when you says "Drag Cursor". Is that you're using one more Tool (Cursor Tool) ? Could you please be more specific ?As the line I am dragging approaches within 10 units of either side of the chart, the chart scrolls as expected. The line I am dragging also scrolls, but the Drag Cursor does not travel with the line - it stays where the line was before the scroll.
Hi Leroy,
ok, I understand now. But here works fine using the TeeChart Pro v7 with BCB6 (the mouse cursor travels with the Line when drag). I've attached one example to the steema.public.attachments newsgroup. Could you please get it and test if it works fine for you ?
ok, I understand now. But here works fine using the TeeChart Pro v7 with BCB6 (the mouse cursor travels with the Line when drag). I've attached one example to the steema.public.attachments newsgroup. Could you please get it and test if it works fine for you ?
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 am
Thanks, Pep. I built your project and am still having the problem. I don't think I explained it well - the cursor tracks the line OK until the line reaches either edge of the chart, then the chart scrolls and the line scrolls with it, but the cursor does not.Pep wrote:Hi Leroy,
ok, I understand now. But here works fine using the TeeChart Pro v7 with BCB6 (the mouse cursor travels with the Line when drag). I've attached one example to the steema.public.attachments newsgroup. Could you please get it and test if it works fine for you ?
I've uploaded a zip file containing an AVI which shows the problem to the steema.public.attachments newsgroup.
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 am
Hi Leroy,
sorry for delay. I'm not able to open the AVI files here. Could you please send them again directly to my mail account ([email protected]) ?
sorry for delay. I'm not able to open the AVI files here. Could you please send them again directly to my mail account ([email protected]) ?
Pep Jorge
http://support.steema.com
http://support.steema.com