Skip to content

Commit 52ced5a

Browse files
authored
(DOCSP-39067) Adds pre-filters to embedded charts and dashboards and fixes the TOC (#665)
* (DOCSP-39067) Adds pre-filters to embedded charts and dashboards
1 parent b963398 commit 52ced5a

16 files changed

+289
-52
lines changed

snooty.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@ intersphinx = ["https://www.mongodb.com/docs/manual/objects.inv",
66

77
toc_landing_pages = ["/installation", "/dashboards",
88
"/data-sources",
9-
"/administration", "/build-charts", "/launch-charts",
9+
"/administration", "/build-charts", "/launch-charts",
10+
"/tutorials",
11+
"/reshape-data",
12+
"/build-charts-reference",
1013
"/tutorial/order-data/order-data-tutorial-overview",
1114
"/tutorial/movie-details/movie-details-tutorial-overview",
1215
"/chart-types", "/chart-type-reference/data-table",
1316
"/chart-type-reference/geo-spatial",
1417
"/chart-type-reference/column-bar-chart",
1518
"/chart-type-reference/choropleth",
16-
"/customize-charts",
19+
"/chart-type-reference/circular-charts",
20+
"/chart-type-reference/grid-charts",
21+
"/chart-type-reference/text-charts",
22+
"/customize-charts",
1723
"/customize-charts/conditional-formatting",
1824
"/dashboards/view-dashboard-data",
1925
"/embed-charts-and-dashboards",

source/aggregation-pipeline-generation.txt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,42 @@ Backing Aggregation Pipeline
66

77
.. default-domain:: mongodb
88

9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
915
To get the data needed to render a chart, |charts-short| creates a
10-
MongoDB Aggregation Pipeline which is executed on the MongoDB database
16+
MongoDB Aggregation Pipeline and runs the pipeline on the MongoDB database
1117
server. The pipeline consists of multiple stages, each of which is
1218
generated based on different settings specified by the chart's author.
19+
1320
This document explains how the various Chart Builder settings are used
1421
to construct the Aggregation Pipeline. You can view the pipeline used to
1522
create a chart by choosing the :guilabel:`View Aggregation Pipeline`
1623
option in the Chart Builder's ellipsis dropdown on the top right.
1724

18-
19-
The pipeline constructed by |charts| consists of the following segments in the following order:
25+
|charts| construct a pipeline that consists of the following segments in
26+
the following order:
2027

2128
1. :ref:`Charts views <data-sources-pipeline>`
29+
#. :ref:`Pre-filters in embedding charts <embed-options-pre-filter>`
2230
#. :ref:`Dashboard filters <filter-dashboards>`
2331
#. :ref:`Chart query <query-bar>`
2432
#. :ref:`Lookup fields <add-lookup-field>`
2533
#. :ref:`Calculated fields <calculated-fields>`
26-
#. :ref:`Embedding filters <embedded-chart-options>`
34+
#. :ref:`Embedding filters, including injected filters <embedded-chart-options>`
2735
#. :ref:`Chart filters <charts-filter-documents>`
2836
#. :ref:`Encoded fields <encoding-channels>`
2937
#. :ref:`Sorting <charts-sort-data>`
30-
#. Maximum document limit
38+
#. :ref:`Maximum document limit <max-documents-limit>`
3139

3240
.. note::
33-
You do not need to configure all of the above settings when creating
34-
a chart. Unspecified settings are skipped when generating the
35-
aggregation pipeline.
41+
42+
When creating a chart, you can configure some but not all of the previous
43+
chart segments. When |charts-short| generates the aggregation pipeline,
44+
it skips unspecified segments.
3645

3746
Example
3847
-------

source/chart-type-reference/circular-charts.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Circular Charts
66

77
.. default-domain:: mongodb
88

9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
915
:doc:`/chart-type-reference/donut-chart/`
1016
.. include:: /includes/donut-blurb.rst
1117

source/chart-type-reference/data-table.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ Table
1313
:class: singlecol
1414

1515
Tables represent data in a tabular view, similar to a
16-
`spreadsheet <https://en.wikipedia.org/wiki/Spreadsheet>`_. Tables
17-
split your data into categories, with each categorization field
18-
represented in the table columns. The unique categories are represented
19-
as the table rows, and |charts-short| displays aggregated values in the
20-
table body based on the fields selected.
16+
`spreadsheet <https://en.wikipedia.org/wiki/Spreadsheet>`_. In |charts-short|,
17+
tables split your data into categories, where:
18+
19+
- Table columns represent categorization fields.
20+
- Table rows represent unique categories.
21+
- Table body displays aggregated values based on the selected categorization fields.
2122

2223
Table Encoding Channels
2324
-----------------------
@@ -85,7 +86,7 @@ Tables are also useful for showing precise data values, rather
8586
than comparing approximate values. Comparing approximate values is
8687
best done with a visual representation, instead of text.
8788

88-
You can use tables to show:
89+
For example, you can use tables to show:
8990

9091
- The total cost to rent an apartment, including rent, cleaning fees,
9192
and security deposits organized by location and total area of the

source/chart-type-reference/grid-charts.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ Grid Charts
66

77
.. default-domain:: mongodb
88

9+
:ref:`heatmap-chart-ref`
10+
Learn how |charts| represents data in a tabular format as a range of color
11+
on a heatmap.
12+
13+
:ref:`scatter-chart-ref`
14+
Learn how |charts| creates scatter charts to plot data with individual
15+
data points placed along the X and Y axes.
16+
917
.. toctree::
1018
:titlesonly:
1119

source/chart-type-reference/text-charts.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ Text Charts
88

99
.. default-domain:: mongodb
1010

11+
:ref:`data-table-ref`
12+
Use tables to represent data in a tabular view, similar to a spreadsheet.
13+
14+
:ref:`number-chart-ref`
15+
Use number charts to display a single aggregated value from a data field.
16+
17+
:ref:`word-cloud-ref`
18+
Use word clouds to visually represent text data, highlighting prevalent
19+
keywords and phrases.
20+
21+
:ref:`top-item-ref`
22+
Use Top Item charts to show information from the document with the
23+
greatest or smallest value for a specified field.
24+
1125
.. toctree::
1226
:titlesonly:
1327

source/chart-types.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ other forms of data to create map-based charts.
146146
:figwidth: 525px
147147
:alt: Geospatial heatmap example
148148

149+
.. _max-documents-limit:
150+
149151
Maximum Document Limit
150152
----------------------
151153

source/charts-embedding-sdk.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ adjustments to chart settings and rendering.
1818

1919
You can use the embedding SDK to do the following tasks:
2020

21+
- Add pre-filters before building charts
2122
- Add filters dynamically
2223
- Change the size, style, and axes of the chart
2324
- Change the legend position and legend angle
@@ -34,7 +35,7 @@ To embed a chart with the SDK, you need to:
3435
#. Allow :ref:`embedded chart filtering <embed-options-filter>` on
3536
certain fields by :ref:`specifying filterable fields
3637
<specify-filter-fields>`. Don't include fields that may reveal
37-
sensitive data.
38+
sensitive data.
3839
#. Have the chart ID and base URL strings.
3940

4041
To learn more, see :ref:`get-started-embedding-sdk`.

source/embedded-charts-options/embedded-sdk.txt

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ The ``createChart()`` method takes the following options:
110110
- Unique identifier of the chart.
111111
- yes
112112

113+
* - ``preFilter``
114+
- object
115+
- :ref:`Pre-Filter <embed-options-pre-filter>` to apply to the chart. Pre-filters run before the chart's query execution starts.
116+
- no
117+
113118
* - ``filter``
114119
- object
115120
- :ref:`Filter <embed-options-filter>` to apply to the chart.
@@ -221,6 +226,19 @@ omitted, charts don't automatically refresh.
221226
Use this method with the ``setMaxDataAge`` method to
222227
configure how often the chart refreshes.
223228

229+
``setPreFilter(object)``
230+
~~~~~~~~~~~~~~~~~~~~~~~~~
231+
232+
Applies a :ref:`query pre-filter <pre-filter-embedded-charts>` to the
233+
embedded chart or chart within an :ref:`embedded dashboard <embedding-dashboards>`.
234+
This method takes an object with valid query operators. Add fields
235+
referenced in this pre-filter to the :guilabel:`Allowed filter fields` list
236+
in the ``Embed Chart`` modal window. An empty document ``{}`` means you
237+
omit the pre-filter.
238+
239+
To learn more about enabling embedding for a chart and applying pre-filters,
240+
see the :ref:`Embedding Tutorials <embedding-tutorials>`.
241+
224242
``setFilter(object)``
225243
~~~~~~~~~~~~~~~~~~~~~
226244

@@ -233,9 +251,8 @@ added to the :guilabel:`Allowed filter fields`
233251
list in the ``Embed Chart`` modal window.
234252
An empty document ``{}`` is equivalent to no filter.
235253

236-
See the :ref:`Embedding Tutorials <embedding-tutorials>` for
237-
more information about enabling embedding for a chart
238-
and allowing fields for filter use.
254+
To learn more about enabling embedding for a chart and applying filters,
255+
see the :ref:`Embedding Tutorials <embedding-tutorials>`.
239256

240257
``setMaxDataAge(number)``
241258
~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)