Page 1 of 1

Contour fill problem

Posted: Thu Jul 24, 2008 3:01 pm
by 5886715
Hi,
I am using TeeChart Pro v8.02 VCL in Delphi6
I am trying to use the ContourSeries and fill the contours as is done in the TeeDemo program (see Tee8New -> Welcome->New In Series -> Contour -> Filled). This works ok if the series data comes from FillSampleValues BUT when I fill the data by reading an ASCII file the data are cleared when I execute this code: ContourSeries1.Brush.Style:=bsClear

My test program is mostly copied section from the demos...
I use this routine to fill the contours:

If CheckBox1.Checked then
ContourSeries1.Brush.Style:=bsSolid
Else
ContourSeries1.Brush.Style:=bsClear;

and I use this to read the data:

begin
With SeriesTextSource1 do
begin
Series := SurfaceSeries1;
SeriesTextSource1.HeaderLines := 1;
Fields.Clear;
AddField('X',1);
AddField('Y',2);
AddField('Z',3);
FieldSeparator := #9;
DecimalSeparator := '.';
FileName := 'test.txt';
Active := True;
end;

ContourSeries1.DataSource := SurfaceSeries1;
end;

I have found that the only way to keep the data with a ContourSeries1.Brush.Style:=bsClear statement is to use a ContourSeries AND a SurfaceSeries in the same Chart. The SurfaceSeries can set set to not active. The data must be loaded into the SurfaceSeries (as in the above routine).

What I am really trying to do is fill only one of the contour levels. To do this I tried this:

procedure TForm1.ContourSeries1GetLevel(Sender: TContourSeries;
LevelIndex: Integer; var Value: Double; var Color: TColor);
begin
/ Only color Level 3
If (LevelIndex=1) then
Color:=clBlue
Else
Color := clNone
end;

This also only works if I fill the ContourSeries with FillSampleValues but... When I use real data (even when I load the data into a SurfaceSeries first) the statement Color := clNone does not work.

I am I doing something wrong or is this a bug?
Thanks,
Bob

Posted: Mon Jul 28, 2008 9:29 am
by narcis
Hi Bob,

Could you please 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.

Thanks in advance.

example program

Posted: Mon Jul 28, 2008 10:48 am
by 5886715
Hi,
Thanks much for the response. I will send an example program tonight (in about 9 hrs) when I get back.
Thanks,
Bob

Test program uploaded

Posted: Mon Jul 28, 2008 2:56 pm
by 5886715
Hi,
While working through my test program I found some info on the forum suggesting that I can use "SeriesTextSource1.LoadFromFile" instead of
"SeriesTextSource1.Active := True"

This seems to stop the data from being cleared when I click the solid checkbox but...

With LoadFromFile the series colors seem to turn to black&white and the fill option no longer works.

Strange... I guess I must be something wrong!

Eventually, I would like to have only one level filled with color (see my "Fill only Level 3" checkbox).

Thanks for looking at this,
Bob

Posted: Tue Jul 29, 2008 8:57 am
by narcis
Hi Bob,

Thanks for the example project. I could reproduce the issue here and it seems a bug to me. I've added it (TV52013279) to the bug list to be fixed for next releases.

Contour fill bug

Posted: Tue Jul 29, 2008 11:26 am
by 5886715
Hi,
Do you think this bug will be fixed in the near future?
If so, is there a way I can track this bug nr? I don't see tacking nrs in the "Lat est vision Information".

Is there a way to draw a region on the chart so I can manually fill in the contour segments? I can read each level and get the pixel coordinates to the contour segments... I would be more than happy if I could somehow use this data to draw a matching region on the plot so it looks like the contour segment is filled.
Thanks
Bob

Posted: Tue Jul 29, 2008 12:02 pm
by narcis
Hi Bob,
Do you think this bug will be fixed in the near future?
I can't give you an estimate date. However, I've added this is as a high priority item and since there are other contour fill related issues, I imagine that it's likely to be fixed sometime soon.
If so, is there a way I can track this bug nr? I don't see tacking nrs in the "Lat est vision Information".
We haven't done so with current VCL. However we started including issue tracking numbers in the release notes with other TeeChart versions releases and also have done so for v8.03 which currently is in release candidate stage. I'll send you an e-mail with the URL for downloading it.
Is there a way to draw a region on the chart so I can manually fill in the contour segments? I can read each level and get the pixel coordinates to the contour segments... I would be more than happy if I could somehow use this data to draw a matching region on the plot so it looks like the contour segment is filled.
You could try using Chart1.Canvas.Polygon method for that.

Contour fill bug

Posted: Tue Jul 29, 2008 12:51 pm
by 5886715
Hi,
If I use the Canvas.Polygon method is it possible to do a fill with a semi-transparent color (set at 50% or so)?

I think TeeChart is a very powerful wonderful tool and the forum/support makes it priceless!

Thanks again for the help,
Bob

Posted: Tue Jul 29, 2008 12:58 pm
by narcis
Hi Bob,
If I use the Canvas.Polygon method is it possible to do a fill with a semi-transparent color (set at 50% or so)?
To achieve that you should use canvas blending as in the example I posted here:

http://www.teechart.net/support/viewtopic.php?t=3191
I think TeeChart is a very powerful wonderful tool and the forum/support makes it priceless!
Thank you very much :!: