This topic describes how to configure a line chart to display query results.
Background information
- Increment or decrement
- Increment or decrement rate
- Increment or decrement pattern, for example, periodicity
- Peak value and valley value
Line charts are used to analyze field value changes over a time period. You can also use a line chart to analyze the value changes of multiple fields in multiple lines over the same time period. This allows you to analyze the relationship between the different fields. For example, the values of multiple fields can display positive, negative, or inverse trends.
- X-axis
- Left Y-axis
- Right Y-axis (optional)
- Data point
- Line of trend change
- Legend
Procedure
Example of a simple line chart
To query the page views (PVs) of the IP address 10.0.0.0
in the last 24 hours, execute the following query 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
Select time
for the X-axis, PV
for the left Y-axis, and Bottom for Legend. Adjust the margins based on your business
requirements.

Example of a dual Y-axis line chart
To query the PVs and unique visitors (UVs) in the last 24 hours, execute the following query 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
Select time
for the X-axis, PV
for the left Y-axis, UV
for the right Y-axis, and UV
for Column Marker.
