This topic describes how to configure a horizontal bar chart to display query results. It also includes examples.
A bar chart is a horizontal column chart. It is used to analyze the top N values of fields. It is configured in a way similar to a column chart.
- X-axis (vertical)
- Y-axis (horizontal)
- Rectangular bar
Each rectangular bar has a fixed height and a varying width that indicates a value. You can use a grouped bar chart to display the data if multiple columns of data are configured for the Y-axis.
- Log on to the Log Service console.
- Click the target project in the Projects section.
- Choose , click the management icon of the target Logstore, and then select .
- Enter a query statement in the search box, select a time range, and then click Search & Analyze.
- Click to display the query results in a bar chart.
- On the Properties tab on the right, configure the properties of the bar chart.Note
- Bar charts are suitable to display query results if the number of returned log entries
is no greater than 20. You can use a
LIMITclause to control the number of categorical rectangular bars. Analysis results may not be clearly displayed if the chart contains excessive rectangular bars. You can use an
ORDER BYclause to analyze the top N values of fields. In addition, we recommend that you configure no more than five fields for the Y-axis.
- You can use a grouped bar chart to display query results. However, the values represented by each rectangular bar in a group must positively or negatively associated with each other.
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 X-axis The format in which data configured for the X-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.
- Bar charts are suitable to display query results if the number of returned log entries is no greater than 20. You can use a
To analyze the
request_uri with the top 10 number of visits and display the analysis results in a bar chart,
run the following statement:
* | select request_uri, count(1) as count group by request_uri order by count desc limit 10