Bar chart

edit

You’ll use a bar chart to look at the Shakespeare data set and compare the number of speaking parts in the plays.

Create a Vertical Bar chart and set the search source to shakes*.

Initially, the chart is a single bar that shows the total count of documents that match the default wildcard query.

tutorial visualize bar 1

Show the number of speaking parts per play along the Y-axis. This requires you to configure the Y-axis metric aggregation. This aggregation computes metrics based on values from the search results.

  1. In the Metrics pane, expand Y-Axis.
  2. Set Aggregation to Unique Count.
  3. Set Field to speaker.
  4. In the Custom Label box, enter Speaking Parts.
  5. Click Apply changes apply changes button.
tutorial visualize bar 1.5

Show the plays along the X-axis.

  1. In the Buckets pane, click X-Axis.
  2. Set Aggregation to Terms and Field to play_name.
  3. To list plays alphabetically, in the Order dropdown menu, select Ascending.
  4. Give the axis a custom label, Play Name.
  5. Click Apply changes apply changes button.

Hovering over a bar shows a tooltip with the number of speaking parts for that play.

Notice how the individual play names show up as whole phrases, instead of broken into individual words. This is the result of the mapping you did at the beginning of the tutorial, when you marked the play_name field as not analyzed.

Save this chart with the name Bar Example.