Summary Table Views

9 views
Skip to first unread message

Bruce Robertson

unread,
Apr 10, 2008, 10:01:25 PM4/10/08
to SIMILE Widgets
Table and grid views are useful. The automatic column sorting is
handy, as is the grid view group-by feature. But what about the next
step? Creating summaries, or group-by summaries?

Bruce Robertson

unread,
Apr 10, 2008, 10:09:02 PM4/10/08
to SIMILE Widgets
So for instance, let's say I wanted to summarize by country; or by
company; or by country then state..

Bruce Robertson

unread,
Apr 10, 2008, 10:11:08 PM4/10/08
to SIMILE Widgets
That is, using the Billionaires example for instance.

David Huynh

unread,
Apr 11, 2008, 12:16:26 PM4/11/08
to simile-...@googlegroups.com
Would you care to elaborate? I don't know what you mean by "summarize".
A sketch or screenshot mock-up would be nice.

We also have charts, e.g.,

http://people.csail.mit.edu/dfhuynh/projects/factbook/factbook-people.html
They can be considered summaries.

David

Bruce Robertson

unread,
Apr 11, 2008, 1:43:50 PM4/11/08
to SIMILE Widgets
> http://people.csail.mit.edu/dfhuynh/projects/factbook/factbook-people...
> They can be considered summaries.
>
> David

Hm, language vs membership in that example is good.

Also see
<http://concise-design.com/downloads/summary.pdf>

Bruce Robertson

unread,
Apr 11, 2008, 1:52:22 PM4/11/08
to SIMILE Widgets


On Apr 11, 9:16 am, David Huynh <dfhu...@alum.mit.edu> wrote:
> http://people.csail.mit.edu/dfhuynh/projects/factbook/factbook-people...
> They can be considered summaries.
>
> David

Some of these things I have not seen before.

I do not see any documentation for the view classes such as pivot
table and barchart and scatterplot views, where do I find that?

David Huynh

unread,
Apr 14, 2008, 10:14:16 AM4/14/08
to simile-...@googlegroups.com
Bruce Robertson wrote:
> Hm, language vs membership in that example is good.
>
> Also see
> <http://concise-design.com/downloads/summary.pdf>
>

I see. Take a look at the Tabular View implementation

http://code.google.com/p/simile-widgets/source/browse/exhibit/trunk/src/webapp/api/scripts/ui/views/tabular-view.js
The _reconstruct function is what generates the UI. You can add grouping
and summarizing features to it.

David

Bruce Robertson

unread,
Apr 14, 2008, 1:44:19 PM4/14/08
to SIMILE Widgets
Well, thanks, I'll have to give that a try. Any examples that you know
of?

David Huynh

unread,
Apr 15, 2008, 9:46:14 AM4/15/08
to simile-...@googlegroups.com
No, I don't think I have seen anyone modify the tabular view before.

One of the issues to look out for is that an item can belong in several
groups.

Another issue is how expressive the group summaries can be. Can you only
get SUM(), or also MIN(), MAX(), AVG(), MEDIAN(), STDEV(), STDERR(),
...? How are the summary rows formatted?...

David

Bruce Robertson

unread,
Apr 17, 2008, 12:16:47 PM4/17/08
to SIMILE Widgets
I'm not quite following the wording of your question.

I'm asking you how to generate and format summary rows, based on user
selected groupings.

I'm asking you how to get totals. Sums and averages would meet the
most immediate need.

On Apr 15, 6:46 am, David Huynh <dfhu...@alum.mit.edu> wrote:
> No, I don't think I have seen anyone modify the tabular view before.
>
> One of the issues to look out for is that an item can belong in several
> groups.
>
> Another issue is how expressive the group summaries can be. Can you only
> get SUM(), or also MIN(), MAX(), AVG(), MEDIAN(), STDEV(), STDERR(),
> ...? How are the summary rows formatted?...
>
> David
>
> Bruce Robertson wrote:
> > Well, thanks, I'll have to give that a try. Any examples that you know
> > of?
>
> >> Bruce Robertson wrote:
>
> >>> Hm, language vs membership in that example is good.
>
> >>> Also see
> >>> <http://concise-design.com/downloads/summary.pdf>
>
> >> I see. Take a look at the Tabular View implementation
>
> >>http://code.google.com/p/simile-widgets/source/browse/exhibit/trunk/s...

David Huynh

unread,
Apr 18, 2008, 1:35:24 PM4/18/08
to simile-...@googlegroups.com
Bruce Robertson wrote:
> I'm not quite following the wording of your question.
>
> I'm asking you how to generate and format summary rows, based on user
> selected groupings.
>
> I'm asking you how to get totals. Sums and averages would meet the
> most immediate need.
>
It's hard to answer those questions without getting deep into the
Tabular View's implementation. Have you looked at the Tabular View's
code? How far have you gotten? I can help with more specific programming
questions.

David

Bruce Robertson

unread,
Apr 18, 2008, 2:41:42 PM4/18/08
to SIMILE Widgets
Thanks, I'm trying to figure out where to look.

Besides tabular-view.js it also looks like I need to understand
collection-summary-widget.js

Bruce Robertson

unread,
Apr 18, 2008, 6:21:38 PM4/18/08
to SIMILE Widgets
Perhaps we can start here. Let's say the user has selected a sort
column.

Simplest question:
How would I insert a blank row after the last value?

That is, user has selected City as sort column.

Portland
Portland
Seattle
Seattle
Seattle

Becomes:

Portland
Portland
(blank)
Seattle
Seattle
(blank)

Harder question:
How would insert the summary, for example count of City

David Huynh

unread,
Apr 21, 2008, 11:32:00 AM4/21/08
to simile-...@googlegroups.com
Please look in

http://static.simile.mit.edu/exhibit/api-2.0/scripts/ui/views/tabular-view.js
and find the function Exhibit.TabularView.prototype._reconstruct. In
that function, near the very end, you would find this loop:

for (var i = 0; i < items.length; i++) {
renderItem(i);
}

You need to replace this loop to something like this:

var generateSummaryRow = function(firstIndex, lastIndex) {
var tr = table.insertRow(table.rows.length);

for (var c = 0; c < self._columns.length; c++) {
var column = self._columns[c];
var td = tr.insertCell(c);

if (column.format == "number") {
var sum = 0;
for (var i = firstIndex; i <= lastIndex; i++) {
var item = items[i];
var results =
column.expression.evaluateOnItem(item.id, database);
results.values.visit(function(v) {
if (typeof v == "number") {
sum += v;
} else {
try {
var n = parseFloat(v.toString());
if (!isNaN(n)) {
sum += n;
}
} catch (e) {
}
}
});
}

td.innerHTML = sum;
}
}
};

var currentSortKey = undefined;
var firstIndexInGroup = -1;
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (item.sortKey != currentSortKey) {
if (firstIndexInGroup >= 0) {
generateSummaryRow(firstIndexInGroup, i - 1);
}

currentSortKey = item.sortKey;
firstIndexInGroup = i;
}
renderItem(i);
}
if (firstIndexInGroup >= 0) {
generateSummaryRow(firstIndexInGroup, items.length - 1);
}

David

Bruce Robertson

unread,
Apr 21, 2008, 3:23:12 PM4/21/08
to SIMILE Widgets
Thanks! I'll see what I can do.

On Apr 21, 8:32 am, David Huynh <dfhu...@alum.mit.edu> wrote:
> Please look in
>
> http://static.simile.mit.edu/exhibit/api-2.0/scripts/ui/views/tabular...
> etc
Reply all
Reply to author
Forward
0 new messages