I want to make a chart for accumulated test results
Is there a way to use the script language to achieve this?
Best Answer
S
SystemWeaver
said
over 7 years ago
Below is a simple example using the configurable charts to achieve this. The example uses the following model:
A workarea containing documents and sections. Each section
has an attribute containing a status. The chart will show each document and the
amount of sections having ‘OK’ and not ‘OK’ statuses.
Applying the following script on the workarea:
<Charts>
<AreaChart>
<Slices>
<Slice name="first" caption="OK" color="green"/>
<Slice name="second" caption="Not OK" color="red"/>
</Slices>
<!-- For each document -->
<ForEachPart type="IDI">
<DefObj>
<!-- the counter make up each entry on the x axis -->
<Counter name="#{Name}" caption="#{Name}">
<!-- filter out all sections with attribute value 'OK' -->
<ForEach select="/IRRS[@PTCS='OK']">
<AddToSlice name="first"/>
</ForEach>
<!-- filter out all sections that have attribute value seperate from 'OK' -->
<ForEach select="/IRRS[not @PTCS='OK']">
<AddToSlice name="second"/>
</ForEach>
</Counter>
</DefObj>
</ForEachPart>
</AreaChart>
</Charts>
Gives the following result:
Using
an <AreaChart> will give an Area chart. The counter represents each entry
on the x axis. Adding sections with specific properties to the counter makes up
the height of each area.
Below is a simple example using the configurable charts to achieve this. The example uses the following model:
A workarea containing documents and sections. Each section
has an attribute containing a status. The chart will show each document and the
amount of sections having ‘OK’ and not ‘OK’ statuses.
Applying the following script on the workarea:
<Charts>
<AreaChart>
<Slices>
<Slice name="first" caption="OK" color="green"/>
<Slice name="second" caption="Not OK" color="red"/>
</Slices>
<!-- For each document -->
<ForEachPart type="IDI">
<DefObj>
<!-- the counter make up each entry on the x axis -->
<Counter name="#{Name}" caption="#{Name}">
<!-- filter out all sections with attribute value 'OK' -->
<ForEach select="/IRRS[@PTCS='OK']">
<AddToSlice name="first"/>
</ForEach>
<!-- filter out all sections that have attribute value seperate from 'OK' -->
<ForEach select="/IRRS[not @PTCS='OK']">
<AddToSlice name="second"/>
</ForEach>
</Counter>
</DefObj>
</ForEachPart>
</AreaChart>
</Charts>
Gives the following result:
Using
an <AreaChart> will give an Area chart. The counter represents each entry
on the x axis. Adding sections with specific properties to the counter makes up
the height of each area.
If a column chart is preferred, the configuration would be the same as described above except you would replace the <AreaChart> tag with <ColumnChart>.
<Charts>
<ColumnChart>
<Slices>
<Slice name="first" caption="OK" color="green"/>
<Slice name="second" caption="Not OK" color="red"/>
</Slices>
<!-- For each document -->
<ForEachPart type="IDI">
<DefObj>
<!-- the counter make up each entry on the x axis -->
<Counter name="#{Name}" caption="#{Name}">
<!-- filter out all sections with attribute value 'OK' -->
<ForEach select="/IRRS[@PTCS='OK']">
<AddToSlice name="first"/>
</ForEach>
<!-- filter out all sections that have attribute value seperate from 'OK' -->
<ForEach select="/IRRS[not @PTCS='OK']">
<AddToSlice name="second"/>
</ForEach>
</Counter>
</DefObj>
</ForEachPart>
</ColumnChart>
</Charts>
The result would be:
2 people like this
I
Inactive VCC contacts
said
almost 7 years ago
Hello. I have noticed in a "R24 (20656)" release an interesting feature: <ColumnChart> which should solve the original issue with accumulated chart in a more straight-forward way. Any chance for update in this thread, @Martin?
SystemWeaver Support
said
almost 7 years ago
Hello Jakub! I think our paths crossed a bit. I have updated this topic to include the column chart example. Let us know if you need anything else!
1 person likes this
I
Inactive VCC contacts
said
almost 7 years ago
Ha! I should update the window before writing my previous post!
One more question in that case: Let's say we have "doc" items in a 3 different versions (e.g. 1,2,3), which we would like to include to that chart instead of using already available tools to compare different versions. Is there any variant-handling feature that we could us in that case?
SystemWeaver Support
said
almost 7 years ago
Yes, you can handle versions. Using the same example, the configuration would look like this:
<Charts>
<ColumnChart>
<Slices>
<Slice name="first" caption="OK" color="green"/>
<Slice name="second" caption="Not OK" color="red"/>
</Slices>
<!--AllVersions: Returns all versions of an item.-->
<ForEach select="AllVersions">
<Counter name="#{Name}" caption="#{Name} Version: #{Version}">
<!-- For each document -->
<ForEachPart type="IDI">
<DefObj>
<!-- the counter make up each entry on the x axis -->
<!-- filter out all sections with attribute value 'OK' -->
<ForEach select="/IRRS[@PTCS='OK']">
<AddToSlice name="first"/>
</ForEach>
<!-- filter out all sections that have attribute value seperate from 'OK' -->
<ForEach select="/IRRS[not @PTCS='OK']">
<AddToSlice name="second"/>
</ForEach>
</DefObj>
</ForEachPart>
</Counter>
</ForEach>
</ColumnChart>
</Charts>
With the result being:
As you can see, I updated the PTCS results a bit to illustrate a difference.
1 person likes this
I
Inactive VCC contacts
said
almost 7 years ago
Perfect, thanks a lot!
I
Inactive VCC contacts
said
almost 7 years ago
I managed to adopt feedback from this thread and finally different versions are correctly listed on my chart. However, it becomes difficult to generate the proper graphs when I have to deal with different versions within a longer tree structure. Is there any possibility to compare e.g. time of release and create those graphs based on that (by reference to sth like "version attribute: date of release")?
B
Bashar Nassar
said
almost 7 years ago
Hi
Jakub,
I
think one of the following path query methods or a combination of them would
serve your need (you can find more information on the Help manual).
VersionNumber
returns the version number of an item.
Is there any way to show the counter caption on the x axis only and not once per slice in the bar chart? The chart area gets a bit crowded for charts with several counters and slices. And is it possible to have x axis captions rotated as in the top picture of this article?
B
Bashar Nassar
said
almost 6 years ago
Hello David,
Currently in SystemWeaver you can only configure the content of charts (PieChart, AreaChart and ColumnChart) not how they look like. So in short, no it is not possible to show the counter caption on the x axis only.
SystemWeaver
I want to make a chart for accumulated test results
Is there a way to use the script language to achieve this?
Below is a simple example using the configurable charts to achieve this. The example uses the following model:
A workarea containing documents and sections. Each section has an attribute containing a status. The chart will show each document and the amount of sections having ‘OK’ and not ‘OK’ statuses.
Applying the following script on the workarea:
Gives the following result:
Using an <AreaChart> will give an Area chart. The counter represents each entry on the x axis. Adding sections with specific properties to the counter makes up the height of each area.- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstSystemWeaver
Below is a simple example using the configurable charts to achieve this. The example uses the following model:
A workarea containing documents and sections. Each section has an attribute containing a status. The chart will show each document and the amount of sections having ‘OK’ and not ‘OK’ statuses.
Applying the following script on the workarea:
Gives the following result:
Using an <AreaChart> will give an Area chart. The counter represents each entry on the x axis. Adding sections with specific properties to the counter makes up the height of each area.SystemWeaver
The example used above is attached to this post.
SystemWeaver Support
If a column chart is preferred, the configuration would be the same as described above except you would replace the <AreaChart> tag with <ColumnChart>.
The result would be:
2 people like this
Inactive VCC contacts
Hello. I have noticed in a "R24 (20656)" release an interesting feature: <ColumnChart> which should solve the original issue with accumulated chart in a more straight-forward way. Any chance for update in this thread, @Martin?
SystemWeaver Support
Hello Jakub! I think our paths crossed a bit. I have updated this topic to include the column chart example. Let us know if you need anything else!
1 person likes this
Inactive VCC contacts
Ha! I should update the window before writing my previous post!
One more question in that case: Let's say we have "doc" items in a 3 different versions (e.g. 1,2,3), which we would like to include to that chart instead of using already available tools to compare different versions. Is there any variant-handling feature that we could us in that case?
SystemWeaver Support
Yes, you can handle versions. Using the same example, the configuration would look like this:
With the result being:
As you can see, I updated the PTCS results a bit to illustrate a difference.
1 person likes this
Inactive VCC contacts
Perfect, thanks a lot!
Inactive VCC contacts
I managed to adopt feedback from this thread and finally different versions are correctly listed on my chart. However, it becomes difficult to generate the proper graphs when I have to deal with different versions within a longer tree structure. Is there any possibility to compare e.g. time of release and create those graphs based on that (by reference to sth like "version attribute: date of release")?
Bashar Nassar
Hi Jakub,
I think one of the following path query methods or a combination of them would serve your need (you can find more information on the Help manual).
VersionNumber returns the version number of an item.
Example:
Max returns the maximum value in a set of integer values.
Example:
MaxByDate() returns the objects from the list with the latest date property (required SystemWeaver R24).
Example:
Best Regards,
Bashar
1 person likes this
Inactive Volvo Penta
Hello,
Is there any way to show the counter caption on the x axis only and not once per slice in the bar chart? The chart area gets a bit crowded for charts with several counters and slices. And is it possible to have x axis captions rotated as in the top picture of this article?
Bashar Nassar
Hello David,
-
Comparing two versions of a structure
-
Context and path language
-
Overview of meta model
-
Importing old data
-
Cannot find multiple version items
-
Cannot remove part - is referenced
-
View of non accessable data
-
Path: How to check if an attribute is empty?
-
List and path language
See all 33 topics