This topic describes how to configure a line chart to display query results.
Chart upgrade
Background information
- Increment or decrement
- Increment or decrement rate
- Increment or decrement pattern, for example, 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 period. This allows you to analyze the relationship between the categorical variables. For example, the values of a categorical variable are proportional or inversely proportional to the values of another categorical variable.
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
Set the X Axis parameter to time
, the Left Y Axis parameter to PV
, and the Legend parameter to Bottom. 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
Set the X Axis parameter to time
, the Left Y Axis parameter to PV
, the Right Y Axis parameter to UV
, and the Column Marker parameter to UV
.
