Hi,
Tis me again
The schemes change colours and backgrounds beautifully BUT not the title fonts. How do you edit the schemes especially the titles please?
Thanking you
Morton
More advanced Schemes
Hi, Morton.
All you have to do is define any additional chart properties you want to change in your theme Apply method. Here is part of the TWebTheme.Apply implementation:
If you want to change chart Title properties, you derive new theme from your current theme and add the following lines in the Apply method (just an example):
Also, check the theme examples in Teechart demo. They should give you some additional tips on how to build custom chart themes.
All you have to do is define any additional chart properties you want to change in your theme Apply method. Here is part of the TWebTheme.Apply implementation:
Code: Select all
procedure TWebTheme.Apply;
Const clDarkSilver=$C4C4C4;
WebFont='Lucida Console';
var t : Integer;
begin
inherited;
Chart.BevelInner:=bvNone;
Chart.BevelOuter:=bvNone;
Chart.Border.Visible:=True;
Chart.BorderRound:=0;
Chart.Border.Width:=1;
Chart.Border.Color:=clBlack;
Chart.Gradient.Visible:=False;
// ...
Code: Select all
procedure TYourTheme.Apply;
begin
inherited;
with Chart.Title do
begin
Font.Name:='Arial';
Font.Size:=10;
Font.Color:=clNavy;
Font.Style:=[fsBold];
end;
end;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
Many thanks BUT... How can I apply this to an EXISTING theme.
1. Being each theme now has a changed title font each say excel has a large one, blues a small one ands so on...
2. A global font for all the titles that the themes don't override - so you set the font opnce and any theme you choose keeps the same title font.
3. The final thought is how does one do all this create a brand new theme... based on say the Excel one and call it Excel2 or from scratch...
Thanking you again
Morton
1. Being each theme now has a changed title font each say excel has a large one, blues a small one ands so on...
2. A global font for all the titles that the themes don't override - so you set the font opnce and any theme you choose keeps the same title font.
3. The final thought is how does one do all this create a brand new theme... based on say the Excel one and call it Excel2 or from scratch...
Thanking you again
Morton
Hi, Morton.
If you have TeeChart source code, you can add relevant parts to theme Apply method. Or alternatively (much better) derive new theme from your existing theme, inherit it's Apply method and add additional properies you want to set. The code is really simple:
Now the TMyTheme will inherit all TExcelTheme properties + add your own. Of course, you can also derive directly from TChartTheme and fully customize everything in the Apply method implementation.
I hope this will help you in deriving and using new custom theme.
If you have TeeChart source code, you can add relevant parts to theme Apply method. Or alternatively (much better) derive new theme from your existing theme, inherit it's Apply method and add additional properies you want to set. The code is really simple:
Code: Select all
TMyTheme = class( TExcelTheme)
public
procedure Apply; override;
class function Description:String; override;
end;
procedure TMyTHeme.Apply;
begin
inherited;
with Chart.Title do
begin
Font.Name:='Arial';
Font.Size:=10;
Font.Color:=clNavy;
Font.Style:=[fsBold];
end;
end;
function TMyTheme.Description: string;
begin
result:='My custom theme';
end;
initialization
RegisterChartThemes([ TMyTheme ]);
I hope this will help you in deriving and using new custom theme.
Marjan Slatinek,
http://www.steema.com
http://www.steema.com