MongoDB工具 >MongoDB图表 >图表类型 >Grid Charts > Scatter Chart
On this page
Scatter charts plot data with individual data points placed along the X and Y axes. Optionally, the data point representations may use shapes and colors to display additional data dimensions.
Scatter charts provide the following encoding channels:
Encoding Channel | Description |
---|---|
X / Y Axis | The X and Y axis encoding channels accept numerical and date fields and display the range of values from the field along the corresponding axis. |
Size | (Optional) An aggregation encoding channel that changes the size of the data point markers, with larger sizes indicating larger aggregated values. |
Color | (Optional) A category encoding channel that changes the color of the data point markers based on the value of the selected field. MongoDB Charts lists the colors used in a key to the right of the chart. |
Shape | (Optional) A category encoding channel that changes the shape of the data point markers based on the value of the selected field. MongoDB Charts lists the shapes used in a key to the right of the chart. |
Tooltip Detail | (Optional) A category encoding channel that adds the value of the selected field to each data point’s tooltip. To view a data point tooltip, hover over that point in the chart. In addition to the Tooltip Detail field, the tooltip also shows other fields used to construct the chart. |
Scatter charts are useful for representing numerical data and showing clearly how data points cluster together in certain areas. The Size, Color, and Shape encoding channels allow you to reveal additional trends for data dimensions with low cardinality.
Tip
A chart with many different colors or shapes may result in a cluttered visualization which is difficult to read. You can limit the number of categories in your chart by binning or limiting your data.
Scatter charts show an individual marker for each data point, so they work better with smaller result sets. Outliers and extreme data points are easy to identify.
Consider using a scatter chart to display:
The maximum query response size for a scatter chart is 50000 documents.
The following scatter chart uses a database of information about AirBnB rental properties in Sydney, Australia. The X axis shows the review ratings given to individual properties, with the price per night displayed along the Y axis. The query filter restricts the result set to properties with at least 100 reviews.
The chart shows that lower-priced properties have a wider range of review scores, while higher-priced properties have a smaller score range with generally higher scores.
The following more complex scatter chart uses a database with movie data compiled from IMDb and Rotten Tomatoes. The chart shows the TomatoMeter rating (ranging from 0 to 100) of movies with at least one award nomination. Each data point marker represents one movie. The X axis shows the movie’s TomatoMeter rating and the Y axis shows the number of award nominations the movie received.
The query filter restricts the result set to exclude marginal data points.
The chart uses the Color and Shape encoding channels to shed further light on the types of movies which receive the most award nominations. The color of each data point shows the MPAA (Motion Picture Association of America) rating the movie received. The chart uses the Shape encoding channel to indicate the year in which the movie was released, and bins the data to place each movie into a time range, with each bin covering 25 years. Without the bins, there would be a different shape for every year, which would make the chart too noisy to read.