Pivot View Totals?

82 views
Skip to first unread message

Bruce Robertson

unread,
May 23, 2008, 6:05:00 AM5/23/08
to SIMILE Widgets
In the Exhibit charting extension pivot table view, is there a way to
get row and column totals?

Bruce Robertson

unread,
May 23, 2008, 6:25:16 PM5/23/08
to SIMILE Widgets
Also, how do I get totals (sums) instead of counts in the existing
columns.

For instance on Hotel Occupancy I want a sum of PAX.

http://concise-design.com/exhibit/hotels.html

David Huynh

unread,
May 27, 2008, 4:51:19 PM5/27/08
to simile-...@googlegroups.com
Bruce Robertson wrote:
> In the Exhibit charting extension pivot table view, is there a way to
> get row and column totals?
>
Bruce, there is no support for that at the moment.

If you look at the function _makeTable in


http://static.simile.mit.edu/exhibit/extensions-2.0/chart/scripts/pivot-table-view.js

you should see a pair of nested for loops. It shouldn't be too hard to
get the total for each row. Something like this would do:

for (var r = 0; r < rowCount; r++) {
...

var rowItems = this._rowPath.evaluateBackward(rowValue,
rowResults.valueType, items, database).getSet();
var rowTotal = 0;
for (var c = 0; c < columnCount; c++) {
...

if (cellResults.valueType == "number" &&
cellResults.values.size() == 1) {
cellResults.values.visit(function(v) {
rowTotal += (typeof v == "number") ? v : parseFloat(v);
...
});
} else {
...
}
}

td = tr.insertCell(cellToInsert++);
td.appendChild(document.createTextNode(rowTotal));
}

By the way, note that each cell might not contain a number. It depends
on what you set in ex:cell.

David

David Huynh

unread,
May 27, 2008, 4:54:01 PM5/27/08
to simile-...@googlegroups.com
Bruce Robertson wrote:
> Also, how do I get totals (sums) instead of counts in the existing
> columns.
>
> For instance on Hotel Occupancy I want a sum of PAX.
>
> http://concise-design.com/exhibit/hotels.html
>
Change ex:cell="count(value)" to ex:cell="add(.@pax)". Note that .@ is
used so that duplicated pax numbers are kept.

David

Bruce Robertson

unread,
May 27, 2008, 5:20:49 PM5/27/08
to SIMILE Widgets
Excellent, thanks!

But where do I find this kind of thing documented

David Huynh

unread,
May 27, 2008, 6:43:47 PM5/27/08
to simile-...@googlegroups.com
Bruce Robertson wrote:
> Excellent, thanks!
>
> But where do I find this kind of thing documented
>
Unfortunately, nowhere right now. But I'm trying my best to answer
questions here.

It's unfortunate that I'm the only full-time developer on Exhibit,
Babel, Timeline, Seek, Potluck, Backstage. Sometimes I also provide
technical support for Solvent, Piggy Bank, Longwell, and chimed in on
Crowbar. I also have other duties and interests. And documentation isn't
a very appealing task compared to research and coding ... The hope is
that our enthusiastic users might spare a minute to help editing our
wiki and add tips for other users.

And this hope has worked out in a number of cases. Tom Woodward and
Brian Croxall have made excellent tutorials on Exhibit and Timeline;
we're very grateful! And since our code move to Google Code we have
gotten a number of code contributions, too. That's very exciting.

Another hope is to find funding for a real full-time developer, one who
doesn't get distracted with wild research tangents like I do. :-)

Hope that helps,

David

Bruce Robertson

unread,
May 27, 2008, 7:22:12 PM5/27/08
to SIMILE Widgets
This is such a great resource and you have provided really wonderful
support.

But it is a little worrying to ponder where this is going and how well
it will survive.

Bruce Robertson

unread,
May 28, 2008, 2:49:04 AM5/28/08
to SIMILE Widgets
Got it! (Next I'd like to figure out styling e.g. bold totals and row
grid continuity)

http://concise-design.com/exhibit/hotels.html

On May 27, 1:51 pm, David Huynh <dfhu...@alum.mit.edu> wrote:
> Bruce Robertson wrote:
> > In the Exhibit charting extension pivot table view, is there a way to
> > get row and column totals?
>
> Bruce, there is no support for that at the moment.
>
> If you look at the function _makeTable in
>
> http://static.simile.mit.edu/exhibit/extensions-2.0/chart/scripts/piv...

David Karger

unread,
May 28, 2008, 4:11:06 PM5/28/08
to simile-...@googlegroups.com
In particular, note that the exhibit documentation at simile.mit.edu is
a wiki, so if any of you feel moved to add some of what you pry out of
david, it will help others in the future :)

David Huynh

unread,
Jun 2, 2008, 10:43:45 AM6/2/08
to simile-...@googlegroups.com
Bruce Robertson wrote:
> This is such a great resource and you have provided really wonderful
> support.
>
> But it is a little worrying to ponder where this is going and how well
> it will survive.
>
We can afford some optimism :-) Besides, you can always walk away with
the whole open source code base for no cost at all. You can't say the
same about closed source if the vendor company folds.

One way to ensure that this will survive is to boost interest on it. If
enough people use it, maybe there are enough resources (financial,
expertise) to keep it going. My recent message on "The Exhibition"
hinted at a plan to tell search engines that there is a gold mine of
structured data in exhibits to index. 2,800 public exhibits are not a
bad start, but more will make the message stronger. I understand your
use of Exhibit is all private, but if there's any chance for you to make
public exhibits, I think that'd help us all.

Thanks,

David

Bruce Robertson

unread,
Jun 2, 2008, 12:11:50 PM6/2/08
to SIMILE Widgets
Well, I am on the hook to do exactly that (promote Exhibit) to a local
FileMaker user group in Seattle as well as one in Portland.

And the Filemaker Developer's conference is coming up in July and I
will be talking about it there.
I'm not presenting; but will be spreading the word.

http://www.filemaker.com/developers/devcon/index.html

Toward that end I will probably be asking more questions and trying to
get examples more polished up.

David Huynh

unread,
Jun 2, 2008, 12:37:59 PM6/2/08
to simile-...@googlegroups.com
That's wonderful news! Thank you!

(I'm moving soon so I might not be able to respond quickly. But I'm sure
other people on the list can chime in for your questions.)

David

Reply all
Reply to author
Forward
0 new messages