This topic describes how to view query results in a bar chart.
A bar chart is a type of column chart. Bar charts are the optimal choice for you to analyze the top N data. You can configure a bar chart in a similar way as you configure a column chart.
- Rectangular bar
Each rectangular bar has a fixed height and a variable width. The variable width indicates a value. If multiple fields are selected for the Y-axis, you can use a grouped bar chart to display the data.
- Log on to the Log Service console.
- In the Projects section, click the name of the project that you want to manage.
- Choose and click the Logstore that you want to manage.
- Enter a query statement in the search box, select a time range, and then click Search & Analyze.
- On the Graph tab, click the icon.
- On the Properties tab, configure the properties of the bar chart. Note
- If no more than 20 log entries are returned by a query statement, you can use a bar
chart to display the query results. You can also 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. In addition, you
can use an
ORDER BYclause in the query statement. We recommend that you select 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 be positively or negatively associated with each other.
Parameter Description X Axis 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 X-axis The format in which the data on the X-axis is displayed. Legend Width The width of the Legend. Y-axis Scale Density The scale density of the Y-axis. Valid values: 3 to 30. 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.
- If no more than 20 log entries are returned by a query statement, you can use a bar chart to display the query results. You can also 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. In addition, you can use an
To obtain the top 10 URIs (request_uri) that are mostly requested, execute the following query statement:
* | select request_uri, count(1) as count group by request_uri order by count desc limit 10