In what way is the DGML graphic coordinate oriented? - visual-studio

Context
I am trying to convert a DGML graph into an SVG. I am using Javascript to read and parse the DGML Nodes and Links using Jquery. I created a DGML graph using Visual Studio 2017 (it has an interactive inbuilt editor). Essentially I need to create a mapping between the position of nodes on the DGML graph and a generated SVG. I have managed to make a conversion of every property of the nodes and links, except for a property called Bounds
<?xml version="1.0" encoding="utf-8"?>
<DirectedGraph xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
<Node Id="Node1" Background="#FF000000" Bounds="289.142857142857,-914.285714285714,56.9200000000001,25.96" Label="node 1" UseManualLocation="True" />
<Node Id="Node2" Bounds="-99.1466388157435,-813.468571428572,56.9200000000001,25.96" Label="node 2" UseManualLocation="True" />
<Node Id="Node3" Bounds="165.353095238095,-821.948571428572,56.9200000000001,25.96" Label="node 3" UseManualLocation="True" />
<Node Id="Node4" Bounds="231.884895804269,-672.637129778181,56.92,25.96" Label="node 4" UseManualLocation="True" />
<Node Id="Node5" Bounds="126.293653230212,-514.368957318116,56.9200000000001,25.96" Label="node 5" UseManualLocation="True" />
<Node Id="Node6" Bounds="513.21231765747,-699.551714460973,56.9200000000001,25.96" Label="node 6" UseManualLocation="True" />
</Nodes>
<Links>
<Link Source="Node1" Target="Node2" Bounds="-33.5154810441621,-893.916239433358,322.658338187019,83.7763765262094" />
<Link Source="Node1" Target="Node3" Bounds="218.428553771979,-888.325714285714,81.7729515442388,60.9960031621974" />
<Link Source="Node2" Target="Node4" Bounds="-42.8686314368827,-788.653915128306,267.113829712029,113.638782142621" />
<Link Source="Node2" Target="Node5" Bounds="-60.9032254171191,-787.508586425781,200.456326731834,265.952512098603" />
<Link Source="Node3" Target="Node4" Bounds="199.596870550233,-795.988597412109,51.3011424145167,115.130629087374" />
<Link Source="Node4" Target="Node5" Bounds="168.40836594804,-646.677165527344,83.2767077301747,124.821483021298" />
<Link Source="Node4" Target="Node6" Bounds="288.80489440918,-682.991837277453,215.448314485295,20.6119078319973" />
<Link Source="Node6" Target="Node1" Bounds="337.645038336076,-882.098554229514,190.482965266866,182.54683792092" />
</Links>
<Properties>
<Property Id="Background" Label="Background" Description="The background color" DataType="System.Windows.Media.Brush" />
<Property Id="Bounds" DataType="System.Windows.Rect" />
<Property Id="Label" Label="Label" Description="Displayable label of an Annotatable object" DataType="System.String" />
<Property Id="UseManualLocation" DataType="System.Boolean" />
</Properties>
</DirectedGraph>
I saw in the Property tag for "Bounds" the datatype is System.Windows.Rect which has a constructor Rect(Double, Double, Double, Double)
- Initializes a new instance of the Rect structure that has the specified x-coordinate, y-coordinate, width, and height.
https://msdn.microsoft.com/en-us/library/system.windows.rect(v=vs.110).aspx
Since all the nodes have the same size, it is not wrong to assume that the final two parameters are width and height.
Question
How is the graphics coordinate system of the DGML oriented? For instance, an SVG graphic starts like most CG coordinates, left top corner origin; positive X towards right, positive Y towards bottom. I could not find any information on this on the DGML reference
https://learn.microsoft.com/en-us/visualstudio/modeling/directed-graph-markup-language-dgml-reference

Looking at your diagram i think the Y axis is inverted (top-down) and X axis is classical (left-right). Start of coordinates is between Node2 and Node5 somewhere behind the bottom of diagram view.

My DgmlPowerTools provides a "Save as SVG" option under the "Share" toolbar item.

Related

BI Publisher Ring Chart Thickness

I am relatively new to BI Publisher and I have to date only worked with line and bar charts.
I am working on a report that uses Ring Charts, and the default thickness of the chart is too much. I want it to look like a hoola hoop and not a doughnut, as below. But I dont know what node to change in the XML, can someone advise?
Chart Currently looks like this:
I would like it to look like this:
Any help is greatly appreciated.
Thanks
Chart Code
<Graph seriesEffect="SE_NONE" graphType="RING">
<LegendArea visible="false" />
<SeriesItems>
<Series id="0" color="#447A27" />
<Series id="1" color="#96b27f" />
<Series id="2" color="#c4c5c7" />
<Series id="3" color="#EA4848" />
<Series id="4" color="#C41C24" />
</SeriesItems>
<SliceLabel visible="false">
<ViewFormat decimalDigit="0" decimalDigitUsed="true" />
</SliceLabel>
<LocalGridData colCount="1" rowCount="{count(.//DATASET[condition='Test'])}">
<RowLabels>
<xsl:for-each select=".//DATASET[condition='Test']" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<Label>
<xsl:value-of select="QUALITY_LEVEL" />
</Label>
</xsl:for-each>
</RowLabels>
<DataValues>
<xsl:for-each select=".//DATASET[condition='Test']" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<RowData>
<Cell>
<xsl:value-of select="COUNT" />
</Cell>
</RowData>
</xsl:for-each>
</DataValues>
</LocalGridData>
<RingTotalLabel>
<GraphFont size="50" fontColor="#c4c5c7" />
</RingTotalLabel>
</Graph>

Formatting legend in Anychart included with Application Express

I am trying to format the legend within Application Express Anychart Flash chart. Here is the relevant XML section:
<legend enabled="true" position="Right" align="Near" elements_layout="Vertical">
<title enabled="true">
<text>Legend</text>
<font family="Tahoma" size="10" color="0x000000" />
</title>
<icon>
<marker enabled="true" />
</icon>
<font family="Tahoma" size="10" color="0x000000" />
</legend>
I am simply trying to add two line items, Sales and Tickets, to describe the lines in my chart with a correctly colored line icons but instead I get two generic entries - Value and Value. Can anyone help me sort out the proper code for this XML?
When I change it to the following:
<legend enabled="true" position="Right" align="Near" elements_layout="Vertical" ignore_auto_item="True">
<title enabled="true">
<text>Legend</text>
<font family="Tahoma" size="10" color="0x000000" />
</title>
<items>
<item>
<text>This is a test</text>
</icon></item>
<item><text>Item 2</text>
</item>
</items>
<icon>
<marker enabled="true" />
</icon>
<font family="Tahoma" size="10" color="0x000000" />
</legend>
This gives me the two series I want but no icon.
Please forgive my ignorance here. I still am not getting the simple legend I want. I am using two series queries, Total_Sales and Total_Tickets:
SELECT NULL Link,
trunc(tix.timestamp) AS label,
sum(tixp.Price) AS value
FROM LS_tickets tix LEFT OUTER JOIN
LS_ticket_prices tixP
ON tixp.series_prefix = tix.ticket_series
WHERE tix.event_id = :P145_event_id
and tix.event_id = tixp.event_id
and tix.voided_flag != 'Y'
GROUP BY trunc(tix.timestamp)
ORDER BY trunc(tix.timestamp) ASC
And
SELECT NULL Link,
trunc(tix.timestamp) AS label,
sum( tixp.quantity ) AS value
FROM LS_tickets tix LEFT OUTER JOIN
LS_ticket_prices tixP
ON tixp.series_prefix = tix.ticket_series
WHERE tix.event_id = :P145_event_id
and tix.event_id = tixp.event_id
and tix.voided_flag != 'Y'
GROUP BY trunc(tix.timestamp)
ORDER BY 1
But I am getting an empty legend whenever i try and add ICON information specific for each label as follows:
<legend enabled="true" position="Right" align="Near" elements_layout="Vertical" ignore_auto_item="True">
<title enabled="true">
<text>Legend</text>
<font family="Tahoma" size="10" color="0x000000" />
</title>
<icon><marker enabled="true" /></icon>
<items>
<item source="Series" series="Total_Sales">
<text>{%Icon} Sales</text>
</item>
<item source="Series" series="Total_Tickets"><text>{%Icon} Tickets</text>
</item>
</items>
<font family="Tahoma" size="10" color="0x000000" />
</legend>
It depends on what data structure you are using. You can specify what data should be shown in legend using these xml settings.
Each automatic item have attributes source which can be "Points" or "Series" and series, that specifies the series name:
http://www.anychart.com/products/anychart/docs/users-guide/index.html?legend-text-formatting.html#automatic-items
In case of custom line items you can add your own items with any information:
http://www.anychart.com/products/anychart/docs/users-guide/index.html?legend-text-formatting.html#custom-items
Here is a list of all keywords that you can use to format the items values:
http://www.anychart.com/products/anychart/docs/users-guide/index.html?legend-text-formatting.html#keywords
it looks like the issue occurs while apex working with the series, all of them are created with the name set to "VALUE. Here is a solution for the similar problem:
https://community.oracle.com/message/12637203#12637203

Multiple animations on SVG element

If I have single SVG element and multiple animation elements related to it which animation will execute first and take effect over the SVG?
Example code :
<svg ...... >
<animation id="1" .... />
<animation id="2" .... />
<animation id="3" .... />
</svg>
And is there any difference if the animations are from different type - animateTransform, animateColor, animate, animatePath ?
Thank you in advance
All of them will activate according to their individual conditions. None of them will be "first", they all get processed in a single pass.

Adding a custom button to the advanced find robbon

I've got my customizations.xml importing ok, but when I open the Advanced Find Dialog, it tell me "Ribbon XML Validation Error":
I can't seem to get any more info than that. Below is my customizations.xml text, I've tried to simplify it as much as possible.
<ImportExportXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Entities></Entities>
<Roles></Roles>
<Workflows></Workflows>
<FieldSecurityProfiles></FieldSecurityProfiles>
<Templates />
<RibbonDiffXml>
<CustomActions>
<CustomAction Id="DEW.Mscrm.AdvancedFind.Groups.Debug.UploadFetchXml"
Location="Mscrm.AdvancedFind.Groups.Debug._children" >
<CommandUIDefinition>
<Button Id="DEW.Mscrm.AdvancedFind.Groups.Debug.UploadFetchXmlButton" />
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
</Templates>
<CommandDefinitions>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules />
<EnableRules />
</RuleDefinitions>
<LocLabels />
</RibbonDiffXml>
<EntityMaps />
<EntityRelationships />
<OrganizationSettings />
<optionsets />
<Languages>
<Language>1033</Language>
</Languages>
</ImportExportXml>
For others looking to find the solution, or at least something to take note of if you're having a similar problem.
My problem was that the id for the different elements were the same. You must have unique id's even among different elements. And "Mscrm.AdvancedFind.Groups.Debug._children" should have been "Mscrm.AdvancedFind.Groups.Debug.Controls._children"

Working With Nested XPath Predicates ... Refined

All great answers! But the question deserves refinement ...
I've got the following sample XML ...
<objects>
<object objectId="1123" ... />
<properties refObjectId="1123" ... />
<properties refObjectId="1123" refPropertyId="2311" ... />
<properties refObjectId="1123" refPropertyId="4611" ... />
<object objectId="2123" ... />
<properties refObjectId="2123" refPropertyId="4311" ... />
<properties refObjectId="2123" refPropertyId="8611" ... />
....
</objects>
... and the following XPath query ...
//object[//properties[#refObjectId=#objectId and not(#refPropertyId)]]
I thought this query would return all object nodes where there is a properties node that has a refObjectId attribute that equals the objectId attribute of the object node and no 'refPropertyId' attribute ... namely object 1123 only, not object 2123 ... but it doesn't. It seems the #objectId in the nested predicate does not refer to the objectId attribute of the object node.
Any ideas? I know the XML structure isn't nested as you would expect, but there are reasons for this structure.
Generally you should avoid using // where you can. I'd consider rephrasing:
//object[../properties/#refObjectId=#objectId]
In the expression provided, your nested predicate is actually checking for
//properties/#refObjectId=//properties/#objectId
of which there are none.
I hope this helps!
EDIT: Since the question has been updated here is an updated response:
You added "It seems the #objectId in the nested predicate does not refer to the objectId attribute of the object node." You're absolutely right! So let's fix it!!
//object[../properties[not(#refPropertyId)]/#refObjectId=#objectId]
This should be closer to what you're after!
Try this:
//objects[object/#objectId = properties/#refObjectId]/object
This should work:
//objects/object[#objectId = ../properties/#refObjectId]
I am not sure how your xml is. However, if it is in the following format:
<objects>
<object objectId="1111" />
<properties refObjectId="1111" />
<object objectId="2111" />
<properties refObjectId="3111" />
<object objectId="4111" />
<properties refObjectId="5111" />
<object objectId="6111" />
<properties refObjectId="4111" />
<object objectId="7111" />
<properties refObjectId="7111" />
</objects>
Then you should use the following xpath to get only objects 1111 and 7111. The result should not include 4111 because the properties where refObjectId = 4111 does not immediately follow the object whose objectId=4111.
//objects/properties[#refObjectId = preceding::object[1]/#objectId]/preceding::object[1]
Assuming that all <properties> nodes that belong to a given <object> actually follow that object (your input seems to imply that), you could do:
/objects/properties[
#refObjectId = preceding-sibling::object[1]/#objectId
and
not(#refPropertyId)
]/preceding-sibling::object[1]
This should perform pretty well.
If you happen to be in XSLT, things get a lot simpler:
<xsl:key name="kPropertiesByObjectId" match="properties" use="#refObjectId" />
and
<xsl:template match="object">
<!-- This tests for an empty node-set. Non-empty node sets can only happen
for objects with at least one <properties> node without #refPropertyId -->
<xsl:if test="key('kPropertiesByObjectId', #objectId)[not(#refPropertyId)]">
<xsl:copy-of select="." />
</xsl:if>
</xsl:template>
In the XSLT case, the order of object and proerties nodes becomes irrelevant.

Resources