Org Chart
Re: Org Chart
Hi TCardinal,
Have you tried following the instructions form the Tutorial 8 - Database access. You should find Tutorials, User Guide and demo examples at TeeChart programs group.
Have you tried following the instructions form the Tutorial 8 - Database access. You should find Tutorials, User Guide and demo examples at TeeChart programs group.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Org Chart
Hi
I have no problem connecting a TChart to a dataset as I have done it many times. I have not used the Org Chart before and cannot make it display, so I was after anything which had any does and don'ts / instructions for this particular series type.
Thanks
I have no problem connecting a TChart to a dataset as I have done it many times. I have not used the Org Chart before and cannot make it display, so I was after anything which had any does and don'ts / instructions for this particular series type.
Thanks
Re: Org Chart
just a bit of info.
I have a dataset:
KeyField: integer
ParentKey: integer
Text: string
each record has a unique key (KeyField) and are linked to their parent records through the ParentKey (child.parentkey = parent.KeyField).
the record(s) at the top of the tree have a null value in the ParentKey.
in the OrgSeries component I have tried linking X and Y each way, but the chart doesn't show. The key values can be large (typically they are in the hundreds) would this cause a problem?
I have added the unit to my project and stepped through - it definately calls the AddNode methods but the chart does not display.
Thanks for any help.
I have a dataset:
KeyField: integer
ParentKey: integer
Text: string
each record has a unique key (KeyField) and are linked to their parent records through the ParentKey (child.parentkey = parent.KeyField).
the record(s) at the top of the tree have a null value in the ParentKey.
in the OrgSeries component I have tried linking X and Y each way, but the chart doesn't show. The key values can be large (typically they are in the hundreds) would this cause a problem?
I have added the unit to my project and stepped through - it definately calls the AddNode methods but the chart does not display.
Thanks for any help.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Org Chart
Hi TCardinal,
For populating TOrgSeries you should use TOrgSeriesAdd(const Text:String; Superior:Integer=-1):Integer; method. Text is the text displayed in the node. Superior is the parent node. Root nodes have Superior=-1. The integer value that Add method returns is node's index (a sequential value starting from 0 to Series.Count-1 according to the orther in which node are added to the series) so you can use it later for adding children nodes, for example:
Having said that, with your dataset it would be:
TOrgSeries' Add method would be the equivalent of Add(YValue, Label) in standard series. So you should add ParentKey to YValues ValueList and Text to labels ValueList.
Hope this helps!
For populating TOrgSeries you should use TOrgSeriesAdd(const Text:String; Superior:Integer=-1):Integer; method. Text is the text displayed in the node. Superior is the parent node. Root nodes have Superior=-1. The integer value that Add method returns is node's index (a sequential value starting from 0 to Series.Count-1 according to the orther in which node are added to the series) so you can use it later for adding children nodes, for example:
Code: Select all
procedure TOrgSeries.AddSampleValues(NumValues: Integer;
OnlyMandatory: Boolean);
const
MaxNames=8;
Names:Array[0..MaxNames] of String=
('John','Anne','Mary','Paul','Bob','Mike','Lisa','Brad','Peter');
SurNames:Array[0..MaxNames] of String=
('Smith','Shane','Wizard','Smart','Best','Patson','Hood','Dale','Scarlet');
function RandomName:String;
begin
result:=Names[Random(MaxNames+1)]+' '+SurNames[Random(MaxNames+1)]+TeeLineSeparator;
end;
var tmp,
tmp1 : Integer;
begin
tmp:=Add(RandomName+'President');
Add(RandomName+'Sales Director',tmp);
tmp1:=Add(RandomName+'Product Manager'+TeeLineSeparator+'USA',tmp);
Add(RandomName+'Asian Sales',tmp1);
tmp1:=Add(RandomName+'Human Relations',tmp);
Add(RandomName+'Assistant',tmp1);
end;
Code: Select all
KeyField:=Add(Text, ParentKey);
Hope this helps!
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 |
Re: Org Chart
Hi Narcis
thanks for this.
Just so I fully understand, I need to create the data in code I can't just link in the dataset unless the keys are sequential?
Thanks
thanks for this.
Just so I fully understand, I need to create the data in code I can't just link in the dataset unless the keys are sequential?
Thanks
Re: Org Chart
Just to say I have this working now. Excellent.
However is there a way for the series to better calculate the spacing so that it doesn't create overlaps between the boxes?
However is there a way for the series to better calculate the spacing so that it doesn't create overlaps between the boxes?
Re: Org Chart
Hi TCardinal,
Could you please attach an screenshot showing us this bad result?
Thank you in advance.
Could you please attach an screenshot showing us this bad result?
Thank you in advance.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Org Chart
Hi TCardinal,
Yes, I see it is reproducible with the following code:
This series is quite simple right now. I've added it to the wish list to be improved in future releases (TV52014866).
Note that for more complex diagrams like this, there is also the TeeTree component given with TeeChart. You should have a demo of the TeeTree component features in your TeeChart installation path, into the Examples folder.
Yes, I see it is reproducible with the following code:
Code: Select all
uses TeeOrgSeries;
procedure TForm1.FormCreate(Sender: TObject);
var Org1: TOrgSeries;
begin
Org1:=TOrgSeries(Chart1.AddSeries(TOrgSeries.Create(self)));
Org1.Add('Metals');
Org1.Add('Alloys', 0);
Org1.Add('Base Metals', 0);
Org1.Add('Bronze',1);
Org1.Add('Cooper alloy',1);
Org1.Add('Iron',2);
Org1.Add('Tin',2);
end;
Note that for more complex diagrams like this, there is also the TeeTree component given with TeeChart. You should have a demo of the TeeTree component features in your TeeChart installation path, into the Examples folder.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Org Chart
Thanks Yeray.
Yes, the series needs to calculate it's spacing from the bottom up I guess.
Russell
Yes, the series needs to calculate it's spacing from the bottom up I guess.
Russell
Re: Org Chart
Just another thing I noticed. I played with the spacing and got the boxes separated, but it doesn't seem that the horizontal lines terminate for anything but the very end boxes, ie you cannot tell which parent the children belong to.
Re: Org Chart
Hi TCardinal,
I'm not sure to understand you. I think an example could clarify what you are trying to achieve.
In the example I posted above,
Index - Name - ParentIndex
0 - 'Metals' - NULL (root)
1 - 'Alloys' - 0 (Metals)
2 - 'Base Metals' - 0 (Metals)
3 - 'Bronze' - 1 (Alloys)
4 - 'Cooper alloy' - 1 (Alloys)
5 - 'Iron' - 2 (Base Metals)
6 - 'Tin' - 2 (Base Metals)
I'm not sure to understand you. I think an example could clarify what you are trying to achieve.
In the example I posted above,
Index - Name - ParentIndex
0 - 'Metals' - NULL (root)
1 - 'Alloys' - 0 (Metals)
2 - 'Base Metals' - 0 (Metals)
3 - 'Bronze' - 1 (Alloys)
4 - 'Cooper alloy' - 1 (Alloys)
5 - 'Iron' - 2 (Base Metals)
6 - 'Tin' - 2 (Base Metals)
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Org Chart
Hello all,
the last post is dated 10 May 2010. Now we have 2016 and we have the same Problems with ORGCHART. Nothing changed. You make great things on all platforms and for many IDEs. Can you take a programmer for a couple of weeks and let him work on the OrgChart component, so that it works as it should? This spacing issue makes the component unusable.
Thanks in advance,
Francesco
the last post is dated 10 May 2010. Now we have 2016 and we have the same Problems with ORGCHART. Nothing changed. You make great things on all platforms and for many IDEs. Can you take a programmer for a couple of weeks and let him work on the OrgChart component, so that it works as it should? This spacing issue makes the component unusable.
Thanks in advance,
Francesco
Re: Org Chart
Hello,
I've moved the old ticket TV52014866 to the new public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1457
Feel free to add your mail to the CC list to be automatically notified when an update arrives.
Note the TOrgSeries hasn't received much attention because the TeeTree component may be more suitable for those kind of designs, as stated previously in this conversation.
I've moved the old ticket TV52014866 to the new public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1457
Feel free to add your mail to the CC list to be automatically notified when an update arrives.
Note the TOrgSeries hasn't received much attention because the TeeTree component may be more suitable for those kind of designs, as stated previously in this conversation.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |