Replacement for FillSequence after deleting data ?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Replacement for FillSequence after deleting data ?

Post by moelski » Thu Feb 21, 2008 12:41 pm

Hi !

I use this code to delete data from a chart:

Code: Select all

    // Daten löschen
    if Tool <> NIL then begin
      for i := Form1.MainChart[0].Count-1 downto 0 do
      begin
        tmp := Form1.MainChart[0].XValue[i];

        if ((tmp >= Tool.StartValue) and (tmp <= Tool.EndValue)) then
        begin
          for j := 0 to Form1.MainChart.SeriesCount - 1 do
            if Form1.MainChart[j].Count > 0 then
              Form1.MainChart[j].Delete(i);
        end;
      end;
   {   for j := 0 to Form1.MainChart.SeriesCount - 1 do
        Form1.MainChart[j].XValues.FillSequence;    }
    end;
It uses a TColorBandTool for selecting the area which will be deleted. This works nearly perfect, but I´m in big trouble with FillSequence.

We often have x values for the series which are in double format. So the increment from x value to the next x value is not 1.

If I run FillSequence it sets all X values to integer values with the increment of 1. This ends up in a wrong display for the x axis. The values are no longer correct.

So is there a FillSequence replacement which won´t destroy the X axis values?

Let me show you a simple example what I expect:
This should be my original x Axis vaules:

Code: Select all

0  0,5  1  1,5  2  2,5  3  3,5  4
Now I set my TColorBandTool and delete all values from 2 to 3.

The result after this step:

Code: Select all

0  0,5  1  1,5   3,5  4
What I need is this (the function should recalculate the values after 3):

Code: Select all

0  0,5  1  1,5   2   2,5
But FillSequence does this:

Code: Select all

0  1  2  3   4  5
Can you give me an example how I can realize this?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 21, 2008 2:27 pm

Hi Dominik,

The only way I can think of to achieve what you request is implementing your custom FillSequence method doing something like this:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  CustomFillSequence(Series1, 0.5);
end;

procedure TForm1.CustomFillSequence(Series: TChartSeries;
  Increment: double);
var i: Integer;
begin
  for i:=0 to Series.Count-1 do
    Series.XValue[i] := i*Increment;
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
Image Image Image Image Image Image
Instructions - How to post in this forum

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Fri Feb 22, 2008 10:20 am

Hi Narcis,

as usual ... works perfect. Thx alot !! :D

Post Reply