The line chart, a graph for analyzing trend, is generally used to indicate the changes of a group of data on an ordered data type (successive time intervals in most cases) for analyzing the trend of data changes intuitively.

You can see the data changes in a period clearly by using the line chart. The changes are displayed mostly in the following aspects:

  • Progressive increase or decrease
  • Rate of increase or decrease
  • Law of increase or decrease (such as periodic changes)
  • Peak and valley

Therefore, the line chart is the best choice for analyzing the trend of data changes over time. You can also use multiple lines to analyze the changing trend of multiple groups of data in the same period, and then analyze the mutual effect (such as increasing or decreasing at the same time and being inversely proportional to each other) among data in different groups.

Basic components

  • X axis
  • Left Y axis
  • Right Y axis (optional)
  • Data point
  • Changing trend line
  • Legend

Configuration item

Configuration item Meaning
X axis Generally, the X axis is an ordered data type (time series).
Left Y axis You can configure one or more columns of data to correspond to the value interval of the Y axis.
Right Y axis You can configure one or more columns of data to correspond to the value interval of the right Y axis (the layer of the right Y axis is higher than that of the left Y axis).
Column marker Display a selected column in the left Y axis or right Y axis as a histogram.
Legend The location where the legend is in the graph. You can configure the legend to the top, bottom, left, or right of the graph.
Padding The distance between the coordinate axis and the graph boundary.

Procedure

  1. On the query page, enter the query statement in the search box, select the time interval, and then click Search.
  2. Click the Graph tab and select the line chart .
  3. Configure the graph properties.
    Note
    The number of data records for a single line must be greater than two in case that the data trend cannot be analyzed. We also recommend that you have no more than five lines in a line chart.

Example 

Simple line chart

To query the access situation of the IP address 42.0.192.0 in the last day, the statement is as follows:

remote_addr: 42.0.192.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 as the X Axis, PV as the Left Y Axis, UV as the Right Y Axis, and PV as the Column Marker.
Figure 1. Simple line chart


Line chart with both left Y axis and right Y axis

To query the access PVs and UVs in the last day, the statement is as follows:

* | 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 as the X Axis, PV as the Left Y Axis, UV as the Right Y Axis, and PV as the Column Marker.

Figure 2. Line chart with both left Y axis and right Y axis