Grid header is affected by legend shadow

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
InfraTec
Newbie
Newbie
Posts: 18
Joined: Tue May 09, 2023 12:00 am

Grid header is affected by legend shadow

Post by InfraTec » Mon Nov 06, 2023 4:22 pm

I have a TeeChart at one panel and a TeeGrid at another panel. If the chart has a legend with shadow, the grid column headers are drawn with shadow color background! There should not be a connection.

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

Re: Grid header is affected by legend shadow

Post by Yeray » Tue Nov 07, 2023 8:52 am

Hello,

I don't see that connection with this example:

Code: Select all

uses Tee.GridData.Rtti;

var Chart: TChart;
    Grid: TTeeGrid;

procedure TForm1.FormCreate(Sender: TObject);
var topPanel,
    botPanel: TPanel;
    data: TChartValueList;
begin
  topPanel:=TPanel.Create(Self);
  topPanel.Parent:=Self;
  topPanel.Align:=alTop;
  topPanel.Height:=Self.Height div 2;

  botPanel:=TPanel.Create(Self);
  botPanel.Parent:=Self;
  botPanel.Align:=alClient;

  Chart:=TChart.Create(Self);
  Chart.Parent:=topPanel;
  Chart.Align:=alClient;

  Grid:=TTeeGrid.Create(Self);
  Grid.Parent:=botPanel;
  Grid.Align:=alClient;

  Chart.View3D:=False;
  Chart.AddSeries(TBarSeries).FillSampleValues;

  data:=Chart[0].YValues;
  Grid.Data:=TVirtualData<TChartValueList>.Create(data);


  Chart.Legend.Shadow.Size:=8;
  Chart.Legend.Shadow.Color:=clRed;

  Grid.Header.Format.Brush.Gradient.Hide;
  Grid.Header.Format.Brush.Color:=clGreen;
end;
Chart-Grid.png
Chart-Grid.png (16.82 KiB) Viewed 37380 times
If you still find problems with it, please modify the example above so we can reproduce the problem here, or arrange a simple example project we can run as-is here.

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

InfraTec
Newbie
Newbie
Posts: 18
Joined: Tue May 09, 2023 12:00 am

Re: Grid header is affected by legend shadow

Post by InfraTec » Thu Nov 16, 2023 9:39 am

The effect isn't visible with your example. But with modification to LineSeries I got the issue:
Shadow.JPG
My example
Shadow.JPG (47.77 KiB) Viewed 36966 times

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

Re: Grid header is affected by legend shadow

Post by Yeray » Thu Nov 16, 2023 1:06 pm

Hello,

I'm afraid changing from TBarSeries to TLineSeries doesn't change the Grid for me here.
Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
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

InfraTec
Newbie
Newbie
Posts: 18
Joined: Tue May 09, 2023 12:00 am

Re: Grid header is affected by legend shadow

Post by InfraTec » Fri Nov 17, 2023 7:54 am

Here is my example.
Attachments
SteemaExample.zip
(90.22 KiB) Downloaded 1934 times

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

Re: Grid header is affected by legend shadow

Post by Yeray » Sat Nov 18, 2023 9:46 am

Hello,

Thanks for the project. We could reproduce the problem and we've been able to fix it.

In the PrepareGradient nested method, inside the TFMXPainter.SetBrush method, in FMX/FMXTee.Painter.pas unit, replace this:

Code: Select all

procedure TFMXPainter.SetBrush(const ABrush: TBrush);
//...
  procedure PrepareGradient(const AGradient:FMXGradient);
  //...
  begin
    AGradient.Color:=Color0;
    AGradient.Color1:=Color1;
    //...
For this:

Code: Select all

procedure TFMXPainter.SetBrush(const ABrush: TBrush);
//...
  procedure PrepareGradient(const AGradient:FMXGradient);
  //...
    // Do not use AGradient Color0 and Color1. Instead, reset Points property.
    // When using a TChart and a TeeGrid together,
    // the chart canvas uses 3 point gradients, so it must be reset to 2:

    procedure ResetGradientPoints;
    var P : TGradientPoint;
    begin
      AGradient.Points.Clear;

      P:=TGradientPoint(AGradient.Points.Add);
      P.IntColor:=Color0;

      P:=TGradientPoint(AGradient.Points.Add);
      P.IntColor:=Color1;
      P.Offset:=1;
    end;

  begin
    ResetGradientPoints;
    //...
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

InfraTec
Newbie
Newbie
Posts: 18
Joined: Tue May 09, 2023 12:00 am

Re: Grid header is affected by legend shadow

Post by InfraTec » Mon Nov 20, 2023 8:14 am

I changed the code as you suggested. But the method isn't used by the example program. Do I have to change anything else?

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

Re: Grid header is affected by legend shadow

Post by Yeray » Mon Nov 20, 2023 9:38 am

Hello,

After applying the changes to the .pas unit you have two options to use the modified sources:
- Rebuild the sources with TeeGridRecompile and keep using the "[...]\Steema TeeGrid for VCL & FMX Registered version XX\Compiled\DelphiXX.win32\Lib" path.
- Change the library path to directly use the sources. To do this, remove the reference to the "[...]\Steema TeeGrid for VCL & FMX Registered versionXX\Compiled\DelphiXX.win32\Lib" path and add "[...]\Steema TeeGrid for VCL & FMX Registered versionXX\Sources" and "[...]\Steema TeeGrid for VCL & FMX Registered versionXX\Sources\FMX" paths.
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

InfraTec
Newbie
Newbie
Posts: 18
Joined: Tue May 09, 2023 12:00 am

Re: Grid header is affected by legend shadow

Post by InfraTec » Mon Nov 20, 2023 2:19 pm

Thank you, now it is working :)

Post Reply