problem with Transparency, TColorGridSeries, IrregularGrid

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
dave novo
Newbie
Newbie
Posts: 25
Joined: Tue Oct 23, 2007 12:00 am

problem with Transparency, TColorGridSeries, IrregularGrid

Post by dave novo » Thu Feb 05, 2009 1:27 am

Hello,

I am having trouble with the following code (put in the formCreate of a form with a TChart called Chart1):

Code: Select all

var
  xcntr: Integer;
  ycntr: Integer;
  newSeries: TColorGridSeries;
begin
  newSeries:=TColorGridSeries.Create(chart1);
  newSeries.ParentChart:=chart1;
  newSeries.Pen.Visible:=False;
  newSeries.BeginUpdate;
  for xcntr := 0 to 100  do
    for ycntr := 0 to 100  do
      newSeries.AddXYZ(xcntr,0,ycntr,'',clYellow);
  newSeries.EndUpdate;

  newSeries:=TColorGridSeries.Create(chart1);
  newSeries.ParentChart:=chart1;
  newSeries.Pen.Visible:=False;
  newSeries.IrregularGrid:=True;
  newSeries.Transparency:=50;
  newSeries.BeginUpdate;
  for xcntr := 50 to 100  do
    for ycntr := 50 to 100  do
      newSeries.AddXYZ(xcntr,0,ycntr,'',clBlue);
  newSeries.EndUpdate;
If I have IrregularGrid set to True, then I just get a grey box where the blue pixels should be.

If I set IrregularGrid to false, I get blue pixels with no transparency.

is there something I can do to make this work?

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

Post by Yeray » Thu Feb 05, 2009 9:18 am

Hi dave,

I've been testing this and I've noticed that:

1. When IrregularGrid is set to True, you got a gray box, yes. But if you play with different transparencies you'll see that this may be the expected effect having yellow with 50% transparent blue.

2. When IrregularGrid is set to False, it seems that the transparency is only applied to the first cell of the blue ColorGrid. So I've added it to the wish list to be fixed in further releases (TV52013832).
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

dave novo
Newbie
Newbie
Posts: 25
Joined: Tue Oct 23, 2007 12:00 am

Post by dave novo » Thu Feb 05, 2009 3:04 pm

Hi Yeray,

the problem is deeper than that I think. First of all yellow+blue make green. I am not sure how yellow and blue make gray. But that may be expected

When irregularGrid=False, it works fine if you start at (0,0) instead of offsetting it.

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

Post by Yeray » Thu Feb 05, 2009 4:21 pm

Hi dave,

Of course, yellow and blue should make green. But we have to analyze if implementing the real expected combination represents a reasonable spent of resources or not.

We'll also study the situation for different positions of the grids.
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

dave novo
Newbie
Newbie
Posts: 25
Joined: Tue Oct 23, 2007 12:00 am

Post by dave novo » Thu Feb 05, 2009 4:41 pm

Hi Yeray,

In that case, can you suggest any way that I can add a second colorGridSeries that does not start at (0,0) and displays with a transparency. I cannot seem to get it to work. I have gotten a sample app to work with IrregularGrid=true, but then when I use that technique with real data I get a crash in Tchart when it is searching through the sorted data. It is some part of the code that is doing a binary search and crashing. So that did not work....

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

Post by Yeray » Fri Feb 06, 2009 9:50 am

Hi dave,

Well, while the color combination doesn't work as one would like, maybe you could consider applying transparency to both color grids. This looks a little bit better:

Code: Select all

var
  xcntr: Integer;
  ycntr: Integer;
  newSeries: TColorGridSeries;
begin
  newSeries:=TColorGridSeries.Create(chart1);
  newSeries.ParentChart:=chart1;
  newSeries.Pen.Visible:=False;
  newSeries.Transparency:=50;
  for xcntr := 0 to 100  do
    for ycntr := 0 to 100  do
      newSeries.AddXYZ(xcntr,0,ycntr,'',clYellow);

  newSeries:=TColorGridSeries.Create(chart1);
  newSeries.ParentChart:=chart1;
  newSeries.Pen.Visible:=False;
  newSeries.IrregularGrid:=true;
  newSeries.Transparency:=50;
  for xcntr := 50 to 100  do
    for ycntr := 50 to 100  do
      newSeries.AddXYZ(xcntr,0,ycntr,'',clBlue);
And regarding the crash you are getting, we'll really appreciate if you could send us a simple example project we can run "as-is" to reproduce the problem here.
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
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