Hi support,
a customer asked me the following and I can´t find an answer ...
Is it possible to select an x-area of the chart with the mouse and then delete the data I´ve selected?
Example ...
I have a chart with 2 fastline series. The X axis has values from 0 to 50.
I select the data from X value 0 to 20 and delete it.
After this procedure the X axis shows only the vales from 20 to 50. And the data from the both fastlines only have 30 x/y values.
Deleting mouse selected data ?
Deleting mouse selected data ?
Greetz Dominik
http://www.logview.info
http://www.logview.info
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dominik,
Yes, you could use a TColorBandTool for selecting the values as some code like this:
Yes, you could use a TColorBandTool for selecting the values as some code like this:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(50);
Series2.FillSampleValues(50);
ChartTool1.Axis:=Series1.GetHorizAxis;
ChartTool1.StartLine.AllowDrag:=true;
ChartTool1.StartLine.Active:=true;
ChartTool1.EndLine.AllowDrag:=true;
ChartTool1.EndLine.Active:=true;
ChartTool1.StartValue:=5;
ChartTool1.EndValue:=25;
end;
procedure TForm1.Button1Click(Sender: TObject);
var i: integer;
tmp: double;
begin
for i:=Series1.Count-1 downto 0 do
begin
tmp:=Series1.XValue[i];
if ((tmp>=ChartTool1.StartValue) and (tmp<=ChartTool1.EndValue)) then
begin
Series1.Delete(i);
Series2.Delete(i);
end;
end;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi Narcis,
I did a test today and it works nearly perfect.
I have only one problem left ...
Is it possible to recalculate the X Axis?
Example:
If I delete the data from XValue 0 - 20 the x axis starts from 21 after deleting. But it would be better if the Axis starts from 0 again.
Same problem if I delete values from 10-20 for example. Only the Y data is deleted and not the x values.
I can make two pictures is necessary.
I did a test today and it works nearly perfect.
I have only one problem left ...
Is it possible to recalculate the X Axis?
Example:
If I delete the data from XValue 0 - 20 the x axis starts from 21 after deleting. But it would be better if the Axis starts from 0 again.
Same problem if I delete values from 10-20 for example. Only the Y data is deleted and not the x values.
I can make two pictures is necessary.
Greetz Dominik
http://www.logview.info
http://www.logview.info
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dominik,
Ok, then the solution is pretty easy. You can force sequential values in series using FillSequence as shown here:
Ok, then the solution is pretty easy. You can force sequential values in series using FillSequence as shown here:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var i: integer;
tmp: double;
begin
for i:=Series1.Count-1 downto 0 do
begin
tmp:=Series1.XValue[i];
if ((tmp>=ChartTool1.StartValue) and (tmp<=ChartTool1.EndValue)) then
begin
Series1.Delete(i);
Series2.Delete(i);
end;
end;
Series1.XValues.FillSequence;
Series2.XValues.FillSequence;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi Narcis,
I´m speechless, really !
There is actually no day (until we bought TChart) where I don´t found any amazing feature in TChart.
Thx alot for your help !!!
I´m speechless, really !
There is actually no day (until we bought TChart) where I don´t found any amazing feature in TChart.
Thx alot for your help !!!
Greetz Dominik
http://www.logview.info
http://www.logview.info
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dominik,
You're very welcome! I'm glad to hear that.
You're very welcome! I'm glad to hear that.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |