{"id":894,"date":"2018-11-12T08:06:35","date_gmt":"2018-11-12T16:06:35","guid":{"rendered":"https:\/\/www.kenwalger.com\/blog\/?p=894"},"modified":"2018-11-12T08:06:35","modified_gmt":"2018-11-12T16:06:35","slug":"visualizing-data-mongodb-charts","status":"publish","type":"post","link":"https:\/\/www.kenwalger.com\/blog\/nosql\/mongodb\/visualizing-data-mongodb-charts\/","title":{"rendered":"Visualizing Your Data With MongoDB Charts"},"content":{"rendered":"<p>Having data stored in a database is practically a given for today\u2019s businesses. Customer information, order history, product pricing, IoT sensor data, and much more is being recorded for future use. However, just having the data stored isn\u2019t enough to form a competitive market advantage. We must be able to analyze the data as well. There are many options to do so and in a variety of ways. If you have data that needs to be visually analyzed in MongoDB, MongoDB <a href=\"https:\/\/www.mongodb.com\/products\/charts\" target=\"_blank\" rel=\"noopener noreferrer\">Charts<\/a> is a terrific option.<\/p>\n<p>Prior to MongoDB Charts, there were really three ways to visualize your MongoDB Data.<\/p>\n<ol type=\"1\">\n<li>Leverage the <a href=\"https:\/\/www.mongodb.com\/download-center\/bi-connector\" target=\"_blank\" rel=\"noopener noreferrer\">MongoDB Business Intelligence (BI) Connector<\/a> in conjunction with third-party BI tools,<\/li>\n<li>Perform Extract-Transform-Load (ETL) operations and leverage third-party tools, or<\/li>\n<li>Write custom code and use charting libraries such as D3.js or Bokeh.<\/li>\n<\/ol>\n<h4>MongoDB Charts Benefits<\/h4>\n<p>MongoDB Charts, currently in Beta, provides an easy way to visualize your data living in MongoDB. You don\u2019t need to move your data to a different repository, write your own code, or purchase third-party tools. MongoDB Charts knows and understands the richness of the Document Data Model and allows for easy data visualization.<\/p>\n<p>Further, MongoDB Charts allows for a secure way to create and share visualization dashboards with everyone, or just targeted team members. Similarly, the data source being used behind the scenes can be shared securely as well. For example, data for the Sales Department doesn\u2019t have to be made available to Marketing unless needed. Very powerful and follows MongoDB\u2019s design of security being a top priority.<\/p>\n<p>After <a href=\"https:\/\/www.mongodb.com\/download-center\/charts\" target=\"_blank\" rel=\"noopener noreferrer\">downloading the MongoDB Charts<\/a> Docker image and following the <a href=\"https:\/\/docs.mongodb.com\/charts\/master\/installation\/\" target=\"_blank\" rel=\"noopener noreferrer\">installation instructions<\/a>, we\u2019re able to connect to a data source stored in MongoDB Atlas and start making visualization dashboards. Once connected to the MongoDB Charts server, there are three steps we need to take:<\/p>\n<ol type=\"1\">\n<li>Add a data source<\/li>\n<li>Create a dashboard<\/li>\n<li>Create our charts<\/li>\n<\/ol>\n<h3>Analyzing Airbnb Data with MongoDB Charts<\/h3>\n<p>I have set up a database with some Airbnb data from various cities. We\u2019ll be exploring the dataset from Seattle, WA here, but feel free to explore others on your own. We need to get the connection string from the Atlas Cluster that has our data and connect to it in Charts.<\/p>\n<figure><a href=\"https:\/\/i0.wp.com\/webassets.mongodb.com\/_com_assets\/cms\/atlas-URI-6k09mb3bg3.gif?ssl=1\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>\n<img data-recalc-dims=\"1\" decoding=\"async\" style=\"display: block; margin-left: auto; margin-right: auto; width: 500px;\" src=\"https:\/\/i0.wp.com\/webassets.mongodb.com\/_com_assets\/cms\/atlas-URI-6k09mb3bg3.gif?w=840&#038;ssl=1\" alt=\"Get URI From MongoDB Atlas for MongoDB Charts\" \/><br \/>\n<\/a><figcaption>Get URI from MongoDB Atlas<\/figcaption><\/figure>\n<h4>Add a Data Source<\/h4>\n<p>With our MongoDB Charts server running on <code>localhost:80<\/code>, we can log in and head to the <i>Data Sources<\/i> tab. We use the URI from Atlas (<code>mongodb+srv:\/\/airbnbdemo:airbnb@airbnb-rgl39.mongodb.net\/test?retryWrites=true<\/code>) and select <i>Connect<\/i>. We\u2019re next asked which data source we want to use from that cluster, I\u2019ll select the <b>seattleListingAndReviews<\/b> from the <code>airbnb<\/code> database for this example. For permissions, I just want to keep everything private so I\u2019ll accept the defaults and select <i>Publish Data Source<\/i>. Once published I can add an alias to the data source. I\u2019ll call it <code>Airbnb Seattle<\/code>.<\/p>\n<blockquote>\n<div class=\"callout\">Note: The URI above contains a sample URI. You should connect to your own Atlas Cluster and use an authorized username and password.<\/div>\n<\/blockquote>\n<h4>Create a Dashboard<\/h4>\n<p>Next up is to create an actual dashboard to house our visualizations. In the <i>Dashboards<\/i> section choose <b>New Dashboard<\/b> and give it a name and description, like <b>Ken\u2019s Airbnb Dashboard<\/b>. This will take me to where I can add charts to my dashboard.<\/p>\n<h4>Create a Chart<\/h4>\n<p>After clicking on the <i>Add Chart<\/i> button we can start building our visualization. We\u2019ll want to choose the <code>Airbnb Seattle<\/code> data source from the drop-down. MongoDB Charts automatically determines which fields are available for exploration. For this exercise, I\u2019d like to see which neighborhoods in Seattle have the most Airbnb properties and split them by property type. We\u2019ll use the Stacked Bar chart for the type.<\/p>\n<ol type=\"1\">\n<li style=\"list-style-type: none;\">\n<ol type=\"1\">\n<li>For the X-Axis then, we\u2019ll want the <code>id<\/code> field, aggregated by count.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<figure><a href=\"https:\/\/i0.wp.com\/webassets.mongodb.com\/_com_assets\/cms\/x-axis-value-cz2tkvt97r.gif?ssl=1\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>\n<img data-recalc-dims=\"1\" decoding=\"async\" style=\"display: block; margin-left: auto; margin-right: auto; width: 500px;\" src=\"https:\/\/i0.wp.com\/webassets.mongodb.com\/_com_assets\/cms\/x-axis-value-cz2tkvt97r.gif?w=840&#038;ssl=1\" alt=\"Assign X-Axis value in MongoDB Charts\" \/><br \/>\n<\/a><figcaption>Assign X-Axis value to a MongoDB Chart<\/figcaption><\/figure>\n<ol type=\"1\">\n<li style=\"list-style-type: none;\">\n<ol type=\"1\">\n<li>Along the Y-Axis we\u2019ll look at the address and the suburb. Notice that <code>address<\/code> is a subdocument here and that MongoDB Charts natively knows how to handle this type of data. I\u2019d like to sort the <code>suburb<\/code> by aggregated value, in descending order, and limit our results to the top 20 suburbs.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<figure><a href=\"https:\/\/i0.wp.com\/webassets.mongodb.com\/_com_assets\/cms\/y-axis-value-h1llqzam8w.gif?ssl=1\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>\n<img data-recalc-dims=\"1\" decoding=\"async\" style=\"display: block; margin-left: auto; margin-right: auto; width: 500px;\" src=\"https:\/\/i0.wp.com\/webassets.mongodb.com\/_com_assets\/cms\/y-axis-value-h1llqzam8w.gif?w=840&#038;ssl=1\" alt=\"Assign Y-Axis value to a Stacked Bar in MongoDB Charts\" \/><br \/>\n<\/a><figcaption>Assign Y-Axis value to a Stacked Bar chart<\/figcaption><\/figure>\n<ol type=\"1\">\n<li style=\"list-style-type: none;\">\n<ol type=\"1\">\n<li>Let\u2019s add the <code>property_type<\/code> field as our series<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<figure><a href=\"https:\/\/i0.wp.com\/webassets.mongodb.com\/_com_assets\/cms\/series-value-b1gprdumq6.gif?ssl=1\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>\n<img data-recalc-dims=\"1\" decoding=\"async\" style=\"display: block; margin-left: auto; margin-right: auto; width: 500px;\" src=\"https:\/\/i0.wp.com\/webassets.mongodb.com\/_com_assets\/cms\/series-value-b1gprdumq6.gif?w=840&#038;ssl=1\" alt=\"Assign a Series value to a Stacked Bar chart in MongoDB Charts\" \/><br \/>\n<\/a><figcaption>Assign a Series value to a Stacked Bar chart<\/figcaption><\/figure>\n<p>Now we can name our chart, <i>Properties by Location<\/i> and save it. We\u2019re then taken back to our dashboard where we can add other visualizations for further exploration.<\/p>\n<p>Have a look at this short video to see some other visualizations being created from this same data source.<\/p>\n<div class=\"jetpack-video-wrapper\"><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/c7gIXDYDrNU?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span><\/div>\n<h2>Conclusion<\/h2>\n<p>MongoDB Charts is an excellent new tool to visually explore your data. It has some great features for specific use cases, such as:<\/p>\n<ul>\n<li>Ad hoc analysis of your data<\/li>\n<li>Natively understands the benefits of the Document Data Model<\/li>\n<li>Collaboration on projects is easy with user-based sharing and permissions<\/li>\n<li>It\u2019s intuitive enough for non-developers to use allowing for self-service data analysis<\/li>\n<\/ul>\n<p>MongoDB Charts is the fastest way to build visualizations over your MongoDB data. I\u2019d encourage you to <a href=\"https:\/\/www.mongodb.com\/download-center\/charts\" target=\"_blank\" rel=\"noopener noreferrer\">download it<\/a> and try it out today. Let me know what visualizations you come up with from the Airbnb dataset. I always enjoy seeing how people explore their data.<\/p>\n<hr \/>\n<p><em>This post was first published on the <a href=\"https:\/\/www.mongodb.com\/blog\/post\/visualizing-your-data-with-mongodb-charts\">MongoDB blog<\/a><\/em>.<\/p>\n<a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox\" data-provider=\"facebook\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Facebook\" href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F894&#038;t=Visualizing%20Your%20Data%20With%20MongoDB%20Charts&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F894&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fwebassets.mongodb.com%2F_com_assets%2Fcms%2Fatlas-URI-6k09mb3bg3.gif&#038;p&#091;title&#093;=Visualizing%20Your%20Data%20With%20MongoDB%20Charts\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" alt=\"Facebook\" title=\"Share on Facebook\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/i0.wp.com\/www.kenwalger.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/96x96\/facebook.png?resize=48%2C48&#038;ssl=1\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox\" data-provider=\"twitter\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Twitter\" href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F894&#038;text=Hey%20check%20this%20out\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" alt=\"twitter\" title=\"Share on Twitter\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/i0.wp.com\/www.kenwalger.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/96x96\/twitter.png?resize=48%2C48&#038;ssl=1\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-reddit nolightbox\" data-provider=\"reddit\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Reddit\" href=\"https:\/\/www.reddit.com\/submit?url=https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F894&#038;title=Visualizing%20Your%20Data%20With%20MongoDB%20Charts\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" alt=\"reddit\" title=\"Share on Reddit\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/i0.wp.com\/www.kenwalger.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/96x96\/reddit.png?resize=48%2C48&#038;ssl=1\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox\" data-provider=\"linkedin\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Linkedin\" href=\"https:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F894&#038;title=Visualizing%20Your%20Data%20With%20MongoDB%20Charts\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" alt=\"linkedin\" title=\"Share on Linkedin\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/i0.wp.com\/www.kenwalger.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/96x96\/linkedin.png?resize=48%2C48&#038;ssl=1\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-mail nolightbox\" data-provider=\"mail\" rel=\"nofollow\" title=\"Share by email\" href=\"mailto:?subject=Visualizing%20Your%20Data%20With%20MongoDB%20Charts&#038;body=Hey%20check%20this%20out:%20https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F894\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" alt=\"mail\" title=\"Share by email\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/i0.wp.com\/www.kenwalger.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/96x96\/mail.png?resize=48%2C48&#038;ssl=1\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>Having data stored in a database is practically a given for today\u2019s businesses. Customer information, order history, product pricing, IoT sensor data, and much more is being recorded for future use. However, just having the data stored isn\u2019t enough to form a competitive market advantage. We must be able to analyze the data as well. &hellip; <a href=\"https:\/\/www.kenwalger.com\/blog\/nosql\/mongodb\/visualizing-data-mongodb-charts\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Visualizing Your Data With MongoDB Charts&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pmpro_default_level":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[17,4,3],"tags":[1403,1401,1400,1402],"yst_prominent_words":[1395,1392,1396,300,1361,1397,372,364,87,1113,1369,1391,489,1358,1394,1389,1398,1393,1390,1399],"class_list":["post-894","post","type-post","status-publish","format-standard","hentry","category-data-visualization","category-mongodb","category-nosql","tag-airbnb","tag-data-visualization","tag-mongodb-charts","tag-tutorial","pmpro-has-access"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8lx70-eq","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/posts\/894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/comments?post=894"}],"version-history":[{"count":4,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/posts\/894\/revisions"}],"predecessor-version":[{"id":898,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/posts\/894\/revisions\/898"}],"wp:attachment":[{"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/media?parent=894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/categories?post=894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/tags?post=894"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/yst_prominent_words?post=894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}