Databases Reference
In-Depth Information
Writing Queries for Charts
APEX charts generally need a query of this type
SELECT
link,
label,
value
FROM
table
WHERE
where conditions
GROUP BY
group by column list
ORDER BY
Order by column list
where
link
is a link to an APEX page or other URL.
•
label
is the label for the chart element.
•
value
is the value to be charted.
•
The exact syntax changes slightly to suit the needs of the various chart types, but the general link-label-value
format remains the same. For the correct syntax for each chart type, see the APEX online documentation.
Creating a Chart
Let's create a pie chart that shows the count of tickets in each status. Later you'll link the action of clicking a pie piece
to filtering the tickets report to show only tickets of that status. Follow these steps:
1.
Edit any page of the application.
2.
Click the
Create
button at upper right on the page, and select
New Page
.
3.
Select
Chart
, and click
Next
.
4.
Select
HTML5 Chart
from the select list.
5.
When the page refreshes, select
Pie & Doughnut
, and click
Next
.
6.
Select
2D Pie
, and click
Next
.
Enter
500
for
Page Number
and
Tickets by Status
for both
Page Name
and
Region
Name
, and set
Breadcrumb
to
Breadcrumb
(see Figure
7-74
). When the page reloads,
enter
Chart
for
Entry Name
, as shown in Figure
7-75
, and click
Next
.
7.