Reputation:
I'm using SlamData to model data stored in MongoDB. Each object looks something like this:
{
//... other fields
rating: 3
//... other fields
}
When I try to build my chart, I select "rating" as the category, but then it seems I have no option to simply count the number of ratings.
I'm looking for a chart with 5 bars (the ratings are 1-5). For each bar, I want to display the number of objects with that rating.
Upvotes: 0
Views: 72
Reputation: 73
Inside of SlamData when building out a bar chart, you need to provide a field that can be used for the category and a field that can be used for the measure. What I would do is something along the lines of the following:
Add a Query card with a query similar to the following:
select
count(*) as cnt
, rating
from
`/mount/database/collection`
group by
rating
Add a Setup Chart card and choose Bar Chart with the following information:
Category: rating
Measure: cnt
Add a Show Chart card
That should give you what you need.
Upvotes: 0