Page 1 of 1

How to get TColorGrid scrolling

Posted: Thu Dec 28, 2023 5:05 pm
by 16479670
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

Re: How to get TColorGrid scrolling

Posted: Fri Dec 29, 2023 9:08 am
by Marc
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

Re: How to get TColorGrid scrolling

Posted: Tue Jan 23, 2024 7:57 pm
by 16479670
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

Re: How to get TColorGrid scrolling

Posted: Thu Jan 25, 2024 7:52 am
by yeray
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

Re: How to get TColorGrid scrolling

Posted: Sun Feb 04, 2024 2:03 am
by 16479670
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

Re: How to get TColorGrid scrolling

Posted: Wed Feb 07, 2024 2:41 pm
by yeray
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 24225 times