This topic describes how to view query results in a column chart.

Background information

A column chart uses vertical or horizontal bars to present the values of categorical variables. A column chart also counts the number of values in each categorical variable. You can also use multiple rectangular bars to display values of the same categorical variable. Grouped or stacked rectangular bars can also be used. This way, you can perform fine-grained analysis on the value differences of the categorical variable based on dimensions.

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

By default, column charts in Log Service use vertical bars. Each rectangular bar has a fixed width and a variable height, which indicates a value. If multiple fields are selected for the Y-axis, a grouped column chart can be used to display the data.

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 Column chart - 001 icon.
  6. On the Properties tab, configure the properties of the column chart.
    Note If no more than 20 log entries are returned by a query statement, you can use a column chart to display the query results. You can use a LIMIT clause to limit the number of rectangular bars. If the chart contains a large number of rectangular bars, analysis results may not be clearly displayed. We recommend that you select no more than five fields for the Y-axis.
    Parameter Description
    X Axis The the categorical variable.
    Y Axis The value of the categorical variable. You can select one or more fields for the Y-axis.
    Legend The position of the legend in the chart. Valid values: Top, Bottom, Left, and Right.
    Format Y-axis The format in which data on the Y-axis is displayed.
    Y-axis Minimum Value The minimum value allowed for the Y-axis.
    Y-axis Maximum Value The maximum value allowed for 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 Stacking, the Y-axis data is stacked.
    Show Values If you turn on Show Values, the value of each rectangular bar is displayed.
    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 simple column chart

To query the number of visits for each http_referer field in a 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 field in a 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