This topic describes how to configure a column chart to display query results.

Background information

A column chart uses vertical or horizontal bars to present categorical values. It also provides a method to 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. This way, you can perform fine-grained analysis on the value differences in a category.

Each column chart consists of the following elements:
  • X-axis (horizontal)
  • Y-axis (vertical)
  • Rectangular bar
  • Legend

By default, column charts in Log Service use vertical bars. Each rectangular bar has a fixed width and a variable height that indicate a value. You can use a grouped column chart to display the data if multiple columns of data are selected for the Y-axis.

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 then click the Logstore that you want to manage.
  4. Enter a query statement in the search box, specify a time range, and then click Search & Analyze.
  5. On the Graph tab, click the Column chart - 001 icon.
  6. On the Properties tab, configure the properties of the column chart.
    Note Column charts can be used to display query results if the number of returned log entries is less than 20. You can use a LIMIT clause to control the number of rectangular bars. Analysis results may not be clearly displayed if the chart contains a large number of rectangular bars. In addition, we recommend that you select less than five fields for the Y-axis.
    Parameter Description
    X Axis The categorical data.
    Y Axis The numeric data. You can select 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 selected for the Y-axis is displayed.
    Y-axis Minimum Value The custom minimum value of the Y-axis.
    Y-axis Maximum Value The custom maximum value of the Y-axis.
    Legend Width The width of the legend.
    X-axis Scale Density The scale density of the X-axis. Valid values: 3 to 30.
    Stacking If you turn on the Stacking switch, the Y-axis data is stacked.
    Show Values If you turn on the Show Values switch, the value of each column is displayed.
    Margin The distance between the axis and the borders of the chart. This includes the Top Margin, Bottom Margin, Left Margin, and Right Margin.

Example of a simple column chart

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

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

Select http_referer for the X-axis and count for the Y-axis.

Simple column 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, execute the following query statement:

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

Select http_referer for the X-axis. Select count and avg for the Y-axis.

Grouped column chart