Exhibit/Coders

Exhibit Reference Home &raquo; A coder translates a piece of information to some visual feature; for example


 * 1) from the   property value   to the color red, and from   to the color blue
 * 2) from the   property value   to an icon showing a fork and a knife, and from   to an icon showing a bed
 * 3) from the   property value   (assumed to be the magnitude of an earthquake) to the number , indicating how large the corresponding map marker should be
 * 4) from the   property value   (assumed to be in celcius) to the color code , a particular shade of blue indicating how cold it is.
 * 5) from the   property value of 1 to to the text "First kind"? [question]

Specifying Coders
A coder can be specified in HTML much like how collections, lens templates, views, and facets are specified. As a coder's job is to translate, to specify a coder you need to specify its inputs and its outputs, i.e., translate what to what. For the political party coder, we can write

&lt;div ex:role="coder" ex:coderClass="Color" id="political-party-colors"&gt; &lt;span ex:color="red"&gt;Republican&lt;/span&gt; &lt;span ex:color="blue"&gt;Democrat&lt;/span&gt; &lt;span ex:color="gray" ex:case="others"&gt;Any other party&lt;/span&gt; &lt;span ex:color="white" ex:case="mixed"&gt;Multiple parties&lt;/span&gt; &lt;span ex:color="black" ex:case="missing"&gt;No party&lt;/span&gt; &lt;/div&gt;

The first two spans specify the colors (outputs) for particular parties (inputs). The last three spans specify special cases. If a politician is associated with any party beside Republican and Democrat, gray is used. If he is associated with several parties, white is used. If he has no party at all, black is used. Note that if these colors are used to color markers on a map, then the "mixed" case is also applicable when several politicians of different parties are plotted with the same marker (as they are located at the same point).

The customizable text "Any other party", "Multiple parties", and "No party" can be used in legends.

Similarly, the restaurant/hotel coder can be specified as follows:

&lt;div ex:role="coder" ex:coderClass="Icon" id="service-icons"&gt; &lt;span ex:icon="fork-knife.png"&gt;Restaurant&lt;/span&gt; &lt;span ex:icon="bed.png"&gt;Hotel&lt;/span&gt; &lt;span ex:icon="question-mark.png" ex:case="others"&gt;Other service&lt;/span&gt; &lt;span ex:icon="many-question-marks.png" ex:case="mixed"&gt;Multiple services&lt;/span&gt; &lt;span ex:icon="x.png" ex:case="missing"&gt;No service&lt;/span&gt; &lt;/div&gt;

The earthquake coder can be specified as follows:

&lt;div ex:role="coder" ex:coderClass="SizeGradient" id="earthquake-magnitudes" ex:gradientPoints="1, 20; 10, 60" &gt;&lt;/div&gt;

If this coder is used to size map markers of earthquakes, then an earthquake of 1 would be plotted with a marker measuring 20 pixels wide, and the marker of an earthquake of 10 would measure 60 pixels wide. Earthquakes of magnitudes between 1 and 10 would be plotted with markers of sizes in between, linearly interpolated.

The temperature coder can be specified as follows:

&lt;div ex:role="coder" ex:coderClass="ColorGradient" id="temperature-colors" ex:gradientPoints="-40, #000088; 0, #ffffff; 50, #ff0000" &gt;&lt;/div&gt;

This means that -40 celcius will yield a deep blue color, #000088; zero degree will yield white; and 50 celcius will yield a bright red color.

Connecting to Coders
To connect a view or a facet to a coder, you need to specify on the view or facet which coder to use and what data to feed it. Say we want to have a map view plotting politicians colored by political parties, then we can specify that map view as follows:

&lt;div ex:role="view" ex:viewClass="Map" ex:latlng=".latlng" ex:colorCoder="political-party-colors" ex:colorKey=".party" &gt;&lt;/div&gt;

Note that "political-party-colors" is the ID of the appropriate coder specified earlier.

If you want a map view of buildings and the services available in them, then write:

&lt;div ex:role="view" ex:viewClass="Map" ex:latlng=".latlng" ex:iconCoder="service-icons" ex:iconKey=".service" &gt;&lt;/div&gt;

You could potentially use several coders in the same view. For example, say you are plotting natural disasters, then you might want to use an icon coder to show whether a disaster is an earthquake, a volcano eruption, a tsunami, etc. You might want the size of the map markers to show the magnitudes of those disasters, and the colors to show the casualties (e.g., more red means more casualties).

Troubleshooting
If you have specified a coder on your page and are not seeing the expected results, ensure that your coder div is not contained within the view panel element. It is easy to forget and include the coder div next to your view declarations as the views reference the coders. However, if your coder is within your view panel element, exhibit will not parse the coder.

For icon coders, try using an absolute (http :// www.example.com / path / images / image.png) instead of a relative path to the icon image in the Coder section.