Databases Reference
In-Depth Information
INTO l_xml
FROM emp;
l_data := l_data || wwv_flow_utilities.clob_to_varchar2(l_xml);
SELECT xmlelement("series", xmlattributes('Series 2' AS "name", 'extra_y_axis_1' AS
"y_axis"), xmlagg( xmlelement("point", xmlattributes(ename AS "name", nvl(comm,0) AS "y")
) )).getClobVal()
INTO l_xml
FROM emp;
l_data := l_data || wwv_flow_utilities.clob_to_varchar2(l_xml);
l_chart := replace(l_chart, '#DATA#', l_data);
return l_chart;
end;
Escape Special Characters: No
Affected Elements - Selection Type: Item(s)
Item(s): P7_CHART_XML
We use the same XML DB features of the database to generate the data part. We also have
a variable to store the XML definition of the chart. Note that the above example only works
with datasets that are less than 32K because there is currently a limitation in APEX that
you can assign a maximum of 32K to a Page Item. If you need to work with big datasets
you need to slightly change the code. Later in this chapter, we will generate a dashboard
and use the other technique which supports XML bigger than 32K. Also note that we used
NVL(comm,0) for the value in the second series. If you don't use NVL the line will be
incomplete as the y value in the XML will contain an empty string and your result might
not be correct. So either you use NVL , which gives empty strings the value of 0, so every
record will show up in the chart as a point, or you define a WHERE clause where you specify
comm is not null; that means not every record will be shown, but your line will be
complete.
A second True Actions to load the chart:
Action: Execute JavaScript Code
Fire When Event Result Is: True
Code:
chart = new AnyChart('#IMAGE_PREFIX#flashchart/anychart_5/swf/OracleAnyChart.swf',
'#IMAGE_PREFIX#flashchart/anychart_5/swf/Preloader.swf');
chart.width = $v('P7_CHART_WIDTH');
chart.height = $v('P7_CHART_HEIGHT');
chart.setData( $v('P7_CHART_XML') );
chart.write('chartDiv');
Search WWH ::




Custom Search