TChart Editor save & restore custom themes

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Dave C.
Newbie
Newbie
Posts: 2
Joined: Fri Jun 25, 2021 12:00 am

TChart Editor save & restore custom themes

Post by Dave C. » Mon Jul 11, 2022 7:36 pm

Hello,

We use the TChart editor to allow our users to change the theme as follows:

Code: Select all

Procedure TForm1.ChangeTheme;
var
  tmpClass:TChartThemeClass;
begin
  tmpClass:=TChartThemeClass(ChartThemeSelector(Chart));
  ChartThemeIndx := ChartThemes.IndexOf(tmpClass);
  //Save ChartThemeIndex
…
When The user executes the app again, we restore the theme as follows:

Code: Select all

  ApplyChartTheme(ChartThemes.Theme[ChartThemeIndx],Chart, -1);
This works well, but it does not work for Custom themes saved by the TChart Editor and the tmpClass is set to nil. (I was hoping the TChartThemeClass would include the custom themes.)

How do I record what custom setting was selected in the editor and then restore that custom setting? Is there a better way to record the selected custom and standard theme and then restore it?

Thanks,

Dave

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

Re: TChart Editor save & restore custom themes

Post by Yeray » Mon Jul 18, 2022 2:23 pm

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

Dave C.
Newbie
Newbie
Posts: 2
Joined: Fri Jun 25, 2021 12:00 am

Re: TChart Editor save & restore custom themes

Post by Dave C. » Wed Jul 20, 2022 12:54 pm

Hi Yeray,

Yes, I have read the article. Thanks.

What I am looking for is what custom theme was selected by the user in the TChart editor and then apply that theme to the chart. I could not find the answer to that question in the article you suggested, and this may be my lack of knowledge with TChart.

Thanks,

Dave

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

Re: TChart Editor save & restore custom themes

Post by Yeray » Tue Jul 26, 2022 6:22 am

Hello Dave,

As described in that article, custom themes are useful to apply settings like font styles, colors and transparencies. If this is what you want to save and restore, you could save the theme as a chart (tee file) and load and apply it as a theme later.

If the settings you want to restore are more than what custom themes are able to, then I'm afraid custom themes won't be enough for you. In that case, you may want to manually import those extra properties you want to apply from your theme chart to your destination chart.
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