Databases Reference
In-Depth Information
color="Yellow"/>
<condition name="Good" type="greaterThan" value_1="{%Value}" value_2="2500"
color="Green"/>
</threshold>
</thresholds>
5.
If you run the page now with the custom XML you don't see any difference,
which is because the data node also needs to take the threshold into account.
Now this isn't as straightforward as you might think. If you look at the XML you
will find a #DATA# token that gets replaced on the fly by Oracle APEX based on
the series. The SQL statement of the series gets translated into the correct
XML. APEX doesn't support the threshold tag out-of-the-box, so you need to
generate the correct XML so the thresholds are included manually.
6.
Create a Hidden Item on the page (right-click the chart region - Create Page
Item - Hidden) and call it P18_CHART_XML (because we are on page 18). You will
use this item to store the data part of the chart.
In the Custom XML, replace #DATA# with &P18_CHART_XML. (note the . at the
end), where P18_CHART_XML is the hidden page item. That item you will fill with
the correct XML.
7.
To fill P18_CHART_XML with the XML, add an Advanced Dynamic Action to the
page which generates the XML. Use the XMLDB feature of the database, which
lets you create a select statement that generates XML. The Dynamic Action
looks like this:
8.
Event: Page Load
True Action: Execute PL/SQL Code
declare
l_xml clob;
begin
SELECT xmlelement("data", xmlattributes('sales_threshold' AS "threshold"),
xmlelement("series", xmlattributes('Series 1' AS "name"), xmlagg(
xmlelement("point",xmlattributes(ename AS "name", sal AS "y") ) ))).getClobVal()
INTO l_xml
FROM emp;
:P18_CHART_XML := wwv_flow_utilities.clob_to_varchar2(l_xml);
end;
Page Items to Submit: P18_CHART_XML
9.
If you want to add the Legend of the Thresholds you have to make another
small change to the XML in Use Custom XML. You have to tell the legend the
source is now thresholds instead of the items. Search for legend (only visible
when you defined Show Legend before you set Use Custom XML) and change
it to the following code. If you don't find the legend node, add it after the
</axes> node.
<legend enabled="true" position="Bottom" align="Near" elements_layout="Horizontal"
ignore_auto_item="true" >
<title enabled="true">
Search WWH ::




Custom Search