Entrance
Charting for SQL Developers - Part 2
Data
Painting
In
the previous section we saw how UPDATEs
could be used with PLOT
and COLOR
OVERRIDEs
to "paint" data points in a chart with color This is "data
painting". You can also do data painting while viewing a chart.
The technique is a lot like "brushing" data points, as described
by William Cleveland in his book "The Elements of Graphing Data".
To paint
data from an Entrance chart you need a color override, as in this
script:
PLOT
CORRELATION
TRIANGLE, TRIANGLE, TRIANGLE, COLOR OVERRIDE
WITH
FRAME 20 20 400 400
SELECT
population, area, gdp, color from country;
Often
you will add a column to serve as the color override, using either SQL
ALTER or "New Column..." from the table popup menu.
Then
you run the query to generate a chart. With the mouse you drag
out a rectangle over points in the chart that interest you:
and
paint them "red" or another color. You are actually changing the
color value of rows corresponding to points in the table. When
the chart is automatically redrawn, you see the changes:
Data Painting and the
"Match Box"
Whichever
data painting technique you used, rows in the original table are now
marked with a color. You can use the Entrance match box to filter
the table for rows with that mark, as shown below:
You
can quickly calculate means and medians for the marked data points
using Tools | Calculate statistitics.... which limits the
calculation to matching rows (as of version 0.81.3).
You can
easily act on the marked rows from your own SQL scripts. For
example, you can select them:
SELECT name, area FROM country
WHERE color = 'red';
update them:
UPDATE TABLE country
SET name = concat(name, ' **')
WHERE color = 'red';
or ignore
them, eg. as a way of temporarily eliminating outliers:
SELECT avg(area) FROM country
WHERE color != 'red';
To learn more about
Entrance charts
Please
note: This web page and other Entrance documentation web pages
are copyrighted material and have not been released under the terms of
the GPL.
Copyright
(c) 2007 dbEntrance Software, All Rights Reserved
MySQL
is a registered trademark of MySQL AB in the United States, the
European Union and other countries.
Last
Modified June 2, 2007