I have a Chart that I want to add a TChartShape at runtime.
I have been able to do this, in an event handler. I can later alter the Shape's
proerties, by calling it form the SeriesList, My only issue is I have to know the
correct index. All is well until I remove a series and now the known index is not correct.
What is the best method to
1) Create the Shape at runtime
2) Be able to reference this shape elsewhere in the program ?
I am using TChartPro 7.08
Delphi 7 Ent
Thanks for your help
Creating a TChartShape at Runtime
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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 |
Hi Narcis,
Thanks for the reply
For the attached post, i have gotten that far,
Maybe I'm making this harder than it is. After I have created the Shape, let's say the chart gets scrolled, now I want to reposition the shape created above.
What is the best method to reference this Shape ?
Thanks Again
Mike
Thanks for the reply
For the attached post, i have gotten that far,
Maybe I'm making this harder than it is. After I have created the Shape, let's say the chart gets scrolled, now I want to reposition the shape created above.
What is the best method to reference this Shape ?
Thanks Again
Mike
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Mike,
You have several options:
1. If nothing specific to TChartShape type needs to be done you can use the series index, for example: Chart1[ShapeIndex].Active=true;
2. You can declare the series variable in the unit's private section so you can use it anywhere in the unit.
3. Type cast the series:
4. Loop through the chart's series collection and check whether they are shape series or not:
You have several options:
1. If nothing specific to TChartShape type needs to be done you can use the series index, for example: Chart1[ShapeIndex].Active=true;
2. You can declare the series variable in the unit's private section so you can use it anywhere in the unit.
3. Type cast the series:
Code: Select all
(Chart1[0] as TChartShape).Style:=chasRectangle;
Code: Select all
for i:=0 to Chart1.SeriesCount-1 do
if Chart1[i] is TChartShape then
begin
//Do something
end;
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 |
Hi Narcis
Thanks once more.
I guess in the end I was looking for a method that didn't require looping thru a list. With the list if there is more than 1 shape, you need to check another property to make sure you have the correct shape.
The series variable I think limits the number of shapes ?
Again Thanks for the help
Regards
Mike
Thanks once more.
I guess in the end I was looking for a method that didn't require looping thru a list. With the list if there is more than 1 shape, you need to check another property to make sure you have the correct shape.
The series variable I think limits the number of shapes ?
Again Thanks for the help
Regards
Mike
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Mike,
No, but if you may need one variable for each shape. You could also use an array of TChartShape or even an array containing records with TChartShape and some other field to mark series as you wish.
The series variable I think limits the number of shapes ?
No, but if you may need one variable for each shape. You could also use an array of TChartShape or even an array containing records with TChartShape and some other field to mark series as you wish.
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 |