David Huynh wrote:
> 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
>  

I got my exhibit running against the 2.0 version...

> and then try this expression
>    .quantity * .cost
> Please note the spaces surrounding *. The expression parser is flaky at 
> the moment.

...but I can't get this to work. I get the error:

"""
Caught exception: TabularView: Error processing configuration of tabular 
view.

Details: Error: Extra text found at the end of the code
"""

I'm doing stuff like:

<div ex:role="exhibit-view"
      ...
      ex:columns=".foo, .bar, .x * .y"
      ...
 >

> (Of course, this development version is changing and might be breaking 
> intermittently.)

might this be the cause?

>> 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?

Off the top of my head? Not much :-) I did realize that adding a new 
format isn't as simple as I thought. There are other places that treat 
numbers specially, and since currency is a type of number, it needed 
special treatment also. (For example, to get currency ranges to work 
correctly in the new range facets.)

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

Yes, I agree, it is quite challenging. :-)

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

Well, +1 from me for this approach.

>> 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]

I will when I have something stable -- for now, I sent a small bug fix 
patch against the exhibit 2.0 range code to [EMAIL PROTECTED], but haven't seen 
it gone through to the list yet. (I'm not a member of that list, so the 
message is held for moderation.)

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

Great; I plan to try this out shortly.

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

thanks, David!

Lee

_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general

Reply via email to