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

Background information

A column chart uses vertical or horizontal bars to present categorical values and count the number of values in each category. You can also use multiple rectangular bars to display values of the same category. Each rectangular bar represents a group or stack in the category. In this way, you can analyze the differences of values in a category in a more fine-grained way.

The basic elements of a column chart are as follows:
  • X-axis (horizontal)
  • Y-axis (vertical)
  • Rectangular bar
  • Legend

Column charts in Log Service use vertical horizontal bars by default. Each rectangular bar has a fixed width and a varying height that indicates a value. You can use a grouped column chart to display the data if multiple columns of data are configured for the Y-axis.

Procedure

  1. Log on to the Log Service console.
  2. Click the target project in the Projects section.
  3. Choose Log Management > Logstores, click the management icon of the target Logstore, and then select Management icon > Search & Analysis.
  4. Enter a query statement in the search box, select a time range, and then click Search & Analyze.
  5. Click Bar chart - 001 to display the query results in a column chart.
  6. On the Properties tab on the right, configure the properties of the column chart.
    Note Column charts are suitable to display query results if the number of returned log entries is no greater than 20. You can use a LIMIT clause to control the number of categorical rectangular bars. Analysis results may not be clearly displayed if the chart contains excessive rectangular bars. In addition, we recommend that you configure no more than five fields for the Y-axis.
    Configuration item Description
    X Axis The categorical data.
    Y Axis The numeric data. You can configure one or more fields for the Y-axis.
    Legend The position where the legend is located in the chart. Valid values: Top, Bottom, Left, and Right.
    Format The format in which data configured for the Y-axis is displayed.
    Margin The distance of the axis to the borders of the chart, including Top Margin, Bottom Margin, Right Margin, and Left Margin.
    Stacking If you turn on this switch, the Y-axis data is stacked.

Example of a simple column chart

To query the number of visits for each http_referer in the specified time range, run the following statement:

* | select  http_referer, count(1) as count group by http_referer

Select http_referer for X Axis and count for Y Axis.

Simple bar chart

Example of a grouped column chart

To query the number of visits and the average bytes for each http_referer in the specified time range, run the following statement:

* | select  http_referer, count(1) as count, avg(body_bytes_sent) as avg group by http_referer

Select http_referer for X Axis. Select count and avg for Y Axis.

Grouped column chart