This topic describes how to configure a line chart to display query results. It also includes examples.
- Increment or decrement
- Increment or decrement rate
- Increment or decrement pattern, for example, periodicity
- Peak value and valley value
Line charts are best suitable for analyzing field value changes over time. You can also use a line chart to analyze the value changes of multiple fields in multiple lines over the same period and reveal the relationship between the fields. For example, the values of multiple fields are positively or negatively associated with each other.
- Left Y-axis
- (Optional) Right Y-axis
- Data point
- Line of changing trend
- 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 line chart.
- On the Properties tab on the right, configure the properties of the line chart.Note In a line chart, a single line must contain more than two data points. Otherwise, the data trend cannot be analyzed. We recommend that you configure no more than five lines in a line chart.
Configuration item Description X Axis The data on the X-axis, which is usually a time sequence. Left Y Axis The numeric data on the left Y-axis. You can configure one or more fields on the left Y-axis. Right Y Axis The numeric data on the right Y-axis. You can configure one or more fields on the right Y-axis. The layer of the right Y-axis is higher than that of the left Y-axis. Column Marker The column on the left Y-axis or right Y-axis that is selected as a histogram. Legend The position where the legend is located in the chart. Valid values: Top, Bottom, Left, and Right. Format Left Y-axis The format in which data configured on the left Y-axis and right Y-axis is displayed. Format Right Y-axis Left Y-axis Start Value The custom start value of the left Y-axis and right Y-axis. Right Y-axis Start Value Line Type The type of a line displayed in the line chart. Valid values: Straight Line and Curve. Anomaly Point Column The column where point anomalies reside. You can set the Lower Limit Column and Upper Limit Column for a column.
- Anomaly Point Lower Limit: field values that are lower than the lower limit are marked red.
- Anomaly Point Upper Limit: field values that are higher than the upper limit are marked red.
Upper Limit Column The area that is formed based on the values of fields. Lower Limit Column Time Series The time series based on which field values are sorted in the chronological order. Margin The distance of the axis to the borders of the chart, including Top Margin, Bottom Margin, Right Margin, and Left Margin.
Example of a simple line chart
To query the page views (PVs) of the IP address
10.0.0.0 in the recent one day, run the following statement:
remote_addr: 10.0.0.0 | select date_format(date_trunc('hour', __time__), '%m-%d %H:%i') as time, count(1) as PV group by time order by time limit 1000
time for X Axis,
PV for Left Y Axis, and Bottom for Legend. Adjust the margins based on your needs.
Example of a dual Y-axis line chart
To query the PVs and unique visitors (UVs) in the recent one day, run the following statement:
* | select date_format(date_trunc('hour', __time__), '%m-%d %H:%i') as time, count(1) as PV, approx_distinct(remote_addr) as UV group by time order by time limit 1000
time for X Axis,
PV for Left Y Axis,
UV for Right Y Axis, and
PV for Column Marker.