Difference between revisions of "Template Displays"

From dataZoa Wiki
Jump to: navigation, search
(Created page with "<div class="imgGlyph24 imgConcept"></div> Rather than making a set of Displays that are identical in except for the data they contain, you can implement a template mechan...")
 
Line 1: Line 1:
<div class="imgGlyph24 imgConcept"></div>&nbsp;Rather than making a set of Displays that are identical in except for the data they contain, you can implement a template mechanism to pop different data sets into the display dynamically (typically from a drop down list of data choices).  
+
<div class="imgGlyph24 imgIdea"></div>&nbsp;Rather than making a set of Displays that are identical in except for the data they contain, you can implement a template mechanism to pop different data sets into the display dynamically (typically from a drop down list of data choices). For example, you might want to show the same 7 employment categories for 10 different MSAs, and rather than a different display for each MSA, a single template will let you select an MSA from a drop down list and see it swapped in. 
 +
<br>
 +
<div class="imgGlyph24 imgNote"></div>&nbsp;Skills required for this technique:
 +
* HTML
 +
* Javascript
 +
* dataZoa Grouplists
  
<div class="imgGlyph24 imgConcept"></div>&nbsp;Template displays are when a dataZoa Display is designed somewhat generically (typically with regards to row labels) and for which the datasets used is swapped at display time. This is accomplished by providing a target dataset to use in the form of a GroupList name within the same account and via the glname argument of the embedded display's src attribute.
 
 
<br>
 
<br>
 +
<div class="imgGlyph24 imgConcept"></div>&nbsp;Templatiung of displays combines three concepts:
 +
* Make several dataZoa Grouplists that contain conceptually and structurally similar data that vary in one particular aspect.  For example, you might make 10 Grouplists of the same 7 employment statistics for different MSAs. 
 +
* Build a Table in the usual way using one the Grouplists.
 +
* Embed the Table on your webpage in the usual way.
 +
* Implement an HTML <nowiki><select></nowiki> (aka "drop down") list with options for each of the geographies that have the corresponding Grouplist as their values.
 +
* Add the Javascript <i>UpdateFrame</i> function below to your webpage.
 +
* Add an "onchange" function to the <nowiki><select></nowiki> that will call UpdateFrame as described in its comments <br>
 
Templates work with any display type, but in this discussion we will just refer to a dataZoa Table Display.
 
Templates work with any display type, but in this discussion we will just refer to a dataZoa Table Display.
 
<br>
 
<br>

Revision as of 09:16, 16 January 2020

 Rather than making a set of Displays that are identical in except for the data they contain, you can implement a template mechanism to pop different data sets into the display dynamically (typically from a drop down list of data choices). For example, you might want to show the same 7 employment categories for 10 different MSAs, and rather than a different display for each MSA, a single template will let you select an MSA from a drop down list and see it swapped in.


 Skills required for this technique:
  • HTML
  • Javascript
  • dataZoa Grouplists


 Templatiung of displays combines three concepts:
  • Make several dataZoa Grouplists that contain conceptually and structurally similar data that vary in one particular aspect. For example, you might make 10 Grouplists of the same 7 employment statistics for different MSAs.
  • Build a Table in the usual way using one the Grouplists.
  • Embed the Table on your webpage in the usual way.
  • Implement an HTML <select> (aka "drop down") list with options for each of the geographies that have the corresponding Grouplist as their values.
  • Add the Javascript UpdateFrame function below to your webpage.
  • Add an "onchange" function to the <select> that will call UpdateFrame as described in its comments

Templates work with any display type, but in this discussion we will just refer to a dataZoa Table Display.
To begin, make a table specifically for your app which contains all the data needed and then use AJAX to fetch it.

 Some Advantges:
  • You can mark the row (series) labels to easily identify their data
  • Label knockouts are available
  • Just one fetch for multiple series
  • The displays are server-cached for speed
  • A GroupList parameter (glname=... on a table gives access to multiple datasets
  • A LatestValues display gives you current values, prior values and/or (%) changes


 Remember:
  • Use jQuery (or similar library) to parse the structured classes in the display and get the data values
  • There is a limit of 50 points of historical data per series for tables.