Page 1 of 1

Legend Problem when using pattern fills in barcharts

Posted: Wed Aug 12, 2009 2:56 am
by 9336879
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

Re: Legend Problem when using pattern fills in barcharts

Posted: Wed Aug 12, 2009 11:30 am
by yeray
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).

Re: Legend Problem when using pattern fills in barcharts

Posted: Wed Aug 12, 2009 10:51 pm
by 9336879
Thanks - was kinda hoping for a recommendation of a quick patch to the source code. Any chance of that?

Re: Legend Problem when using pattern fills in barcharts

Posted: Thu Aug 13, 2009 8:54 am
by yeray
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.

Re: Legend Problem when using pattern fills in barcharts

Posted: Sat Aug 22, 2009 6:44 pm
by 9336879
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.

Re: Legend Problem when using pattern fills in barcharts

Posted: Fri Aug 28, 2009 9:49 am
by narcis
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.