Book a Demo

Author Topic: Generating Charts via Script  (Read 5383 times)

EAButNotForGames

  • EA User
  • **
  • Posts: 48
  • Karma: +0/-0
    • View Profile
Generating Charts via Script
« on: July 24, 2024, 06:33:12 pm »
I am currently working on a script to autogenerate Charts in Diagrams.
I am struggeling to excess the Type and the Series in "Chart Details".

Does anybody have an idea if and how I can excesses those.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13519
  • Karma: +573/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Generating Charts via Script
« Reply #1 on: July 24, 2024, 08:14:06 pm »
All that info is stored in xml format in the notes of the tagged value ChartProperties

Here's an example of one of my charts:

Code: [Select]
<chart type="piechart">
<source customSQL="select case when isnull(o.stereotype, '') = 'KPI_report' then 'Nieuwe Stijl' else 'Oude Stijl' end as Series&#xA;from t_object o&#xA;inner join t_package p on p.package_ID = o.Package_ID&#xA;inner join t_package p2 on p2.Package_ID = p.Parent_ID&#xA;left join t_package p3 on p3.Package_ID = p2.Parent_ID&#xA;left join t_package p4 on p4.Package_ID = p3.Parent_ID&#xA;left join t_package p5 on p5.Package_ID = p4.Parent_ID&#xA;where o.object_Type = 'Screen'&#xA;and '{C60A3CFB-8E2C-4666-9544-0BA3F369BF89}' in (p.ea_guid, p2.ea_guid, p3.ea_guid, p4.ea_guid, p5.ea_guid)"/>
<appearance category="0" gradient="0" showindexinlabels="0" exploded="0" showdatalabels="1" fitinarea="0" labelPosition="0" holesize="50" displaylegend="0" rotationAngle="0" pieAngle="45"/>
</chart>

Geert



EAButNotForGames

  • EA User
  • **
  • Posts: 48
  • Karma: +0/-0
    • View Profile
Re: Generating Charts via Script
« Reply #2 on: July 24, 2024, 09:12:40 pm »
I seems like I got a weird bug.
I create the chart with a script
When I open the diagram, I can only see an empty Standard Chart element
But when I copy the ChartProperties (which i generated with the script) into a new Standard Chart element by hand, the new element displays everything as expected


How peculiar

EAButNotForGames

  • EA User
  • **
  • Posts: 48
  • Karma: +0/-0
    • View Profile
Re: Generating Charts via Script
« Reply #3 on: July 24, 2024, 09:14:34 pm »
Even weirder:
When I open the ChartProperties of the empty looking Chart and just push enter at the end of the Notes the Chart generates properly!?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13519
  • Karma: +573/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Generating Charts via Script
« Reply #4 on: July 24, 2024, 09:31:58 pm »
I guess you'll have to figure out what is different. There will be something different between a chart freshly created by your script, and a chart where you hit enter in the notes.
In cases like this I usually make two objects (one that works, and one that is broken) and then inspect the database, comparing both elements field by field.

I would start looking in
- t_objectproperties
- t_object
- t_xref
- t_diagramObject

Geert