Graph User Manual

GraphTutorials ► XML Fetch

The Fetch Data 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.

Note: If you are viewing this on an iPhone, iPad or iPod touch then see the section below to find out how to copy the plist URLs to do the fetch.

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 Home page, enter "All" in the Fetch Data row and then touch the Fetch Data arrow to navigate to the Fetch Data tool. Then enter the URL to the XML content shown below. Then touch 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 "Fetch During Animation" and "Fetch During Appearance", touch "Done", touch the Edit Graph tool and touch the start acquisition button. 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 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 Home page, enter "All" in the Fetch Data row and then touch the Fetch Data arrow to navigate to the Fetch Data tool. Then enter the URL to the XML content shown below. Then touch the "Fetch Data" button.

The next time you select a representation on the Set Of Scalars page the fetched data will show.

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 Home page and then touch the Fetch Data arrow to navigate to the Fetch Data tool. Then enter the URL to the XML content shown below. Then touch 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 Home page and then touch the Fetch Data arrow to navigate to the Fetch Data tool. Then enter the URL to the XML content shown below. Then touch 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 Home page and then touch the Fetch Data arrow to navigate to the Fetch Data tool. Then enter the URL to the XML content shown below. Then touch 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.

Note

If you are viewing this on an iPhone, iPad or iPod touch then you can copy the plist URLs in this tutorial by touch-hold on a URL and then select the "Copy" button. Then launch the Graph (or Vvidget) application, go to the respective Task's Fetch Data page and touch-hold in the URL text field and then Paste the URL. Otherwise, simply touch the Fetch Data URL text field to bring up the keypad and type in a URL.

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. Note that in a more vertical-market SOA client the Fetch Data URL is embedded in the application and not entered by the user. However, in the context of this manual and the application it describes, which is a horizontal-market application, the URL is entered by the user.




© 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.