Table Of Contents

GraphTutorials ► XML Fetch

The Fetch section shows how to fetch content from a URL. The Info section shows how to view the key value dictionary description of a graph. This Tutorial amalgamates those sections and describes how to fetch XML content which defines the task state.

Line Graph

The following is the XML needed to make a line graph (curves). Line graphs are made with the Set Of 2D Points task so first select that task from the Tasks tool, click the Fetch tool, make sure the component pop up button is set to "All" and enter the URL to the XML content shown below. Then click the "Fetch Data" button.

Available at this URL: linegraph.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>title</key>
<string>Set Of 2D Points XML Test</string>
<key>x_title</key>
<string>XML-X-Title</string>
<key>y_title</key>
<string>XML-Y-Title</string>
<key>data_3</key>
<string>1 15 2 16 3 17 4 18 5 5</string>
<key>data_2</key>
<string>1 2 2 26 3 2 4 28 5 2</string>
<key>data_1</key>
<string>1 31 2 36 3 32 4 33 5 41</string>
</dict>
</plist>

Once the fetch is confirmed to work then you may wish to turn on "Each Animation Step" and "At First Appearance", click "Done", click the Data tool and turn on Animate then click "Done". The XML will be fetched and its results will be displayed every second. As such, when you change the content of the XML then the graph and table will change to reflect the changes to the XML. If the URL points to a SOA service then the XML it serves will be polled and displayed every second.

Now you have some XML and know how to fetch it, but perhaps you don't know what XML exactly is so lets hit some bullets on that issue:

Column Chart

The following is the XML needed to make a column chart. Column charts are made with the Set Of Scalars task so first select that task from the Tasks tool, click the Fetch tool, make sure the component pop up button is set to "All" and enter the URL to the XML content shown below. Then click the "Fetch Data" button.

Remember to use the Preferences tool to select the Column representation. You can also make stacked and offset bar and column charts and pie charts by using different representations and key value pairs.

Available at this URL: columnchart.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>title</key>
<string>Set Of Scalars XML Test</string>
<key>x_title</key>
<string>XML-X-Title</string>
<key>y_title</key>
<string>XML-Y-Title</string>
<key>data_3</key>
<string>1 2 3 4</string>
<key>data_2</key>
<string>1 2 3 4</string>
<key>data_1</key>
<string>2 2 3 6</string>
<key>label_1</key>
<string>a kitty cat</string>
<key>label_2</key>
<string>dog eat dog</string>
<key>label_3</key>
<string>buddy</string>
<key>label_4</key>
<string>more</string>
<key>label_5</key>
<string>the sky</string>
</dict>
</plist>

Surface Graph

The following is the XML needed to make a surface graph. Surface graphs are made with the Z Values task so first select that task from the Tasks tool, click the Fetch tool, enter the URL to the XML content shown below. Then click the "Fetch Data" button.

Available at this URL: surfacegraph.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>title</key>
<string>Z2 Values XML Test</string>
<key>x_title</key>
<string>XML-X-Title</string>
<key>data_values</key>
<string>1 1 1 2 3 2 0 1 0 5 5 3</string>
<key>grid_x_length</key>
<integer>4</integer>
<key>grid_y_length</key>
<integer>3</integer>
</dict>
</plist>

3D Density Graph

The following is the XML needed to make a 3D density graph. 3D density graphs are made with the Density task so first select that task from the Tasks tool, click the Fetch tool, enter the URL to the XML content shown below. Then click the "Fetch Data" button.

Available at this URL: densitygraph.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>title</key>
<string>Density XML Test</string>
<key>x_title</key>
<string>XML-X-Title</string>
<key>data_values</key>
<string>0.2 0.2 0.1 0.2 0.2 0.2 0.2 0.2 0.2 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6</string>
<key>grid_x_length</key>
<integer>3</integer>
<key>grid_y_length</key>
<integer>3</integer>
<key>grid_z_length</key>
<integer>3</integer>
</dict>
</plist>

Least Squares

The following is the XML needed for least squares. Least Squares graphs are made with the Least Squares task so first select that task from the Tasks tool, click the Fetch tool, enter the URL to the XML content shown below. Then click the "Fetch Data" button.

Available at this URL: leastsquares.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>title</key>
<string></string>
<key>x_title</key>
<string>XML-X-Title</string>
<key>y_title</key>
<string>XML-Y-Title</string>
<key>data_values</key>
<string>1 31 2 36 3 32 4 33 5 25</string>
</dict>
</plist>

Least Squares is unusual because the Info tool shows <key>data_1</key> and <key>data_2</key> as data keys, but the XML uses the <key>data_values</key> key. That is an intricate implementation detail of this task that I won't explain, but mention so that you know not to totally rely upon the Info tool for the Least Squares task.

Conclusion

There are many graph types that can be updated with XML and those graphs can be accessed using the various tasks and their representations. With a little experimentation XML fetching may solve a lot of problems.




© Copyright 1993-2021 by VVimaging, Inc. (VVI); All Rights Reserved. Please email support@vvi.com with any comments you have concerning this documentation. See Legal for trademark and legal information.