This topic describes how to configure a pie chart to display query results. It also includes examples.

Background information

A pie chart is used to analyze the percentages of the number of occurrences of different field values based on the arc length. A pie chart is divided into multiple sectors based on the percentages of various field values. The entire chart indicates all field values. Each arc-shaped sector indicates the percentage of the occurrences of a field value to the total occurrences. The sum of percentages in all sectors is equal to 100%.

The basic elements of a pie chart are as follows:
  • Sector
  • Percentage in the text format
  • Legend

Types

Log Service provides three types of pie charts: the default pie chart, the donut chart, and the polar area chart.
  • Donut chart
    A donut chart is a pie chart with a hollow center. It has the following features:
    • A donut chart displays the total number of occurrences in addition to the information that a basic pie chart can display.
    • You can obtain the differences between the number of occurrences of the same value based on the ring length. This is more intuitive than when you compare two pie charts.
  • Polar area chart
    A polar area chart is not a donut chart, but a column chart in the polar coordinate system. Each category of field values is represented by a sector with the same radian. The radius of a sector indicates the number of occurrences of a field value. Compared with a pie chart, a polar area chart has the following features:
    • Pie charts are suitable to display query results if the number of returned log entries is no greater than 10. Polar area charts are suitable to display query results if the number of returned log entries ranges from 10 to 30.
    • The area of a sector is proportional to its radius squared. Therefore, the polar area chart can highlight the differences between the number of occurrences of various values. It is especially suitable for comparing the number of occurrences of similar values.
    • A circle can be used to display a periodic pattern. Therefore, you can use a polar area chart to analyze value change characteristics in periodic periods, such as weeks and months.

Procedure

  1. On the Search & Analysis page of a Logstore, enter a search and analytics statement in the search box, specify the time range, and then click Search & Analyze.
    The Chart tab is automatically displayed when a query is completed.
  2. Click Pie chart - 001 to display the query results in a pie chart.
  3. On the Properties tab on the right, configure the properties of the pie chart.
    Note
    • Pie charts and donut charts can be used to display query results if the number of returned log entries is no greater than 10. You can use a LIMIT clause to control the number of sectors. Analysis results may not be clearly displayed if the chart contains excessive sectors of different colors.
    • Use the polar area chart or column chart if the number of log entries exceeds 10.
    Configuration item Description
    Chart Types The type of the chart. Valid values: Pie Chart, Donut Chart, and Polar Area Chart. Default value: Pie Chart.
    Legend Filter The categorical data.
    Value Column The values corresponding to different categories of data.
    Legend The position where the legend is located in the chart. Valid values: Top, Bottom, Left, and Right. You can configure this item only after you turn on the Show Legend switch.
    Format The format in which data is displayed.
    Tick Text Format Valid values: Percentage and Category: Percentage.
    Margin The distance of the axis to the borders of the chart, including Top Margin, Bottom Margin, Right Margin, and Left Margin.

Example of a pie chart

To analyze the percentage of the access requestURI, run the following statement:

* | select requestURI as uri , count(1) as c group by uri limit 10
ao Pie Chart

Example of a donut chart

To analyze the percentage of the access requestURI, run the following statement:

* | select requestURI as uri , count(1) as c group by uri limit 10
Doughnut chart

Example of a polar area chart

To analyze the percentage of the access requestURI, run the following statement:

* | select requestURI as uri , count(1) as c group by uri limit 10
Polar area chart: