Add a sparkline to a table

Updated at:
Copy as MD

Add sparklines to dashboard table cells to visualize data trends as inline line, area, or column charts.

Prerequisites

Overview

image

  1. Query and analysis: Query and analyze logs in the console — search, aggregate, and generate statistics.

  2. Add a chart: Dashboards consist of charts, each generated from a query and analysis statement.

  3. Add a sparkline: Configure a table cell to display data as a line, area, or column chart.

Step 1: Query and analyze data

  1. Log on to the Simple Log Service console. In the Projects section, click the project you want.

    image

  2. On the Log Storage > Logstores tab, click the logstore you want.

    image

  3. Enter a query and analysis statement, and click Last 15 Minutes to set the time range.

    For example, the following statement returns traffic by request path:

    * | SELECT http_referer, array_agg(body_bytes_sent) as body_bytes_sent from log GROUP BY  http_referer

    The array_agg function aggregates field values into an array.

Step 2: Add a chart

  1. In the left-side navigation pane, choose Dashboard > Dashboards. In the Dashboard list, click the dashboard you want. In the upper-right corner of the dashboard page, click Edit. In edit mode, choose Add > Add Chart.

    image

  2. In the General Configurations section, select the image icon for Chart Type. On the Query and Analysis tab, select your data source (in this case, LogStore (SQL)), select the target Logstore, and enter a query statement.

    In the upper-right corner, select a time range such as Last 15 Minutes and click Apply.

    Set Chart Type to Table. An example query: * | select *.

Step 3: Add a sparkline

Line sparkline

Click Field Configuration > Add Field, select the A > body_bytes_sent field, and then click Add Configuration. Select Field/Column Settings > Cell Display Mode and choose Line Chart.

Area sparkline

Click Field Configuration > Add Field, select the A > body_bytes_sent field, and then click Add Configuration. Select Field/Column Settings > Cell Display Mode and choose Area Chart.

Column sparkline

Click Field Configuration > Add Field, select the A > body_bytes_sent field, and then click Add Configuration. Select Field/Column Settings > Cell Display Mode and choose Column Chart.