Making Charts
Using Entrance, you can make charts using query output. In fact, any SELECT statement can be converted to a chart by putting PLOT before it.
The process is very simple. Write a SQL script the normal way, but add a PLOT keyword, and you have a chart:
PLOT
AXISLABELS, ORANGE LINE
SELECT
year, avg FROM cpi_annual;
|
|
You can embellish the basic script with things like legends, titles, and data labels using
PLOT syntax. There are a few basic examples listed below and many more are on the
Entrance blog. You can also use the Charts menu for help making a chart.
The Details
First,
install Entrance and
connect to a MySQL® database. then click the "New" button to open a script tab. Enter a script like the one above, and click the "Run" button. You should now have a chart. Use the "SQL" and "Results" tabs at the bottom of the screen to jump back and forth between the chart and script views.
Examples
Here are a few examples you can copy and use for templates. (Just keep in mind that the chart series listed in PLOT must matchup 1-to-1 with columns listed in SELECT)
PLOT
ONLY 5 AXISLABELS,
DARK BLUE CIRCLE AND LINE
WITH
TITLE "Main Title"
TITLE X "X Title"
TITLE Y "Y Title"
GRIDLINES
SELECT
year, avg FROM cpi_annual
WHERE year >= 1965
AND year <= 1975;
|
|
PLOT
AXISLABELS, LIGHT RED BAR
WITH
TITLE "Main Title"
TITLE X "X Title"
TITLE Y "Y Title"
SELECT
year, avg FROM cpi_annual
WHERE year >= 2000
AND year <= 2005;
|
|
PLOT
AXISLABELS, LIGHT BLUE AREA
WITH
TITLE "Main Title"
TITLE X "X Title"
TITLE Y "Y Title"
SELECT
year, avg FROM cpi_annual
WHERE year <= 2008;
|
|
PLOT SCATTER
X, DARK BUTTER CIRCLE
with
SCALE Y -1 1 1
TITLE "Title"
TITLE X "X Title"
TITLE Y "Y Title"
SELECT
4 * x * COS(y * 2 * PI()),
x * SIN(y * 2 * PI())
FROM ref2;
|
|