Hello,
On a form at design time i have created a chart with one series.
I would like to create at run time one or several charts with the same series and the same properties than the previous and draw it below the first chart (the series values are not the same).
What is the best way to do that? Is there is a function which could duplicate a chart and its content?
Thank you for help
Regards
Duplicate a chart
Hi Calou,
I'm afraid there isn't a single function to do this. The simplest way probably is :
- Create your new chart at runtime
- Save your old chart in a tee file
- Import the tee file to the new chart
- Remove all series or clear the data of the new chart
- Verify and copy the original's chart properties that weren't exported to the tee file
If you find problems at any step, please, don't hesitate to let us know.
I'm afraid there isn't a single function to do this. The simplest way probably is :
- Create your new chart at runtime
- Save your old chart in a tee file
- Import the tee file to the new chart
- Remove all series or clear the data of the new chart
- Verify and copy the original's chart properties that weren't exported to the tee file
If you find problems at any step, please, don't hesitate to let us know.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Hello,
You can also do it directly from memory.
For example, in C++ Builder, assuming that vChrt1 is your source chart, this should copy chart properties and data to a new chart:
You can also do it directly from memory.
For example, in C++ Builder, assuming that vChrt1 is your source chart, this should copy chart properties and data to a new chart:
Code: Select all
#include <TeeStore.hpp>
...
TMemoryStream* pStream = new TMemoryStream;
SaveChartToStream(vChrt1, pStream, true, true);
TChart* pTChart = new TChart(this);
pStream->Position = 0;
LoadChartFromStream((TCustomChart*)pTChart, pStream);
pTChart->Parent = this;
pTChart->Top = vChrt1->Top + vChrt1->Height;
pTChart->Left = vChrt1->Left;
delete pStream;