Giter VIP home page Giter VIP logo

charts-demo's Introduction

MongoDB Charts

Setup the Datasets

Download the airbnb dataset, unzip it, and import it into your MongoDB Atlas cluster. Have a look at the command line tools for directions on how to use mongoimport with MongoDB Atlas. The included dataset is sized to be able to fit into a free M0 cluster on MongoDB Atlas.

Analysing Airbnb Data

Add a Data Source

  1. With a dataset in place, you'll want to enable Charts for your project.
  2. Select the Charts link on the left-hand side, then select the Activate MongoDB Charts button.
  3. Add a new data source to your project, choose the Cluster, database and collection. For this example, I'll use the sanFranciscoListingsAndReviews collection. Then I'll accept the default permissions.

Create a Dashboard

  1. Go to the Dashboards tab
  2. Click New Dashboard
  3. Enter a name and description

Add Some Charts

Inside the MongoDB Charts dashboard, you'll now add a chart to the dashboard.

Multi-Series Stacked Bar Chart

Let's locate the neighborhoods in San Francisco that have the most Airbnb properties and split them out by property type.

  1. Select the San Francisco Airbnb (airbnb.sanFranciscoListingsAndReviews) dataset as the datasource.
  2. For the Chart Type select Bar/Stacked.
  3. Use the following in the Encoding sections for the chart data:
    • X Axis: _id, Count aggregation
    • Y Axis: address.suburb
      • Sort By: Aggregated Value, Descending
      • Limit: 30
    • Series: property_type
  4. Add a name to the chart, like Properties by Location

Your chart should look something like: Properties by Location


Show the areas with the most expensive properties, and correlate with the review scores.

Data Source: Select the San Francisco Airbnb (airbnb.sanFranciscoListingsAndReviews) dataset as the datasource.

Chart Title: Price by Location, Colored by Location Review Score

Chart Type: Bar / Colored

Encodings:

  • X Axis: price, Mean aggregation
  • Y Axis: address.suburb
    • Sort By: Aggregated Value, Descending
    • Limit: 30
  • Color: review_scores.review_scores_location, Mean aggregation

Your chart should look something like: Price by Location, Colored by Location Review Score


Show the number of properties with various review scores

Data Source: Select the San Francisco Airbnb (airbnb.sanFranciscoListingsAndReviews) dataset as the datasource.

Chart Title: Review Score Histogram

Chart Type: Column / Grouped

Encodings:

  • X Axis: review_scores.review_scores_rating
    • Binning: On, bin size 5
  • Y Axis: _id, Count aggregation
  • Filter (to hide properties with no review score):
    • { 'review_scores.review_score_rating': { $gte: 0 }}

Your chart should look something like: Review Score Histogram


Show the types of properties that contain pools.

Data Source: Select the San Francisco Airbnb (airbnb.sanFranciscoListingsAndReviews) dataset as the datasource.

Chart Title: Properties with Pools

Chart Type: Circular / Donut

Encodings:

  • Label: property_type
  • Arc: _id, Count aggregation
  • Filter (to show only properties with pools):
    • { amenities: 'Pool' }

Your chart should look something like: Properties with Pools


Show the number of reviews of any property, month by month

Data Source: Select the San Francisco Airbnb (airbnb.sanFranciscoListingsAndReviews) dataset as the datasource.

Chart Title: Reviews Over Time

Chart Type: Area / Discrete

Encodings:

  • X Axis: reviews.date
    • Array Reduction: Unwind Array
    • Binning: On, bin by month
  • Y Axis: _id, Count aggregation

Your chart should look something like: Reviews Over Time


Show the number of properties with and without pools by area

Data Source: Select the San Francisco Airbnb (airbnb.sanFranciscoListingsAndReviews) dataset as the datasource.

Chart Title: Pool or No Pool

Chart Type: Column / Stacked

Encodings:

  • X Axis: address.suburb
  • Y Axis: _id, Count aggregation
  • Series: amenities
    • Array Reduction: Existence of value: "Pool"

Your chart should look something like: Pool or No Pool

charts-demo's People

Contributors

kenwalger avatar macdaddynyc-mongo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.