Create an overlay chart and explore visualization options (2024)

In this example, you create a chart that overlays two data series as lines over three data series as columns. The overlay chart will show Actions such as Adds To Cart and Purchases on one type of chart and the Conversion Rates, such as Views To Purchases, in another type of chart.

You will use the stats command to count the user actions. The eval command is used to calculate the conversion rates for those actions. For example, how often someone who viewed a product also added the product to their cart.

This example uses the productName field from the Enabling field lookups section of this tutorial.
If you do not configure the field lookups, the searches in this section will not produce the correct results.

Let's start by a running a search and viewing the results as a chart.

  1. Start a new search.
  2. Change the time range to All time.
  3. Run the following search.

    sourcetype=access_* status=200 | stats count AS views count(eval(action="addtocart")) AS addtocart count(eval(action="purchase")) AS purchases by productName | eval viewsToPurchases=(purchases/views)*100 | eval cartToPurchases=(purchases/addtocart)*100 | table productName views addtocart purchases viewsToPurchases cartToPurchases | rename productName AS "Product Name", views AS "Views", addtocart as "Adds To Cart", purchases AS "Purchases"

    The eval command is used to define two new fields. These fields contain the conversion rates.

    • The viewToPurchases field calculates the number of customers who viewed the product to the number of customers who purchased the product. The calculation returns a percentage.
    • The cartToPurchases field calculates the number of customers who added the product to their cart to the number of customers who purchased the product. The calculation returns a percentage.

  4. Click the Visualization tab.
    This is the same chart in the section Create a basic chart, with two additional data series, viewsToPurchases and cartToPurchases.

The next few steps reformat the chart visualization to overlay the two data series for the conversion rates, onto the three data series for the actions.

Format the X-Axis labels

Notice that the labels on the X-Axis are truncated. Because there are so many products, the labels are truncated making them difficult to read. Let's fix that.

  1. Click Format and X-Axis.
  2. For Label Rotation select the second option, which is -45 degrees.


  3. Close the Format dialog box.
    Notice the change in the labels on the X-Axis.

Format the Y-Axis values and add a title

Look at the numbers on the Y-Axis. The numbers range from 1000 to 3000 and there is no title to identify what that axis tracks.Let's make the chart easier to read,

  1. Click Format and Y-Axis.
    We're going to add a title and specify different number intervals on the Y-Axis.
  2. For Title, choose Custom and type Actions.
  3. For Interval type 500.
  4. For Max Value type 2500.

  5. Close the Format dialog box. Notice the changes to the label and values on the Y-Axis.

Format the second Y-Axis

Look at the legend. It shows that some of the columns represent actions such as Views and Purchases, and some columns represent conversion rates such as viewsToPurchases. The actions are counts of the values in specific fields. The conversion rates are percentages. These two types of information should be shown separately.

  1. To fix this issue, click Format and Chart Overlay.
    To separate the actions from the conversion rates, you can overly one set of values over another set of values. In this example you will overlay the conversion rates, as lines, over the actions, which will remain as columns.
  2. For Overlay, click inside the box. Begin and select viewsToPurchase. Click inside the box again and select cartToPurchase. This identifies the two series that you want to overlay on to the column chart.
  3. For View as Axis, click On.
  4. For Title, choose Custom

  5. Type Conversion Rates.
  6. For Scale, click Linear.
  7. For the Interval type 20. For the Max Value type 100.
  8. Close the Format dialog box. Notice that the conversion rates now appear as lines in the chart.


The axis on the right side of the chart is called a second Y-Axis. The label and values for the line series appear on this axis.

Save the revised chart as a report

You've made great changes to the chart to make it more readable. Now it's time to save the chart as a report.

  1. Click Save As and select Report.

  2. In the Save Report As dialog box, for Title type Comparison of Actions and Conversion Rates by Product.
  3. For Description, type The number of times a product is viewed, added to cart, and purchased and the rates of purchases from these actions.
  4. Click Save
  5. In the confirmation dialog box, click View.

Next step

Create a report from a custom chart

See also

stats command in the Search Reference
eval command in the Search Reference
Chart overview in Dashboards and Visualizations

Create an overlay chart and explore visualization options (2024)
Top Articles
Latest Posts
Article information

Author: Neely Ledner

Last Updated:

Views: 6108

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.