Gradients not showing if endcolor is set

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
niggle
Newbie
Newbie
Posts: 10
Joined: Tue Jan 28, 2020 12:00 am

Gradients not showing if endcolor is set

Post by niggle » Tue Jan 28, 2020 1:14 pm

I have a small problem with gradients not showing if the endcolor is set

Please see the sample code below

MyChart.View3D := True;

MyChart.Gradient.Direction := gdDiagonaldown;
MyChart.Gradient.StartColor := ClGreen;
MyChart.Gradient.EndColor := ClBlue;
MyChart.Gradient.Visible := True;

MyChart.Walls.Back.Gradient.StartColor := ClBlack;
MyChart.Walls.Back.Gradient.EndColor := ClGreen;
MyChart.Walls.Back.Transparent := False;
MyChart.Walls.Back.Gradient.Visible := True;
MyChart.Walls.Back.Visible := True;

MyChart.Shadow.Color := ClRed;
MyChart.Shadow.HorizSize := 10;
MyChart.Shadow.VertSize := 10;
MyChart.Border.Visible := True;


Commenting out the endcolor lines on both panel and wall does then allow some kind of gradient

Is this a bug?

(Latest TeeChart and Delphi 10.3.2)

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Gradients not showing if endcolor is set

Post by Marc » Tue Jan 28, 2020 4:13 pm

Greetings,

Your code with a new TeeChart on a new form, brings up a Chart that appears ok as per the code itself.
ChartGradient.png
ChartGradient.png (32.33 KiB) Viewed 28104 times
I'm using TeeChart Pro; I'll setup a machine with access to Standard but I wouldn't expect a difference.

Regards,
Marc

niggle
Newbie
Newbie
Posts: 10
Joined: Tue Jan 28, 2020 12:00 am

Re: Gradients not showing if endcolor is set

Post by niggle » Wed Jan 29, 2020 7:20 am

Hi Marc,

Many thanks for your time with this problem and its good to know that my code works on another system.

As it appears to be a problem with my installation (Either XE 10.3.2 or TeeChart Pro) could you point me in the direction of the files that would affect the endcolor and the boarder / Series Line Color settings please (if any)?

Just tested under XE10.2 and the same thing happens, very odd!

I will look into my XE 10.3.2 installation today.

Thanks again
Nigel (Cyprus)

niggle
Newbie
Newbie
Posts: 10
Joined: Tue Jan 28, 2020 12:00 am

Re: Gradients not showing if endcolor is set

Post by niggle » Wed Jan 29, 2020 11:13 am

Hi again,

Been through the installation of TeeChart 5 times after fully removing all old files.

Reinstalled XE10.3.2

The design time window works fine to set gradients and borders and fastline pen width etc.

The run time setting of these options in code does not work at all :(

Any ideas out there?

Thanks
Nigel (Cyprus)

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Gradients not showing if endcolor is set

Post by Marc » Wed Jan 29, 2020 4:00 pm

Hello Nigel,

Do you mean that the same code you posted up initially still doesn't work for you? Default Chart name is 'Chart1', if you start a new project from scratch and drop a chart on it, this (your code) should work ok:

Code: Select all

procedure TForm14.FormCreate(Sender: TObject);
begin
  Chart1.View3D := True;

  Chart1.Gradient.Direction := gdDiagonaldown;
  Chart1.Gradient.StartColor := ClGreen;
  Chart1.Gradient.EndColor := ClBlue;
  Chart1.Gradient.Visible := True;

  Chart1.Walls.Back.Gradient.StartColor := ClBlack;
  Chart1.Walls.Back.Gradient.EndColor := ClGreen;
  Chart1.Walls.Back.Transparent := False;
  Chart1.Walls.Back.Gradient.Visible := True;
  Chart1.Walls.Back.Visible := True;

  Chart1.Shadow.Color := ClRed;
  Chart1.Shadow.HorizSize := 10;
  Chart1.Shadow.VertSize := 10;
  Chart1.Border.Visible := True;
end;
I needed to add a uses: VCLTee.TeCanvas

I assume your FastLine Series has added with name "Series1". This code should work ok:

Code: Select all

Series1.Pen.Width := 5;
Series1.FillSampleValues();
If your basic project doesn't work, please could you send it to us (attach it to your post) and we'll check it here for any possible problem-cause.

With thanks.
Regards,
Marc

niggle
Newbie
Newbie
Posts: 10
Joined: Tue Jan 28, 2020 12:00 am

Re: Gradients not showing if endcolor is set

Post by niggle » Thu Jan 30, 2020 10:26 am

Hi Marc,


Yes any code i use does not work at runtime, I can set the gradient / backcolor etc at design time but no code that I try will work at run time.

Today I have installed.......
Windows on a clean machine (v8.1)
Rio 10.3.2
TeeChart Standard

Still no luck.

It appears that any calls I make to set colors / gradients / pen colors etc has no effect at runtime, its all very odd.

(I can email you the main executable if you wish but it wont let me load it on here Too Big as a Zip), but i have attached an image from the IDE with the project built and after I clicked the button.


The code I am using is here..........

(I renamed my chart to "Chart1" just in case it made any difference!)


procedure TForm6.Button1Click(Sender: TObject);
begin

Chart1.View3D := True;

Chart1.Gradient.StartColor := ClGreen;
Chart1.Gradient.EndColor := ClBlue;
Chart1.Gradient.Visible := True;

Chart1.Walls.Back.Gradient.StartColor := ClBlack;
Chart1.Walls.Back.Gradient.EndColor := ClGreen;
Chart1.Walls.Back.Transparent := False;
Chart1.Walls.Back.Gradient.Visible := True;
Chart1.Walls.Back.Visible := True;

Chart1.Shadow.Color := ClRed;
Chart1.Shadow.HorizSize := 10;
Chart1.Shadow.VertSize := 10;
Chart1.Border.Visible := True;

end;
Attachments
Project.png
Project.png (178.55 KiB) Viewed 28073 times

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Gradients not showing if endcolor is set

Post by Marc » Thu Jan 30, 2020 10:47 am

Hello Nigel,

Re.
I can email you the main executable if you wish but it wont let me load it on here, but i have attached an image from the IDE with the project built and after I clicked the button.
Yes, to upload the exe you could use this link.
http://steema.net/uploads/

The project itself would be interesting; to check whether any paths/parameters cause a block if compiled here.

With thanks.
Marc
Steema Support

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Gradients not showing if endcolor is set

Post by Marc » Thu Jan 30, 2020 10:59 am

..as a followup, I notice compiler messages in your project

Code: Select all

c:\program files (x86)\embarcadero\studio\20.0\lib\Win32\release\Controls.res resource kept; file c:\program files (x86)\embarcadero\studio\20.0\lib\Win32\release\FMX.Controls.Win.res resource discarded.
This is a VCL project, correct? I can't say I have an explanation for the message but it raises a question mark.

Someone on this thread came across the message in a VCL project too and there is a suggestion as to the cause.

Look for "I get the same warning error for my VCL program" in

https://forums.embarcadero.com/thread.j ... dID=256302

The issue may not be related but it is a possibility.

Regards,
Marc
Steema Support

niggle
Newbie
Newbie
Posts: 10
Joined: Tue Jan 28, 2020 12:00 am

Re: Gradients not showing if endcolor is set

Post by niggle » Thu Jan 30, 2020 11:00 am

Hi Marc,

I have fixed the discarded error and still the same.

I have uploaded the zipped version on the exe and a file called "code.txt" that is all the code from the test project

I hope this helps as I am confused

Best Regards
Nigel (Cyprus)

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Gradients not showing if endcolor is set

Post by Marc » Thu Jan 30, 2020 12:38 pm

Hello Nigel,

Ah, this is an FMX project. I'd assumed we we were looking at VCL.
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMXTee.Chart,
FMX.Controls3D, FMXTee.Chart3D, FMXTee.Series, FMXTee.Canvas, FMXTee.Procs,
FMX.StdCtrls, FMX.Controls.Presentation, FMXTee.Engine, VCL.Graphics, VCLTee.TeCanvas;
The VCL.Graphics, VCLTee.TeCanvas are superfluous.

Chart FMX colours and gradients have more variables.

This should work ok:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i : Integer;
begin
  Chart1.View3D := False;

  Chart1.Walls.Back.Gradient.StartColor := TAlphaColorRec.Red;
  Chart1.Walls.Back.Gradient.EndColor := TColorRec.Green;

  //optional ... set transparency
  for i := 0 to  Chart1.Walls.Back.Gradient.Colors.Count -1 do
    Chart1.Walls.Back.Gradient.Colors[i].Transparency := 50;

  Chart1.Walls.Back.Transparent := False;
  Chart1.Walls.Back.Gradient.Visible := True;
  Chart1.Walls.Back.Visible := True;
end;
Regards,
Marc

niggle
Newbie
Newbie
Posts: 10
Joined: Tue Jan 28, 2020 12:00 am

Re: Gradients not showing if endcolor is set

Post by niggle » Thu Jan 30, 2020 12:57 pm

Hi Marc,

Still no luck :-(

This acts just the same as before.

This is the exact code from my project now, there are no errors but also no changes to the chart when I click the button.

Any other thoughts?




unit Unit8;

interface


uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMXTee.Chart,
FMX.Controls3D, FMXTee.Chart3D, FMXTee.Series, FMXTee.Canvas, FMXTee.Procs,
FMX.StdCtrls, FMX.Controls.Presentation, FMXTee.Engine, VCL.Graphics, VCLTee.TeCanvas;


type
TForm8 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Chart1: TChart;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form8: TForm8;

implementation

{$R *.fmx}

procedure TForm8.Button1Click(Sender: TObject);
Var
I : Integer;
begin

Chart1.View3D := False;

Chart1.Walls.Back.Gradient.StartColor := TAlphaColorRec.Red;
Chart1.Walls.Back.Gradient.EndColor := TColorRec.Green;

//optional ... set transparency
for i := 0 to Chart1.Walls.Back.Gradient.Colors.Count -1 do
Chart1.Walls.Back.Gradient.Colors.Transparency := 50;

Chart1.Walls.Back.Transparent := False;
Chart1.Walls.Back.Gradient.Visible := True;
Chart1.Walls.Back.Visible := True;

end;

end.

niggle
Newbie
Newbie
Posts: 10
Joined: Tue Jan 28, 2020 12:00 am

Re: Gradients not showing if endcolor is set

Post by niggle » Thu Jan 30, 2020 2:20 pm

Hi Marc,

I have just run a VCL only project and the button click works for the win32 forms, I can set gradients etc okay.

Run a FMX project with the same calls and the same problem exists:-(

Not sure where to go from here


Nigel (Cyprus)

niggle
Newbie
Newbie
Posts: 10
Joined: Tue Jan 28, 2020 12:00 am

Re: Gradients not showing if endcolor is set

Post by niggle » Thu Jan 30, 2020 2:46 pm

Hi,

Got it working !!!!!!

Not too sure why yet, but made some changes to the Uses and FMX stuff and it now works

Many thanks you for all your time with this problem.

I hope not to come back to you

Nigel
(Cyprus)

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Gradients not showing if endcolor is set

Post by Marc » Thu Jan 30, 2020 2:55 pm

Ok, good to hear it's resolved.

Regards,
Marc
Steema Support

Post Reply