Creating bar chat based on count of records with certain property

52 views
Skip to first unread message

Thamizh Vaanan

unread,
Apr 3, 2011, 9:44:11 AM4/3/11
to simile-...@googlegroups.com
Hi,

I would like to generate a Bar chart (or even a tabular view to start with) to list each property against its count (basically similar to the information displayed on facets). To explain using the "Nobel list" example from tutorial:

"I need to create a bar chart showing number of Nobel prize winners from each discipline (or grouped by any of the properties for that matter)"

Is it possible to achieve that without populating the json with the necessary meta data (i.e, count the Nobel winners per discipline and feeding it in to the json). Please excuse if this is a n00b question, I really did try my best to find it out from existing scattered documentation.

--
N.Thamizhvaanan

David Karger

unread,
Apr 6, 2011, 2:44:49 AM4/6/11
to simile-...@googlegroups.com
Here's a quick hacked example of the kind of thing you want. Looking at
the source will hopefully provide enough guidance.
http://people.csail.mit.edu/karger/Exhibit/Nobelists/nobelists.html

> --
> You received this message because you are subscribed to the Google
> Groups "SIMILE Widgets" group.
> To post to this group, send email to simile-...@googlegroups.com.
> To unsubscribe from this group, send email to
> simile-widget...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/simile-widgets?hl=en.

Benny

unread,
Apr 27, 2011, 11:49:56 AM4/27/11
to SIMILE Widgets
Thanks Karger,

This is certainly how I want it to look. But I cannot comprehend why
the bar chart is not tied to the facets, that it doesn't change when
the selections in the facet change.

This is a wonderful library and I thoroughly enjoyed using it so far.
Hearty thanks to all those involved in this so far!

On Apr 6, 2:44 pm, David Karger <kar...@mit.edu> wrote:
> Here's a quick hacked example of the kind of thing you want.  Looking at
> the source will hopefully provide enough guidance.http://people.csail.mit.edu/karger/Exhibit/Nobelists/nobelists.html

David Karger

unread,
Apr 27, 2011, 12:24:12 PM4/27/11
to simile-...@googlegroups.com
that is because the page is using _collections_. there are two
collections on the page: the default collection of nobelists+disciplines
and the "disciplines" collection of disciplines. the bar chart is using
the disciplines collection via the "collectionID" attribute; the facets
are filtering the default collection (and in fact, are only relevant to
the nobelists).

I think what you would like to do is filter the nobelists, then use the
bar chart to plot how many nobelists are selected in each discipline.
Unfortunately this is not currently possible. The bar chart is designed
to take a collection of items, to make a row for each item, and to
compute a value for each item. the way i have it set up, the values are
the disciplines and the value is the number of nobelists with that
discipline. This is done using the count(!discipline) function.
Unfortunately there is no way in the exhibit function language to
specify that you want the number of nobelists _currently filtered_ that
have the given discipline.

Nik_G @OpenHalton

unread,
May 19, 2011, 10:33:39 AM5/19/11
to SIMILE Widgets
Hi David -

You mentioned it's not _currently_ possible to make the bar chart
dynamic, refreshed when new filters are applied.
Is it possible in general? Could the exhibit function language support
that functionality, and what would it take to make it happen?

Nik

On Apr 27, 12:24 pm, David Karger <kar...@mit.edu> wrote:
> that is because the page is using _collections_.  there are two
> collections on the page: the default collection of nobelists+disciplines
> and the "disciplines" collection of disciplines.  thebarchartis using
> the disciplines collection via the "collectionID" attribute; the facets
> are filtering the default collection (and in fact, are only relevant to
> the nobelists).
>
> I think what you would like to do is filter the nobelists, then use thebarchartto plot how many nobelists are selected in each discipline.  
> Unfortunately this is not currently possible.  Thebarchartis designed
> to take a collection of items, to make a row for each item, and to
> compute a value for each item.  the way i have it set up, the values are
> the disciplines and the value is the number of nobelists with that
> discipline.  This is done using the count(!discipline) function.  
> Unfortunately there is no way in the exhibit function language to
> specify that you want the number of nobelists _currently filtered_ that
> have the given discipline.
>
> On 4/27/2011 11:49 AM, Benny wrote:
>
>
>
>
>
>
>
> > Thanks Karger,
>
> > This is certainly how I want it to look. But I cannot comprehend why
> > thebarchartis not tied to the facets, that it doesn't change when
> > the selections in the facet change.
>
> > This is a wonderful library and I thoroughly enjoyed using it so far.
> > Hearty thanks to all those involved in this so far!
>
> > On Apr 6, 2:44 pm, David Karger<kar...@mit.edu>  wrote:
> >> Here's a quick hacked example of the kind of thing you want.  Looking at
> >> the source will hopefully provide enough guidance.http://people.csail.mit.edu/karger/Exhibit/Nobelists/nobelists.html
>
> >> On 4/3/2011 9:44 AM, Thamizh Vaanan wrote:
>
> >>> Hi,
> >>> I would like to generate aBarchart(or even a tabular view to start
> >>> with) to list each property against its count (basically similar to
> >>> the information displayed on facets). To explain using the "Nobel
> >>> list" example from tutorial:
> >>> "I need to create abarchartshowing number of Nobel prize winners

Thamizh Vaanan

unread,
May 19, 2011, 11:25:51 AM5/19/11
to simile-...@googlegroups.com
Nik,

I don't think he means that the bar chart cannot be dynamic. It is indeed dynamic and refreshes when new filters are applied. (See this example):

http://www.simile-widgets.org/exhibit/examples/factbook/factbook-people.html

But the limitation he mentions stems from the fact that bar chart values are currently tied to items (i.e a bar is drawn for each row of data). If we want to have a bar chart similar to an excel pivot chart, it wouldn't be possible with a simple hack. That is why for my requirement, he made it work by creating a separate collection with each discipline as an item. At least this is what I understood. Someone please correct me if I am wrong.

Having mentioned Pivot chart here, I see that we have a Pivot table option in exhibhit. How difficult would it be to extend it to a pivot chart?

Kind regards,
--
N.Thamizhvaanan

Nik_G @OpenHalton

unread,
May 19, 2011, 2:34:29 PM5/19/11
to SIMILE Widgets
Hi Thamizh & David -

Yes, sorry I meant: Dynamic for a "SUM" or "COUNT" of a specific set
of items. In other words, the requirement is similar to what you
mentioned, which is an Aggregate Bar Chart / Pivot Chart for items.

The hack http://people.csail.mit.edu/karger/Exhibit/Nobelists/nobelists.html
is a static bar chart of an aggregate, vs the dynamic visualization
I'm looking for.

Is there enough interest on this to flush out how to get this
implemented?

Nik

On May 19, 11:25 am, Thamizh Vaanan <thamiz...@gmail.com> wrote:
> Nik,
>
> I don't think he means that the bar chart cannot be dynamic. It is indeed
> dynamic and refreshes when new filters are applied. (See this example):
>
> http://www.simile-widgets.org/exhibit/examples/factbook/factbook-peop...
>
> But the limitation he mentions stems from the fact that bar chart values are
> currently tied to items (i.e a bar is drawn for each row of data). If we
> want to have a bar chart similar to an excel pivot chart, it wouldn't be
> possible with a simple hack. That is why for my requirement, he made it work
> by creating a separate collection with each discipline as an item. At least
> this is what I understood. Someone please correct me if I am wrong.
>
> Having mentioned Pivot chart here, I see that we have a Pivot table option
> in exhibhit. How difficult would it be to extend it to a pivot chart?
>
> Kind regards,
>
Reply all
Reply to author
Forward
0 new messages