Legend Problem when using pattern fills in barcharts

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
cheaps
Newbie
Newbie
Posts: 17
Joined: Thu Mar 25, 2004 5:00 am
Location: Boston MA
Contact:

Legend Problem when using pattern fills in barcharts

Post by cheaps » Wed Aug 12, 2009 2:56 am

Hi

When creating bar charts with patterned fills, the bars and legend fills look fine in a standard bar chart but in in TChartEditor or a TTeePreviewPanel the bars look OK while the legend appears as a black or white box. The problem occurs in Teechart 805 but disappears if I recompile with TeeChart 7. I am using Delphi 20006 on windows vista. Please see simple attached sample program that demonstrates the problem.

Thanks for any assistance or suggestions on how to tweak TeeChart code.

Charlie Heaps
Attachments
legend.zip
Delphi prog showing legend prob
(12.79 KiB) Downloaded 584 times

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

Re: Legend Problem when using pattern fills in barcharts

Post by Yeray » Wed Aug 12, 2009 11:30 am

Hi cheaps,

I've reproduced it with your application, then I've reduced your application to the following simple code in a clean TeeChart:

Code: Select all

uses series;

procedure TForm1.FormCreate(Sender: TObject);
var i: integer;
begin
  for i:=0 to 1 do
  begin
    Chart1.AddSeries(TBarSeries.Create(self));
    Chart1[i].FillSampleValues();
    Chart1[i].Brush.Style := bsBDiagonal;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ChartPreviewer1.Chart := Chart1;
  ChartPreviewer1.Execute;
end;
Note that you can see the same with a TChartPreviewer and with a TTeePreviewPanel. So I've added it to the wish list to be fixed in future releases (TV52014348).
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

cheaps
Newbie
Newbie
Posts: 17
Joined: Thu Mar 25, 2004 5:00 am
Location: Boston MA
Contact:

Re: Legend Problem when using pattern fills in barcharts

Post by cheaps » Wed Aug 12, 2009 10:51 pm

Thanks - was kinda hoping for a recommendation of a quick patch to the source code. Any chance of that?

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

Re: Legend Problem when using pattern fills in barcharts

Post by Yeray » Thu Aug 13, 2009 8:54 am

Hi cheaps,

I'm afraid that I can't think on a really simple solution right now. What I've seen is that the demo at All features/Welcome!/Miscellaneous/Legend/Symbol OnDraw doesn't seem to reproduce the problem. So an idea probably could be redrawing the symbols as images over the symbols.
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

cheaps
Newbie
Newbie
Posts: 17
Joined: Thu Mar 25, 2004 5:00 am
Location: Boston MA
Contact:

Re: Legend Problem when using pattern fills in barcharts

Post by cheaps » Sat Aug 22, 2009 6:44 pm

Really? I am surprised since this feature works perfectly in TeeChart 7? Cant you do a quick compare of the two source codes to see what has changed that might be causing this problem. I tried but this was a bit beyond my programming skill level.

This really is a fairly serious bug and I suggest it warrants your immediate attention.

Thanks for your consideration.

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

Re: Legend Problem when using pattern fills in barcharts

Post by Narcís » Fri Aug 28, 2009 9:49 am

Hi cheaps,

I found that implementing TCustomChart.DrawLegendShape in Chart.pas as shown below solves the issue.

Code: Select all

procedure TCustomChart.DrawLegendShape(const Rect: TRect);
begin
  with Legend.Symbol do
  if Gradient.Visible then
     Draw(Canvas.Brush.Color,Rect)
  else
     inherited;
end;
Actually this rolls back a change made during v8 development so I'm afraid fixing TV52014348 may brake something else. So we will appreciate if you let us know about anything related that doesn't work now. In the meantime I included this modification for next maintenance release.

Thanks in advance.
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

Post Reply