There is some trouble when using tChartseries.Assign to copy settings and data from one series to another.
Please check the attached zip file for a demo
1) CLick btTestSTack to add some data
2) Edit the chart , take a look at BarSum series, there is an AddTee function -> OK
3) click btTestCloneChart
4) Take a look at the newly opened chart window. a nice cloned chart.
5) from the main form open the chart editor once more. Take a look at BarSum series, the datasource is not the teeAdd function anymore.
6) click btTestCloneChart once more
7) this cloned chart looks a lot different? - well of course, the source chart has been altered!
This must be wrong: the Assign method should never change the provided source object.
I have currently no fix for this. Yet I need to clone charts on a regular basis, so please tell me how to accomplish this in the official Teemach way, without destroying /altering my source chart...
Regards - hans
Trouble assigning series to other series
-
- Newbie
- Posts: 32
- Joined: Tue Jul 21, 2009 12:00 am
- Location: Nijmegen, Netherlands
Trouble assigning series to other series
- Attachments
-
- TestTChart.zip
- Demo for TCHartseries.Assign bug
- (35.64 KiB) Downloaded 281 times
Re: Trouble assigning series to other series
Hi Hans,
Yes you are right. I'll add this to be revised for future releases.
In the meanwhile, I've changed your btTestCloneChart for the following and it seems to work fine. Could you please try it?
Yes you are right. I'll add this to be revised for future releases.
In the meanwhile, I've changed your btTestCloneChart for the following and it seems to work fine. Could you please try it?
Code: Select all
f:=TfrmDynChart.Create(self);
f.Show;
for i:=0 to Chart1.SeriesCount-1 do
f.Chart1.AddSeries(CloneChartSeries(Chart1[i]));
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 32
- Joined: Tue Jul 21, 2009 12:00 am
- Location: Nijmegen, Netherlands
Re: Trouble assigning series to other series
Yes that works just fine.
But still I have to call my 'FixupDatasources' because the cloned series in the new chart still use the series in the original chart as a datasources . This could be WAD though.
Maybe it's a good idea to have a CloneChart routine as well as a CloneChartSeries that also does the datasource fixup handling... Anyway, in my app I can revise some code now just by using CloneChartseries - it's just better that way.
Regards - Hans
But still I have to call my 'FixupDatasources' because the cloned series in the new chart still use the series in the original chart as a datasources . This could be WAD though.
Maybe it's a good idea to have a CloneChart routine as well as a CloneChartSeries that also does the datasource fixup handling... Anyway, in my app I can revise some code now just by using CloneChartseries - it's just better that way.
Regards - Hans
Re: Trouble assigning series to other series
Hi Hans,
Well, for cloning charts we usually recommend to do through Streams. Please, take a look at the following topics where different suggestions where discussed:
http://www.teechart.net/support/viewtop ... f=3&t=7358
http://www.teechart.net/support/viewtop ... f=3&t=7121
Well, for cloning charts we usually recommend to do through Streams. Please, take a look at the following topics where different suggestions where discussed:
http://www.teechart.net/support/viewtop ... f=3&t=7358
http://www.teechart.net/support/viewtop ... f=3&t=7121
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |