Palette Update Problem

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
X-ray
Newbie
Newbie
Posts: 12
Joined: Thu Dec 15, 2022 12:00 am

Palette Update Problem

Post by X-ray » Fri Dec 15, 2023 1:30 pm

Hello TChart Team,

There is a problem/bug since the latest version of TChart VCL, with the Display of 3DGridSeries when "UsePalette" is set/used.
Everything is displayed in just ONE color and the Legend just shows Zeros.
PaletteProblemCapture1.PNG
PaletteProblemCapture1.PNG (134.4 KiB) Viewed 17002 times
When I then go into the Chart dialog and Set "UsePaletteMin / Auto" to TRUE :
PaletteProblemCapture2.PNG
PaletteProblemCapture2.PNG (78.38 KiB) Viewed 17002 times
Its starts to get "normal":
PaletteProblemCapture3.PNG
PaletteProblemCapture3.PNG (335.57 KiB) Viewed 17002 times
Note that we do all Chart operation in code and when I set "UsePaletteMin" to True for the 3DGridSeries in Code, that
doesn't help, we still get the ONE Color Chart and zeros in the Legend. Only when I open the TChart Editor Dialog things get correctly updated. Is this bug known and fixed already?

Thanks and best regards,

Thomas

X-ray
Newbie
Newbie
Posts: 12
Joined: Thu Dec 15, 2022 12:00 am

Re: Palette Update Problem

Post by X-ray » Fri Dec 15, 2023 9:05 pm

I just found out that I can fix this problem by calling "CreateDefaultPalette()" After populating TSurfaceSeries or TColorGridSeries.
That call was not required in previous versions of TChart VCL.

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

Re: Palette Update Problem

Post by Yeray » Fri Dec 22, 2023 9:11 am

Hello,

When the chart is being drawn, the CheckPaletteEmpty method should be called, which calls CreateDefaultPalette in these conditions:

Code: Select all

// Default palette should be re-created when: series has data, and
// when palette is empty or "dirty" and not custom.
Procedure TCustom3DPaletteSeries.CheckPaletteEmpty;
begin
  if (Count>0) and ( (Length(FPalette)=0) or (IDirtyPalette and (not ICustomPalette))) then
     CreateDefaultPalette;
end;
This simple example seems to correctly initialize the palette for me here:

Code: Select all

uses Chart, TeeSurfa;

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
var x, z: Integer;
begin
  Chart1:=TChart.Create(Self);

  with Chart1 do
  begin
    Parent:=Self;
    Align:=alClient;
    Color:=clWhite;
    Gradient.Visible:=False;
    Walls.Back.Color:=clWhite;
    Walls.Back.Gradient.Visible:=False;
    View3DOptions.Orthogonal:=False;
    Chart3DPercent:=100;
    Aspect.Zoom:=75;

    with TSurfaceSeries(AddSeries(TSurfaceSeries)) do
    begin
      UseColorRange:=False;
      UsePalette:=True;

      for x:=0 to 9 do
        for z:=0 to 9 do
          AddXYZ(x, x+z, z);
    end;
  end;
end;
surface.png
surface.png (76.19 KiB) Viewed 16817 times
Do you see if I'm missing anything here?
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