How to Copy Chart1 to ppTeeChart1, ie including all data?
How to Copy Chart1 to ppTeeChart1, ie including all data?
I need to copy a Chart to a ppTeeChart.
The Chart is set up by the user. The chart then needs to be copied as is to a ppTeeChart to be used in a ppReport.
I tried:
uses TeeStore, TeeEditPro
..
var
stream: TMemoryStream;
begin
stream:=TMemoryStream.Create;
try
SaveChartToStream(Chart1,stream);
stream.Position:=0;
LoadChartFromStream(TCustomChart(ppTeeChart1.Chart),stream);
finally
stream.Free;
end;
This doesn't compile ie the 'ppTeeChart1.Chart' part.
If I make this: LoadChartFromStream(TCustomChart(ppTeeChart1),stream);
ie get an access violation at runtime.
I also tried:
begin
ppTeeChart1.Chart.Assign(Chart1);
This works in that the chart appears with the title, but no series or legend or data?
Please could you help .. PS I? need the exact replica .ie a clone of the chart data and all.
Thanks in advance
Doogie
The Chart is set up by the user. The chart then needs to be copied as is to a ppTeeChart to be used in a ppReport.
I tried:
uses TeeStore, TeeEditPro
..
var
stream: TMemoryStream;
begin
stream:=TMemoryStream.Create;
try
SaveChartToStream(Chart1,stream);
stream.Position:=0;
LoadChartFromStream(TCustomChart(ppTeeChart1.Chart),stream);
finally
stream.Free;
end;
This doesn't compile ie the 'ppTeeChart1.Chart' part.
If I make this: LoadChartFromStream(TCustomChart(ppTeeChart1),stream);
ie get an access violation at runtime.
I also tried:
begin
ppTeeChart1.Chart.Assign(Chart1);
This works in that the chart appears with the title, but no series or legend or data?
Please could you help .. PS I? need the exact replica .ie a clone of the chart data and all.
Thanks in advance
Doogie
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Doogie,
Sorry but I can' tell you if this is supported in ppTeeChart as we are not the component developers. Digital Metaphors, ReportBuilder manufactureres, are the developers and the ones who support the ReportBuilder wrapper for TeeChart. So you may better ask them.
Another option is that you export the chart created with TeeChart to an image and then use this image in ReportBuilder.
Sorry but I can' tell you if this is supported in ppTeeChart as we are not the component developers. Digital Metaphors, ReportBuilder manufactureres, are the developers and the ones who support the ReportBuilder wrapper for TeeChart. So you may better ask them.
Another option is that you export the chart created with TeeChart to an image and then use this image in ReportBuilder.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Thanks Narcis.
Assign to Picture, works, but there is an issue with quality of final image, when scaled from screen display size, to paper size. So this one didn't work for me.
I tried the following code, and worked 100%:
ppTeeChart1.Chart.Assign(Chart1);
for x := 0 to Chart1.SeriesCount-1 do
ppTeeChart1.Chart.AddSeries(Chart1[x]);
I was advised to use the following code in a Digital Metaphors newsgroup:
"I use this source code :
for j := 0 to Chart.SeriesCount-1 do
CloneChartSeries(Chart[j]).ParentChart := ppTeeChart;
in your case
for j := 0 to Chart1.SeriesCount-1 do
CloneChartSeries(Chart1[j]).ParentChart := ppTeeChart1;"
but this didn't change anything, and nothing more than an empty chart displayed.
What did tickle me however, is that I can find NO documentation on CLONECHARTSERIES in your help files, also no example that uses this code.
Regards
Doogie
Assign to Picture, works, but there is an issue with quality of final image, when scaled from screen display size, to paper size. So this one didn't work for me.
I tried the following code, and worked 100%:
ppTeeChart1.Chart.Assign(Chart1);
for x := 0 to Chart1.SeriesCount-1 do
ppTeeChart1.Chart.AddSeries(Chart1[x]);
I was advised to use the following code in a Digital Metaphors newsgroup:
"I use this source code :
for j := 0 to Chart.SeriesCount-1 do
CloneChartSeries(Chart[j]).ParentChart := ppTeeChart;
in your case
for j := 0 to Chart1.SeriesCount-1 do
CloneChartSeries(Chart1[j]).ParentChart := ppTeeChart1;"
but this didn't change anything, and nothing more than an empty chart displayed.
What did tickle me however, is that I can find NO documentation on CLONECHARTSERIES in your help files, also no example that uses this code.
Regards
Doogie
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Doogie,
I'm glad to hear you solved the issue. You can find several CloneChartSeries examples at this forum using its search feature, for example here.
I'm glad to hear you solved the issue. You can find several CloneChartSeries examples at this forum using its search feature, for example here.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
I spoke too soon, well it works, but once you exit the report, all the original chart is destroyed, Ie series missing.
I was then advised by digital-metaphors to:
lMetaFile: TMetaFile;
lRect: TRect;
begin
lRect.Left := 0;
lRect.Top := 0;
lRect.Right:=ppImage1.spWidth;
lRect.Bottom:=ppImage1.spHeight;
lMetaFile := Chart1.TeeCreateMetafile(True,lRect);
ppImage1.Picture.Metafile.Assign(lMetaFile);
Well this works, and results in a properly scaled image, with the original quality! (You did advise me to use an image, but I exported to picture, and not this way)
I still don't understand why CloneSeriesData wont work .. but that left there.
Thanks once again
Doogie
I was then advised by digital-metaphors to:
lMetaFile: TMetaFile;
lRect: TRect;
begin
lRect.Left := 0;
lRect.Top := 0;
lRect.Right:=ppImage1.spWidth;
lRect.Bottom:=ppImage1.spHeight;
lMetaFile := Chart1.TeeCreateMetafile(True,lRect);
ppImage1.Picture.Metafile.Assign(lMetaFile);
Well this works, and results in a properly scaled image, with the original quality! (You did advise me to use an image, but I exported to picture, and not this way)
I still don't understand why CloneSeriesData wont work .. but that left there.
Thanks once again
Doogie
-
- Newbie
- Posts: 42
- Joined: Mon Jun 11, 2007 12:00 am
- Contact:
I try this solution :
[/b]
but Chart is unknowed..
may be an uses ?
thank you
Code: Select all
ppTeeChart1.Chart.Assign(Chart1);
but Chart is unknowed..
may be an uses ?
thank you
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hello,
Which is the exact error message you get?
Thanks in advance.
Which is the exact error message you get?
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 42
- Joined: Mon Jun 11, 2007 12:00 am
- Contact:
-
- Newbie
- Posts: 42
- Joined: Mon Jun 11, 2007 12:00 am
- Contact:
sorry, in fact :
thank you
Didier
Code: Select all
ppDPTeeChart1.Chart.Assign(DBCProductionMois);
for i := 0 to Chart1.SeriesCount - 1 do
// Error on this lline
CloneChartSeries(Chart1.Series[i]).ParentChart := ppDPTeeChart1;
thank you
Didier
-
- Newbie
- Posts: 42
- Joined: Mon Jun 11, 2007 12:00 am
- Contact:
[/code]
ppDPTeeChart1.Chart.Assign(Chart1);
for i := 0 to Chart1.SeriesCount - 1 do
// Error on this lline
CloneChartSeries(Chart1.Series).ParentChart := ppDPTeeChart1;
ppDPTeeChart1.Chart.Assign(Chart1);
for i := 0 to Chart1.SeriesCount - 1 do
// Error on this lline
CloneChartSeries(Chart1.Series).ParentChart := ppDPTeeChart1;
Code: Select all
-
- Newbie
- Posts: 42
- Joined: Mon Jun 11, 2007 12:00 am
- Contact:
-
- Newbie
- Posts: 42
- Joined: Mon Jun 11, 2007 12:00 am
- Contact: