Skip to content

Commit ed46914

Browse files
(DOCSP-11995): Sort multi-series chart by specifed series (#409)
* (DOCSP-11995): Sort multi-series chart by specifed series * Updates per review
1 parent df6fbfb commit ed46914

File tree

4 files changed

+46
-12
lines changed

4 files changed

+46
-12
lines changed

source/bin-data.txt

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,50 @@ chart type:
268268
Sort Data
269269
---------
270270

271-
By default, |charts-short| sorts data based on the :guilabel:`Value`
272-
field in descending order.
271+
Use the :guilabel:`Sort By` dropdown in the Chart Builder to sort
272+
chart data by either:
273273

274-
Use the :guilabel:`Sort By` dropdown in the Chart Builder to sort by
275-
either the :guilabel:`Category` field or aggregated value.
274+
- Category
275+
- Value
276+
- Series field (for :ref:`multi-series charts <multi-series-charts>`)
277+
278+
If you sort a multi-series chart generically by :guilabel:`Value`
279+
without sorting by a specific series, |charts| sorts your data based on
280+
the sum of all values in your series.
276281

277282
To toggle between ascending or descending sort order, click the ``a-z``
278283
button to the right of the :guilabel:`Sort By` dropdown.
279284

285+
By default, |charts-short| sorts data based on :guilabel:`Value`
286+
in descending order.
287+
288+
Sort Multi-Series Charts by Series Value
289+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290+
291+
If you create a :ref:`multi-series chart <multi-series-charts>` using a
292+
different field per series, you can sort the chart by a specific series
293+
field.
294+
295+
.. example::
296+
297+
The following charts use the :ref:`Sample Data: Movies <sample-data>`
298+
data source to compare the mean number of ``fresh`` and ``rotten``
299+
Rotten Tomato ratings for movies in each genre.
300+
301+
This chart is sorted by the mean ``fresh`` value in descending
302+
order:
303+
304+
.. figure:: /images/charts/sort-by-series-fresh-desc.png
305+
:figwidth: 550px
306+
:alt: Chart sorted by fresh rating in descending order
307+
308+
This chart is sorted by the mean ``rotten`` value in ascending
309+
order:
310+
311+
.. figure:: /images/charts/sort-by-series-rotten-asc.png
312+
:figwidth: 550px
313+
:alt: Chart sorted by rotten rating in ascending order
314+
280315
.. _charts-limit-data:
281316

282317
Limit Data
271 KB
Loading
262 KB
Loading

source/multi-series-charts.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ chart data into groups, or *series*, to compare additional
1717
fields within your schema. There are two ways to create multi-series
1818
charts:
1919

20-
- :ref:`Using multiple aggregation or value field mappings
20+
- :ref:`Map Multiple Fields to a Single Axis
2121
<multiple-field-mappings>`. Use this method to compare or aggregate
2222
upon multiple non-categorical fields in the schema.
2323

@@ -27,15 +27,14 @@ charts:
2727

2828
.. _multiple-field-mappings:
2929

30-
Multiple Field Mappings to a Single Axis
31-
----------------------------------------
30+
Map Multiple Fields to a Single Axis
31+
------------------------------------
3232

3333
|charts| allows you to map multiple :ref:`Aggregation
34-
<building-charts-aggregation>` or :guilabel:`Value`
35-
:ref:`encoding channels <encoding-channels>` to a single chart property
36-
(such as the :guilabel:`X Axis` or :guilabel:`Y Axis`). This allows you
37-
to compare additional fields in your visualization by creating new
38-
series based on the encoding channels added.
34+
<building-charts-aggregation>` or :guilabel:`Value` fields to a single
35+
chart property (such as the :guilabel:`X Axis` or :guilabel:`Y Axis`).
36+
This allows you to compare additional fields by creating new series
37+
based on the encoding channels added.
3938

4039
After dragging a field to an :guilabel:`aggregation`
4140
or :guilabel:`value` :ref:`encoding channel <encoding-channels>`, an

0 commit comments

Comments
 (0)