Lee Feigenbaum wrote:
> Hello, SIMILErs,
>
> I've been playing a bit with Exhibit, and was wondering if you could
> give me a quick example of what a simple arithmetic expression would
> look like? For example, if I have a quantity property and a cost
> property and I wanted an expression for quantity*cost (e.g. as a column
> in a tabular view), what would the expression look like?
>
You need to link against the 2.0 development version
http://simile.mit.edu/repository/exhibit/branches/2.0/src/webapp/api/exhibit-api.js
and then try this expression
.quantity * .cost
Please note the spaces surrounding *. The expression parser is flaky at
the moment.
(Of course, this development version is changing and might be breaking
intermittently.)
> PS In my play tonight, I've made additions to the Exhibit code to handle
> two cases which I couldn't see how to do without adding to Exhibit:
>
> 1) I wanted some properties to be formatted as currency values (in
> this case a leading $ and then commas separating every three digits; in
> reality you'd want this to be delegated to the proper l10n module), so I
> added a 'currency' valueType to makeValueSpan
>
Cool! What other formats can you think of that demand special handling?
I think this issue of units and formats is quite tricky to generalize,
and internationalize. In fact, even a piece of text like "52 Presidents"
is currently generated in an English-centric fashion based on the
singular/plural distinction. This clearly does not internationalize well.
> 2) I wanted an item with multiple URLs for a column of type 'image'
> in the tabular view to actually display only a single image but provide
> a way to navigate between the images (for now I just use a click
> handler, but I'm imagining a little left and right arrow below the
> image). I did this by adding a "one-image" column type to the tabular
> view and adjusting the code in tabular-view.js that switches on
> column.format to handle this.
>
I'm thinking of allowing templating individual cells in the tabular
view, so that you can write something like this
<table ex:role="exhibit-view">
<tr>
<td ex:content=".label"></td>
<td><img src=".photo" /></td>
<td><div ex:role="exhibit-widget"
ex:widgetClass="StackWidget"><img src=".photo" /></div></td>
</tr>
</table>
And the StackWidget might be useful outside the tabular view, too. But
don't hold your breath for this. It's just a thought for now.
> I'd love to know if I missed existing ways to (better) accomplish these
> goals, and if not I'd be glad to share the code I added.
>
That would be great! Could you send a patch file to [EMAIL PROTECTED]
> PPS I'm also curious if there's an easy way to get two different views
> on the page at once - for example a map view and a tabular view. I
> imagine it must be possible, but in my initial perusals of the
> documentation, I didn't see any examples of this.
>
Yes, in the 2.0 branch, as long as two views are not inside a common
view panel, they are displayed in parallel.
The 2.0 branch also lets you place the facets individually on your page,
rather than lump them all into one div, e.g.,
http://people.csail.mit.edu/dfhuynh/projects/factbook/factbook-people.html
There are other views like scatter plots and pivot tables as well as
numeric range facets (e.g., the population facet).
Cheers,
David
_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general