sqlDashboards adds Step Plot Visualization

Our standard time-series graph interpolates between points. When the data you are displaying is price points, it’s not really valid to always interpolate. If the price was 0.40 at 2pm then 0.46 at 3pm, that does not mean it could be interpreted as 0.43 at 2.30pm. Amazingly till now, sqlDashboards had no sensible way to show taht data. Now we do:

Step Plot of Asset Price

For comparison here is the same data as a time-series graph:


The step-plot is usable for time-series and numerical XY data series. The format is detailed on the usual chart format pages.

sqlDashboards now supports Stacked Bar Charts

sqlDashboards has now added support for stacked bar charts. e.g.:

Stacke Bar Chart of Exchange Volumes

The chart format is: The first string columns are used as category labels. Whatever numeric columns appear after the strings represents a separate series in the chart. Row in the table is shown stacked above the other, in the order as they appear.

e.g. The table for the above chart is:


sqlDashboards supports Graphs,Nodes and State Diagrams

sqlDashboards is specialised for real-time data visualization. Often this includes monitoring the state of orders, whether that’s baskets of goods being ordered online or financial transactions, we want to help you see what state those items are in. To support visualizing this data we’ve integrated the most powerful open source graphing: DOT and graphviz. If you install graphviz and make it available in your path, you can automatically get sqlDashboards to generate graphs from tabular data, like so:

From To label cnt
PendingCancel Calculated Rejected 50
PendingReplace Calculated Rejected 10
PendingReplace Calculated Replaced 40
Calculated PendingReplace PendingReplace 50
Calculated Filled Trade 9400
Calculated Calculated Trade 5239
PendingCancel Removed Cancelled 150
Calculated PendingCancel PendingCancel 200
New Calculated Calculated 9660
New Removed Rejected 140
Created Removed Rejected 300
Created New New 9800


Notice to get the labels and styling you use a column called label or style respectively. The full format is detailed on the sqlDashboards example page.

sqlDashboards 1.43 Released

Tow small changes in the latest release:
- Hide editor when first opening. Upon adding a chart the editor will show again.
- Bugfix: Mac “Save As” dialog was hiding the filename prompt. Fixed.
As always, it’s available to download now.

sqlDashboards 1.42 Released with Improved Sharing

1.42 is now release and available to download. The biggest change is that saved files will no longer have usernames/pasaswords stored in them. This is to allow sharing amongst a team. Now sqlDashboards stores one default login as part of the software and attempts to use that with any opened files. If the login does not work it prompts the user. This can be changed under:


Full Change List:

  • Allow saving .das without username/password to allow sharing. Prompt user on file open if cant connect to server.
  • Bugfix: Allow resizing of windows within sqlDashboards even when “No table returned” or query contains error.
  • Allow setting File->title and use file name if file is Untitled.
  • If query is wrong and missing arg or something. Report why, report the reason.
  • KDB Database Only: Stop wrapping JDBC queries as we dont want kdb to use the standard SQL handler. We want to use the q) handler.

Creating Highlighted Rows

This is a quick video tutorial showing how to add highlighted rows to a dashboard as a few people had emailed asking this:

How to Highlight Rows in an sqlDashboard

To highlight a row we use specially named sqlDashboards columns SD_ that affect how the result is displayed but are not shown in the table

  1. Add a column called SD_BGCOLOR specifying a color to use for the background of that row e.g. ‘green’ or using HTML hex triplet notation e.g. #224466
  2. Add a column called SD_FGCOLOR specifying the color to use for the foreground of that row

Hex triplet is a six-digit, three-byte hexadecimal number used in HTML, CSS, SVG, and other computing applications to represent colors. The bytes represent the red, green and blue components of the color. One byte represents a number in the range 00 to FF (in hexadecimal notation), or 0 to 255 in decimal notation. This represents the least (0) to the most (255) intensity of each of the color components.

Using Case When

Commonly you will probably want to use SQL’s CASE-WHEN to alternate colors depending on an existing column value. e.g.

highlighting rows in an sql dashboard

sqlDashboards 1.41 Released

sqlDashboards 1.41 has been released and is available to download.

Changes include:

  • Support custom JDBC drivers and Authentication Services
  • Fix refresh rate display bug when widget is selected
  • Fix sqlchart.bat to allow running from any current path

The custom JDBC/security has been asked for a couple of times but it’s inclusion at this stage is experimental. We do have a few customers using it with qStudio and documentation is available here. If this interests you get in touch.

sqlDashboards 1.40 Released

SqlDashboards 1.40 has been released and can now be downloaded.

Major changes include:

  • Allow user specified refresh rates
  • Speed optimization to prevent chart redraws when query result unchanged.
  • Added built-in demo for MySQL
  • Fixed sd_ column prefix case bug
  • Fix UTF-8 bug on saving .das files.
  • Fixed sqlChart watermark bug on linux

Sending an email with pie charts and graphs

The following steps explain how to send an email with chart image attachments from the command line. First we must install the necessary email tools in linux:

Install Email Sending on Linux

apt-get install mutt
vi ~/.muttrc

That last line, opens the configuration for editing. For gmail you will have details like this:

account-hook imap://gmail/ “set

set imap_user = 'user@domain.com'
set imap_pass = 'PASSWORD'

set smtp_url = 'smtp://user@domain.com@smtp.gmail.com:587/'

set smtp_pass = 'PASSWORD'
set from = 'user@domain.com'
set realname = 'John'

set folder = 'imaps://imap.gmail.com:993'
set mbox= '+Inbox'
set spoolfile= '+Inbox'
set postponed= '+[Gmail]/Drafts'
set trash = '+[Google Mail]/Trash'

set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

set move = no
set timeout=15
auto_view text/html

To test this, first run “mutt”, it should display your gmail inbox. Then send an email using the command:
mutt -s "test" receiver@domain.com <<< "test message"

Install sqlChart and generate pie charts

  1. Download sqlDashboards.jar
  2. Copy it to your /usr/local/bin directory
  3. Create an alias so we can run it with a shorter name
  4. Run command to generate chart

wget http://www.sqldashboards.com/files/sqldashboards.jar
mv sqldashboards.jar /usr/local/bin/
alias sqlchart="java -cp /usr/local/bin/sqldashboards.jar com.timestored.sqldash.SqlChart"

sqlchart --servertype mysql --chart piechart --user USERNAME --password PASSWORD --database DATABASENAME--out pie.png --execute "select DATE(time),count(*) from qstudioreg group by DATE(time) ORDER BY DATE(time) DESC limit 9"

Voila we have our chart:
database piechart

Send email with attachments

Use mutt to send the email, with -a to specify attachments like so:
mutt -s "sql pie chart reports" ryan@timestored.com -a pie.png <<< "Here is your database report"

Done. So we successfully configured mutt for sending email, then generated our pie chart from mysql using sqlchart then we emailed it as an attachment. If you have any problems please let me know and I'll try to help. Here's the email in my inbox:


Real-Time Charting of Electrical Sensor Data

Let’s look at how we can display real-time and historical sensor data for Household Electrical usage using sqlDashboards.

The historical data is taken from the UCI Machine Learning Repository. This is a single CSV file with 1 minute readings between December 2006 and November 2010. i.e.

The Sensor Data Sql Dashboard

sql dashboard of household electric sensor data

Time Series Data Format

The data came in the following format:

date time Global_active_power Global_reactive_power
2006-12-16 17:24:00 4.216 0.418
2006-12-16 17:25:00 5.36 0.436
2006-12-16 17:26:00 5.374 0.498

Where the columns have the following meaning:

  • date: Date in format dd/mm/yyyy
  • time: time in format hh:mm:ss
  • global_active_power: household global minute-averaged active power (in kilowatt)
  • global_reactive_power: household global minute-averaged reactive power (in kilowatt)
  • voltage: minute-averaged voltage (in volt)
  • global_intensity: household global minute-averaged current intensity (in ampere)
  • sub_metering_1: energy sub-metering No. 1 (in watt-hour of active energy). It corresponds to the kitchen, containing mainly a dishwasher, an oven and a microwave (hot plates are not electric but gas powered).
  • sub_metering_2: energy sub-metering No. 2 (in watt-hour of active energy). It corresponds to the laundry room, containing a washing-machine, a tumble-drier, a refrigerator and a light.
  • sub_metering_3: energy sub-metering No. 3 (in watt-hour of active energy). It corresponds to an electric water-heater and an air-conditioner.

Creating the SQL Dashboard Charts

To create the live charts I:

  1. Imported the data to MySQL database.
  2. Created a java process to insert live sensor data.
  3. Opened sqlDashboards
  4. Added a time series monthly graph and using the sql query:

    select STR_TO_DATE(DATE_FORMAT(Date, '%Y-%m-01'),'%Y-%m'),AVG(Global_active_power),AVG(Global_reactive_power) FROM power GROUP BY DATE_FORMAT(Date, '%Y-%m-01')
  5. Added a daily time series rollup graph and using the sql query:

    CREATE TABLE daily AS select Date,AVG(Global_active_power),AVG(Global_reactive_power) FROM power WHERE Date>'2009-11-11' GROUP BY Date;
  6. Added a bar chart showing the different meter readings as bar charts per year:

    select CAST(YEAR(Date) AS CHAR(4)) AS Year,AVG(Sub_metering_1),AVG(Sub_metering_2),AVG(Sub_metering_3) from power GROUP BY YEAR(Date)
  7. Added further queries to show the live data for today…

This gave me the final dashboard:
Sensor Data time Series Sql Charts