If I have several point series on my chart. By making the DragMarksTool active I can just drag the marks for the points in the last series. How do I make the marks for all of the series drag-able? The number of series depends on the data so it has to be done at run time.
Thanks again,
Jim
DragMarks tool
Re: DragMarks tool
Hello Jim,
Assigning nil to the TDragMarksTool's Series property should enable it for all the series.
An alternative is to set the TDragMarksTool's Series at OnMouseMove. Ie:
Assigning nil to the TDragMarksTool's Series property should enable it for all the series.
An alternative is to set the TDragMarksTool's Series at OnMouseMove. Ie:
Code: Select all
procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var SeriesIndex: Integer;
begin
for SeriesIndex:=0 to Chart1.SeriesCount-1 do
begin
if Chart1[SeriesIndex].Marks.Clicked(X, Y) > -1 then
(Chart1.Tools[0] as TDragMarksTool).Series:=Chart1[SeriesIndex];
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: DragMarks tool
Thanks - that first solution of setting the series property to nil is simple and it works. I would not have guessed that. What is the procedure to restore it to normal?
Re: DragMarks tool
Hello,
What version are you using?
I'm glad to hear it works as you wish now.JimR wrote:Thanks - that first solution of setting the series property to nil is simple and it works. I would not have guessed that.
By "normal" do you mean what you said in the opening post here?JimR wrote:What is the procedure to restore it to normal?
This is not the behaviour I observe by default. The TDragMarksTool works with all the series for me by default:JimR wrote:I can just drag the marks for the points in the last series
Code: Select all
uses Series, TeeTools;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Chart1.View3D:=False;
for i:=0 to 3 do
with Chart1.AddSeries(TPointSeries) do
begin
Marks.Visible:=True;
FillSampleValues(5);
end;
Chart1.Tools.Add(TDragMarksTool);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: DragMarks tool
I meant your first example"
"Assigning nil to the TDragMarksTool's Series property should enable it for all the series."
How does one undo that ?
"Assigning nil to the TDragMarksTool's Series property should enable it for all the series."
How does one undo that ?
Re: DragMarks tool
Hello,
If at some stage you assigned a Series to the TDragMarksTool to limit it (2), and later you set it to nil to use it in all the Series again (3), and you want to remember to what Series did you assign it at the beginning to reassign it (4), you can store the Series you assigned when setting to nil (at point 3). Ie:
And then restore that series (at point 4):
By default, Series is nil (1). You can check it with this example:JimR wrote:I meant your first example"
"Assigning nil to the TDragMarksTool's Series property should enable it for all the series."
How does one undo that ?
Code: Select all
uses Series, TeeTools;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Chart1.View3D:=False;
for i:=0 to 3 do
with Chart1.AddSeries(TPointSeries) do
begin
Marks.Visible:=True;
FillSampleValues(5);
end;
Chart1.Tools.Add(TDragMarksTool);
if (Chart1.Tools[0] as TDragMarksTool).Series = nil then
Caption:='Series is nil'
else
Caption:='Series is assigned';
end;
Code: Select all
var mySeries: TChartSeries;
//...
mySeries:=(Chart1.Tools[0] as TDragMarksTool).Series;
(Chart1.Tools[0] as TDragMarksTool).Series:=nil;
Code: Select all
(Chart1.Tools[0] as TDragMarksTool).Series:=mySeries;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: DragMarks tool
ok, that is clearer. Thanks again.