IREX
EN

Build an event intensity line chart

We assume the reader is familiar with Apache Superset basics, including SQL. The purpose of this chapter is to illustrate, with a few examples, how to analyze and visualize data in the IREX event database using Apache Superset and SQL. 

In this example, we will build a time diagram that shows:

  • The overall number of IREX events ...
  • ... in time intervals 30 minutes long ...
  • ... over the previous week, ...
  • ... classified by the modules that produced those events.

Create an empty chart

  1. Click the +Chart on the Charts page on the Apache Superset home screen.
  2. On the Select dataset list, click the IREX event database name, "kx_events" in our case.
  3. Superset Create a new chart screen with the Choose a dataset field open, listing Cameras - Signal Loss and kx_events

  4. In the Choose chart type workspace, click Line chart.
  5. Click Create new chart to open the next screen, for formulating the query conditions to extract the relevant data from the database.
  6. Enter the chart name as shown, e.g., "Event intensity".
  7. New chart screen with the chart name field highlighted and Chart Source set to kx.kx_events

Formulate the query to the database

  1. We would like to have the event time plotted along the X-axis on the chart. This value is stored in start_time column of the event database, so click as shown to select start_time, then click Save.
  2. X-axis column picker for My column with start_time highlighted in the list of 44 columns

    In a more general case, it might be some kind of combination of the columns in the database, constructed on the Custom SQL tab following the SQL syntax rules, e.g., like this.

  3. Select "30 minutes" on the Time Grain list.
  4. Metrics defines the metric displayed on the chart. In this example, it is the number of events, or COUNT in SQL terms. So, click as shown to select COUNT and then click Save.
  5. Metrics panel with the Saved metric COUNT(*) highlighted next to the Time Grain set to 30 minute

  6. Dimensions are the attributes by which we are going to categorize chart data. In this example, it is the module that triggered events. The modules are in the module column, so click as shown to select modules and then click Save.
  7. Dimensions column picker with module highlighted in the list of database columns

    In a more general case, it might be some kind of combination of the columns in the database, constructed on the Custom SQL tab following the SQL syntax rules.

  8. Since we are interested in events from the previous week, set the Previous calendar week filter as shown and click Save.
  9. More complicated filters can also be built on the Custom SQL tab, following the SQL syntax rules. 

    Filters panel with the Time Range set to previous calendar week under the start_time column

  10. Click Create chart below.

Review, customize, and save the chart

Click on Create chart  sends a query to the IREX event database for data matching the conditions formulated at steps 1 - 5. The query is executed, and the resulting chart is displayed.

Line chart of event counts by module over time, with a tooltip listing per-module counts such as KX.Faces at 41.4k and KX.PDD at 37.4k

Use the options on the Customize tab to customize the chart, e.g., add titles to the axis, change color scheme, etc.

Customize tab showing the Chart Title, X Axis Title, X Axis Title Margin, and Y Axis Title fields

Click Save in the upper-right corner of the screen to complete the chart saving dialog.

Save chart dialog with Save as selected and the chart name set to Event intensity

Update the chart

When the chart data needs updating, e.g., a week later, find the chart name on the list ...

Superset Charts list with the Event intensty chart entry highlighted

... click it to open and click Update chart to redraw the chart.