Save Palette in SaveChartToStream does not work

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
AST
Newbie
Newbie
Posts: 6
Joined: Wed Jan 30, 2008 12:00 am

Save Palette in SaveChartToStream does not work

Post by AST » Mon Feb 11, 2013 7:05 am

Problem:
we save all settings for the Chart with the function SaveChartToStream
The new default palette is Opera
Open the Setup and select as palette Standard or TeeChart
>> No entry in the saved configuration for the slected palette
>> Is it not possible to save the standard palette setting

We can't change the registry entries at the customer side to something else, moth of our customers do not have admin rights!

We are probing around with the palette problem since quite a while, please try to fix this as soon as possible.

Thanks in advance.

>>EDIT

When choosing Palette Standard or TChart >>entry ColorPaletteIndex in the stream is missing
Reopening the Chart LINE 2312 in CHART.PAS sets it to ColorPaletteIndex 13 if there is no Registry entry SetColorPaletteIndex(TeeReadIntegerOption('DefaultPalette',13));

Changing this line in SetColorPaletteIndex(0); everything works fine

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

Re: Save Palette in SaveChartToStream does not work

Post by Yeray » Tue Feb 12, 2013 11:50 am

Hi,

Then, you set the default palette to be the Classic TeeChart palette, and now it works as you wish, isn't it?
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

AST
Newbie
Newbie
Posts: 6
Joined: Wed Jan 30, 2008 12:00 am

Re: Save Palette in SaveChartToStream does not work

Post by AST » Tue Feb 19, 2013 1:49 pm

Yeray wrote:Hi,

Then, you set the default palette to be the Classic TeeChart palette, and now it works as you wish, isn't it?
Hi, Yeray

please try the following test:
no registry entry

Open the chart editor, select Opera, save settings using SaveChartToStream
Reopen Chart editor>>OPERA is selected , select TeeChart, save using SaveChartToStrem
Reopen Chart Editor >> OPERA is selected

There is no way to save the old default or tchart palette.

Please give it a try.

Thanks in advance

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

Re: Save Palette in SaveChartToStream does not work

Post by Yeray » Wed Feb 20, 2013 3:03 pm

Hello,

I think I understood the problem.
This line in Chart.pas:

Code: Select all

 SetColorPaletteIndex(TeeReadIntegerOption('DefaultPalette',13));
Should be

Code: Select all

SetColorPaletteIndex(TeeReadIntegerOption('DefaultPalette',TeeNewChartPalette));
So the TeeNewChartPalette can be used when the Palette isn't found in the registry, instead of forcing the 13, OperaPalette.

We're investigating if this is the best way to go and we'll be back to you asap.
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

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

Re: Save Palette in SaveChartToStream does not work

Post by Yeray » Mon Feb 25, 2013 3:11 pm

Hello again,

I initially thought the intention of this was to define the palette for a new chart creation. To do something like in the "Options..." option in the contextual menu at design time, in the "New Chart" tab, where you can select the palette for the new charts that will be created.
This makes sense with the SetColorPaletteIndex call in Chart.pas mentioned in my last reply.

However, I don't see how this relates with the SaveToStream function. Note SaveChartToStream function is used by SaveChartToChart, and saving a chart to a file seems to save the ColorPalette correctly; running the following code produces a test.txt file where I can find the "ColorPaletteIndex = 0" property correctly serialized, so this is not the problem.

Code: Select all

uses Series, TeeStore, TeeURL;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Chart1.ColorPaletteIndex:=0;
  Chart1.AddSeries(TPieSeries).FillSampleValues;
  SaveChartToFile(Chart1, 'C:\tmp\test.txt', true, true);
end;
I can import in a chart where the defaultpalette is Opera and in a machine where the DefaultPalette key isn't present in the registry:

Code: Select all

procedure TForm1.Button2Click(Sender: TObject);
var ImportChart: TImportChart;
begin
  ImportChart:=TImportChart.Create(Self);
  ImportChart.Chart:=Chart1;
  ImportChart.LoadFromFile('C:\tmp\test.txt');
end;
Furthermore, following the instructions here, I don't get the same result than you:
AST wrote:Open the chart editor, select Opera, save settings using SaveChartToStream
Reopen Chart editor>>OPERA is selected , select TeeChart, save using SaveChartToStrem
Reopen Chart Editor >> OPERA is selected
I strictly do:
- Create a new project, D7 + TeeChart v2012.07.
- Add a TChart to the form.
- Backup and remove the "DefaultPalette" key in the registry at "HKEY_CURRENT_USER\Software\Steema Software\TeeChart Pro\Editor".
- Open the Themes tab in the chart editor. Check the palette selected is Opera.
- Place a button, make it use the following code and execute the application and the button:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  SaveChartToFile(Chart1, 'C:\tmp\test.txt', true, true);
end;
If I open the generated text.txt I see the line "ColorPaletteIndex = 13".
- Stop the application.
- Open the Themes tab in the chart editor. Change the palette from Opera to TeeChart.
- Execute the application and the button again. If I open the generated text.txt I see the line "ColorPaletteIndex = 0".
- Open the Themes tab in the chart editor. According to your instructions, you see the Opera palette is selected. However, I see the Default palette selected.

So this seems to work fine for me here. And I've also checked the registry and the "DefaultPalette" entry isn't present.
Do you see any relevant step I could miss?
Attachments
test.zip
(880 Bytes) Downloaded 302 times
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