How to get TColorGrid scrolling

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Sciensoria
Newbie
Newbie
Posts: 7
Joined: Wed Nov 30, 2016 12:00 am

How to get TColorGrid scrolling

Post by Sciensoria » Thu Dec 28, 2023 5:05 pm

Hi Steema software support team,

I'm working on creating a time-frequency analysis map using TColorGrid, and I'm trying to implement scrolling functionality. Specifically, I want the map to continuously move with time.

Here's what I need to achieve:

New data values should be added to the bottom of the map as time progresses.
Old data values need to be removed from the top of the map to make room for the new data.
The map consists of approximately 200 rows, corresponding to a total time span of 200 milliseconds.
I'm looking for guidance on how to implement this scrolling behavior using TColorGrid in my project. Any help or pointers would be greatly appreciated!

Thanks in advance for your assistance

Sciensoria

Marc
Site Admin
Site Admin
Posts: 1217
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: How to get TColorGrid scrolling

Post by Marc » Fri Dec 29, 2023 9:08 am

Hello Sciensoria,

If you add a ColorGrid to a Chart and add the following code you'll see a basic scroll on the data:

Code: Select all

procedure TForm5.Button1Click(Sender: TObject);
begin
  Chart1.Axes.Bottom.Scroll(1);  //scroll right
end;

procedure TForm5.Button2Click(Sender: TObject);
begin
  Chart1.Axes.Bottom.Scroll(-1);  //scroll left
end;

procedure TForm5.FormCreate(Sender: TObject);
begin
 Series1.FillSampleValues(20);
 Chart1.Axes.Bottom.SetMinMax(5,15);
end;
You could add a timer to run those scrolls and automate it.

For the removal of points, it depends on the kind of data. Being a 3D dataset the number of points is proportional to x * y
values. ie. For this very simple dataset, with Integer indexed values of 0 to 19 (20 values) on the X and Y axes something like the following would work:

Code: Select all

procedure TForm5.Button1Click(Sender: TObject);
begin
  Chart1.Axes.Bottom.Scroll(1);
  //add new data ....and:
  DeleteFirstColumn;
end;

procedure TForm5.DeleteFirstColumn;
var i, NumberOfColumns : Integer;
begin
  NumberOfColumns :=  Round(Series1.XValues.MaxValue - Series1.XValues.MinValue) + 1;

  for i := 19 downto 0 do
    Series1.Delete(i*NumberOfColumns);
end;
That shows the basic principle, you'll need to make adjustments according to how your data is laid out. You will apply this vertically in place of the horizontal of this example.

Regards,
Marc Meumann
Steema Support

Sciensoria
Newbie
Newbie
Posts: 7
Joined: Wed Nov 30, 2016 12:00 am

Re: How to get TColorGrid scrolling

Post by Sciensoria » Tue Jan 23, 2024 7:57 pm

Dear Steema Support Team,

Thank you, Marc, very much for your explanation about how to make a colorgrid scrolling.

Currently, I am interested in customizing the color range to create a visually appealing color map. I've noticed that there are several properties available, such as StartColor, MidColor, EndColor, and StartZ, among others.

Could you kindly provide me with a complete example that demonstrates how to effectively use these properties in combination to achieve the desired color map customization? Your guidance and expertise in this matter would be greatly appreciated.

Thank you for your assistance.

Sincerely,

Sciensoria

Yeray
Site Admin
Site Admin
Posts: 9534
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: How to get TColorGrid scrolling

Post by Yeray » Thu Jan 25, 2024 7:52 am

Hello,

I'd suggest you to take a look at the ColorGrid example in the Features Demo shipped with the binary installer.
Here some screenshots changing some of the properties you mention:
viewtopic.php?f=3&t=16044&p=71207#p71207
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Sciensoria
Newbie
Newbie
Posts: 7
Joined: Wed Nov 30, 2016 12:00 am

Re: How to get TColorGrid scrolling

Post by Sciensoria » Sun Feb 04, 2024 2:03 am

Dear Yeray,
I am trying to customize a ColorGrid series in order to display appropriate colors corresponding to my input values. I have checked the link you provided
Yeray wrote:
Thu Jan 25, 2024 7:52 am
Hello,

I'd suggest you to take a look at the ColorGrid example in the Features Demo shipped with the binary installer.
Here some screenshots changing some of the properties you mention:
viewtopic.php?f=3&t=16044&p=71207#p71207
Among the pictures you provided in the link above, I see in the tab "Grid3D -> Palette -> Colors, you set Style=Custom, Custom Palettes = Rainbow and you have underneath 3 columns: index, Colors, UptoValue. You have different values -0.82, -0.754, -0.688, etc. corresponding to different colors on the left hand.

However, in my case, I cannot modifiy the values on the right hand: they are all 0.537 and I don't know how to change them.

In addition, I would like to know how to do this by code, especially in the run time.

Thank you for your support.

Sciensoria

Yeray
Site Admin
Site Admin
Posts: 9534
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: How to get TColorGrid scrolling

Post by Yeray » Wed Feb 07, 2024 2:41 pm

Hello Sciensoria,

Have you seen the example here?
It shows hot to create a custom palette.
mstsc_LnnsAn2IU7.png
mstsc_LnnsAn2IU7.png (148.58 KiB) Viewed 871 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply