Hi there!
I would like to know if it is possible to save ALL the Chart properties values to a file. I use the 'SaveChartToFile' procedure but there is a problem with it. This procedure does not save to file ALL the properties, only saves the non-default properties values. Example:
If you have a Chart with the property:
Legend.Visible = True
saving the chart to a file will not include the line 'Legend.Visible = True'
to the file because any chart has this property = true by default.
Then , if I load another Chart with the property Legend.Visible = false
from this file with 'LoadChartFromFile', the property Legend.Visible will
not change, it will be 'false'.
This problem would be solved saving all the chart properties values in the file.
Any solutions?
Thanks in advance.
Pablo.
Save ALL Chart properties values to a file
Hi Pablo,
SaveChartToFile does not saves all properties of Chart, only changes
to the default state, so you must initialize yourself the whole Chart
or at least some parameters that are important to you.
The best way to initialize a Chart is to re-create it:
SaveChartToFile does not saves all properties of Chart, only changes
to the default state, so you must initialize yourself the whole Chart
or at least some parameters that are important to you.
The best way to initialize a Chart is to re-create it:
Code: Select all
procedure InitChart(var Sender: TChart);
var tmp : TChart;
begin
tmp:=TChart.Create(Sender.Owner);
tmp.BoundsRect:=Sender.BoundsRect;
tmp.Parent:=Sender.Parent;
Sender.Free;
Sender:=tmp;
end;
//init default values
InitChart(Chart1);
//now load test.tee
LoadChartFromFile( TCustomChart(Chart1), 'test.tee');
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi Pep! This is the solution I took when I discover that problem, but there is another problem if you change the chart pointer. For example, if you have a PopupMenu assigned to the chart property 'PopupMenu', it will not be saved in the file with 'SaveChartToFile', you would have to assign it in your code, but I think it could be more properties like this.
It would be great to set the default values for an existing chart.
Anyway thank you so much.
Any more ideas?
Pablo.
It would be great to set the default values for an existing chart.
Anyway thank you so much.
Any more ideas?
Pablo.
Hi.
TChart uses Delphi streaming system to save it's properties and inherits all it's limitations. This means that in some cases you'll have to manually re-initialize some properties and events after chart is loaded. The easiest workaround I can think is to use the approach you're already using.
TChart uses Delphi streaming system to save it's properties and inherits all it's limitations. This means that in some cases you'll have to manually re-initialize some properties and events after chart is loaded. The easiest workaround I can think is to use the approach you're already using.
Marjan Slatinek,
http://www.steema.com
http://www.steema.com