This topic describes how to view query results in a line chart.
Background information
- Increment or decrement
- Increment or decrement rate
- Increment or decrement pattern, such as, periodicity
- Peak value and bottom value
Line charts are the optimal choice for you to analyze value changes over a time range. You can also use a line chart to analyze the value changes of multiple categorical variables in multiple lines over the same time range. This allows you to analyze the relationship between the categorical variables. For example, the values of multiple categorical variables can show positive, negative, or inverse trends.
- X-axis
- Left Y-axis
- Right Y-axis (optional)
- Data point
- Line of trend changes
- Legend
Procedure
Example of a simple line chart
To query the number of page views (PVs) for 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 X Axis, PV
for Left Y Axis, and Bottom for Legend. Adjust the margins based on your business
requirements.

Example of a dual-axis line chart
To query the numbers of 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 X Axis, PV
for Left Y Axis, UV
for Right Y Axis, and UV
for Column Marker.
