This topic describes how to view query results in a pie chart. The topic also introduces pie chart examples.

Background information

A pie chart is used to show the percentages of categorical variables. In a pie chart, the arc length of each segment is proportional to the quantity each categorical variable represents. A pie chart is divided into multiple segments based on the percentages of categorical variables. Each segment shows the percentage of a categorical variable. The sum of all percentages is equal to 100%.

A pie chart consists of the following elements:
  • Segment
  • Percentage in the text format
  • Legend

Types

Log Service provides three types of standard pie charts: pie chart, donut chart, and polar area chart.
  • Donut chart
    A donut chart is a variant of the pie chart with a hollow center. A donut chart provides the following benefits over a pie chart:
    • Displays more information, such as the total value.
    • Allows you to compare data between two donut charts based on the ring lengths. Data across different pie charts is difficult to compare.
  • Polar area chart
    A polar area chart is a column chart in the polar coordinate system. Each categorical variable is represented by a segment with the same angle, and the radius of each segment differs depending on the value. A polar area chart provides the following benefits over a pie chart:
    • Is suitable when the number of data entries ranges from 10 to 30. The pie chart is suitable when the number of data entries is no more than 10.
    • Enlarges the differences among the values of categorical variables because the area of the segment has a correlation to the square of the radius. Therefore, the polar area chart is suitable for the comparison of similar values.
    • Is suitable for analyzing value change characteristics in different periods, such as weeks and months. This is because a circle can be used to display a periodic pattern.

Procedure

  1. Log on to the Log Service console.
  2. In the Projects section, click the name of the project that you want to manage.
  3. Choose Log Storage > Logstores and click the Logstore that you want to manage.
  4. Enter a query statement in the search box, select a time range, and then click Search & Analyze.
  5. On the Graph tab, click the Pie chart - 001 icon.
  6. On the Properties tab, configure the properties of the pie chart.
    Note
    • If no more than 10 log entries are returned by a query statement, you can use a pie chart or donut chart to display the query results. We recommend that you use a LIMIT clause to limit the number of segments. If a chart contains a large number of segments with different colors, the analysis results may not be clearly displayed.
    • If the number of data entries is greater than 10, we recommend that you use a polar area chart or a column chart.
    Parameter Description
    Chart Types The type of the chart. Valid values: Pie Chart, Donut Chart, and Polar Area Chart.
    Legend Filter The categorical variable.
    Value Column The value that is assigned to the categorical variable.
    Legend If you turn on Show Legend, you can configure this parameter to adjust the position of the legend in the chart.
    Format The format in which data is displayed.
    Tick Text Format Valid values: Percentage, Category: Percentage, and Category:Numeric Value (Percentage).
    Legend Width The width of the legend.
    Margin The distance between the axis and the borders of the chart. The parameters include Top Margin, Bottom Margin, Left Margin, and Right Margin.

Example of a pie chart

To analyze the percentages of different values for the request_uri field, execute the following query statement:

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

Example of a donut chart

To analyze the percentages of different values for the request_uri field, execute the following query statement:

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

Example of a polar area chart

To analyze the percentages of different values for the request_uri field, execute the following query statement:

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