878 lines
44 KiB
Plaintext
878 lines
44 KiB
Plaintext
CREATE OR REPLACE PACKAGE BODY EFT_NOM.svg IS
|
|
|
|
-- Author : PRIESTJ
|
|
-- Created : 05/12/2005 17:24:19
|
|
-- Purpose : used to create svg objects like graphs and charts
|
|
|
|
-- Public constant declarations
|
|
pi constant number := 3.14159265; --slice of pie anyone?
|
|
--JP hacking
|
|
--need to stick the circle_pointx & circle_pointy in as proper
|
|
--functions (could even get rid of diameter parameter)
|
|
--will also need to set up variables.
|
|
--get the value of x on the circle
|
|
FUNCTION circle_pointx ( degrees number
|
|
, diameter number
|
|
) RETURN NUMBER IS
|
|
--
|
|
mydegrees NUMBER := 0;
|
|
--
|
|
BEGIN
|
|
--
|
|
-- Avoid problems with doubles
|
|
--
|
|
mydegrees := degrees + 0.5;--0.0001;
|
|
return cos(mydegrees * (pi / 180)) *(diameter / 2);
|
|
--
|
|
END circle_pointx;
|
|
--
|
|
-- Get the value of y on the circle
|
|
--
|
|
function circle_pointy(degrees number, diameter number) return number is
|
|
mydegrees number := 0;
|
|
begin
|
|
--avoid problems with doubles
|
|
mydegrees := degrees + 0.5;--0.0001;
|
|
return sin(mydegrees * (pi / 180)) *(diameter / 2);
|
|
end circle_pointy;
|
|
|
|
FUNCTION colour_palette ( p_index IN NUMBER ) RETURN VARCHAR2 IS
|
|
--
|
|
l_return VARCHAR2(6);
|
|
--
|
|
BEGIN
|
|
--
|
|
IF p_index = 1 THEN
|
|
--
|
|
l_return := '003D62';
|
|
--
|
|
ELSIF p_index = 2 THEN
|
|
--
|
|
l_return := 'FFFF00';
|
|
--
|
|
ELSIF p_index = 3 THEN
|
|
--
|
|
l_return := '00FF00';
|
|
--
|
|
ELSE
|
|
--
|
|
l_return := '555555';
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END colour_palette;
|
|
--procedure used to display the cheese wedges for our pie chart, exports 3 svg
|
|
--path tags with attributes
|
|
PROCEDURE codedpiechart ( p_availcapacity IN NUMBER
|
|
, p_gasflowed IN NUMBER
|
|
, p_remainflow IN NUMBER
|
|
) IS
|
|
--
|
|
degrees number;
|
|
charttotal number;
|
|
currentvalue number;
|
|
arcx number;
|
|
arcy number;
|
|
StartDegrees number;
|
|
EndDegrees number;
|
|
wedgesize number;
|
|
wedgecolor varchar2(7);
|
|
largearcflag integer := 0;
|
|
svgtext varchar2(4000);
|
|
--
|
|
BEGIN
|
|
--
|
|
--ensure the first line is vertical
|
|
--
|
|
degrees := 270;
|
|
--
|
|
charttotal := p_availcapacity + p_gasflowed + p_remainflow;
|
|
|
|
for i in 1 .. 3 loop
|
|
|
|
--get the data for our chart depending on which cycle of the loop
|
|
if i = 1 then
|
|
currentvalue := p_availcapacity; --availcapcity
|
|
wedgecolor := '#336699';
|
|
elsif i = 2 then
|
|
currentvalue := p_gasflowed; --gasflowed
|
|
wedgecolor := '#6699CC';
|
|
elsif i = 3 then
|
|
currentvalue := p_remainflow; --remainflow
|
|
wedgecolor := '#99CCFF';
|
|
end if;
|
|
|
|
StartDegrees := round(degrees);
|
|
--figure out the angle (in degrees) of our current cheese
|
|
wedgesize := (currentvalue / charttotal) * 360;
|
|
degrees := degrees + wedgesize;
|
|
EndDegrees := round(degrees);
|
|
--if one of our cheeses is 180 or bigger we need to set the large arc flag
|
|
--other with the arc (A) won't draw it correctly
|
|
if wedgesize >= 180 then
|
|
largearcflag := 1;
|
|
else
|
|
largearcflag := 0;
|
|
end if;
|
|
svgtext :='<path d="';
|
|
--start at center of circle
|
|
svgtext := svgtext ||'M 55,55 ';
|
|
--draw out to circle edge
|
|
ArcX := circle_pointx(StartDegrees, 100);
|
|
ArcY := circle_pointy(StartDegrees, 100);
|
|
svgtext := svgtext ||'L' || floor(55 + ArcX) || ','||floor(55 + ArcY);
|
|
--htp.print(floor(80 + ArcY));
|
|
--draw arc
|
|
ArcX := circle_pointx(EndDegrees, 100); --get x point of the arc
|
|
ArcY := circle_pointy(EndDegrees, 100); --get y point of the arc
|
|
svgtext:=svgtext||' A 50,50 0 ' || largearcflag || ' 1 ' || floor(55 + ArcX) ||
|
|
',' || floor(55 + ArcY) || ' Z" style="fill:' ||
|
|
wedgecolor || '; stroke:black; stroke-width:1;" />';
|
|
|
|
|
|
--print out the svg path tag
|
|
htp.p(svgtext);
|
|
end loop;
|
|
|
|
end codedpiechart;
|
|
|
|
procedure piechart ( p_availcapacity IN NUMBER DEFAULT g_availcapacity
|
|
, p_gasflowed IN NUMBER DEFAULT g_gasflowed
|
|
, p_remainflow IN NUMBER DEFAULT g_remainflow
|
|
) IS
|
|
begin
|
|
--'Content-type: image/svg+xml'
|
|
owa_util.mime_header('image/svg+xml', true, 'iso-8859-4');
|
|
htp.print('<?xml version="1.0" standalone="no"?>');
|
|
htp.print('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">');
|
|
htp.print('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">');
|
|
htp.print(' <style type="text/css"> rect:hover {fill-opacity:0.9;}path:hover {fill-opacity:0.9;}</style>');
|
|
htp.print(' <g style="fill-opacity:0.7; font-family: Verdana; font-size:11px;">');
|
|
codedpiechart( p_availcapacity
|
|
, p_gasflowed
|
|
, p_remainflow
|
|
);
|
|
--htp.print('<circle cx="85" cy="80" r="75" style="fill:none; stroke:black; stroke-width:3"/>');
|
|
htp.print('<rect x="2" y="112" height="15" width="15" style="fill:#336699; stroke:black; stroke-width:0.5"/>');
|
|
htp.print('<rect x="2" y="137" height="15" width="15" style="fill:#6699CC; stroke:black; stroke-width:0.5"/>');
|
|
htp.print('<rect x="2" y="162" height="15" width="15" style="fill:#99CCFF; stroke:black; stroke-width:0.5"/>');
|
|
htp.print('<text x="20" y="122">Avail Capacity ('||TO_CHAR(p_availcapacity)||'kWh)</text>');
|
|
htp.print('<text x="20" y="147">Gas Flowed ('||TO_CHAR(p_gasflowed)||'kWh)</text>');
|
|
htp.print('<text x="20" y="172">Remaining Flow ('||TO_CHAR(p_remainflow)||'kWh)</text>');
|
|
htp.print('</g>');
|
|
htp.print('</svg>');
|
|
end piechart;
|
|
|
|
procedure barchart is
|
|
begin
|
|
--'Content-type: image/svg+xml'
|
|
owa_util.mime_header('image/svg+xml', true, 'iso-8859-4');
|
|
htp.print('<?xml version="1.0" standalone="no"?>');
|
|
htp.print('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" ');
|
|
htp.print(' "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">');
|
|
htp.print('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">');
|
|
htp.print(' <style type="text/css">');
|
|
htp.print(' rect:hover {fill-opacity:0.9;}');
|
|
htp.print(' </style>');
|
|
htp.print(' <g style="fill-opacity:0.7;">');
|
|
htp.print('');
|
|
htp.print('<linearGradient id="bargradient" x1="0%" y1="0%" x2="0%" y2="100%">');
|
|
htp.print('<stop offset="0%" style="stop-color:#336699;"/>');
|
|
htp.print('<stop offset="100%" style="stop-color:rgb(255,255,255);"/>');
|
|
htp.print('</linearGradient>');
|
|
htp.print('<rect x="80" y=".1" width="475" height="100" fill="none" stroke="blue" stroke-width=".2" /> ');
|
|
htp.print('<line x1="75" y1="10" x2="555" y2="10" stroke-width=".2" stroke="blue" />');
|
|
htp.print('<line x1="75" y1="20" x2="555" y2="20" stroke-width=".2" stroke="blue" />');
|
|
htp.print('<line x1="75" y1="30" x2="555" y2="30" stroke-width=".2" stroke="blue" />');
|
|
htp.print('<line x1="75" y1="40" x2="555" y2="40" stroke-width=".2" stroke="blue" />');
|
|
htp.print('<line x1="75" y1="50" x2="555" y2="50" stroke-width=".2" stroke="blue" />');
|
|
htp.print('<line x1="75" y1="60" x2="555" y2="60" stroke-width=".2" stroke="blue" />');
|
|
htp.print('<line x1="75" y1="70" x2="555" y2="70" stroke-width=".2" stroke="blue" />');
|
|
htp.print('<line x1="75" y1="80" x2="555" y2="80" stroke-width=".2" stroke="blue" />');
|
|
htp.print('<line x1="75" y1="90" x2="555" y2="90" stroke-width=".2" stroke="blue" />');
|
|
htp.print('');
|
|
--htp.print('<line x1="75" y1="43" x2="555" y2="43" stroke-width="1" stroke="yellow" style="fill-opacity:0.9;" />');
|
|
-- htp.print('<line x1="75" y1="78" x2="555" y2="78" stroke-width="1" stroke="red" />');
|
|
htp.print('');
|
|
htp.print('<rect x="85" y="10" width="10" height="90" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="100" y="40" width="10" height="60" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="115" y="30" width="10" height="70" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="130" y="20" width="10" height="80" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="145" y="10" width="10" height="90" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="160" y="10" width="10" height="90" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="175" y="80" width="10" height="20" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="190" y="90" width="10" height="10" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="205" y="10" width="10" height="90" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="220" y="70" width="10" height="30" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="235" y="60" width="10" height="40" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="250" y="70" width="10" height="30" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="265" y="80" width="10" height="20" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="280" y="90" width="10" height="10" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="295" y="20" width="10" height="80" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="310" y="40" width="10" height="60" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="325" y="70" width="10" height="30" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="340" y="80" width="10" height="20" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="355" y="5" width="10" height="95" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="370" y="25" width="10" height="75" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="385" y="65" width="10" height="35" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="400" y="45" width="10" height="55" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="415" y="85" width="10" height="15" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="430" y="30" width="10" height="70" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="445" y="55" width="10" height="45" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="460" y="5" width="10" height="95" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="475" y="25" width="10" height="75" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="490" y="30" width="10" height="70" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="505" y="10" width="10" height="90" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="520" y="45" width="10" height="55" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('<rect x="535" y="25" width="10" height="75" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
htp.print('');
|
|
htp.print('<line x1="80" y1="43" x2="555" y2="43" stroke-width="0.2" stroke="yellow" />');
|
|
htp.print('<line x1="80" y1="78" x2="555" y2="78" stroke-width="0.2" stroke="red" />');
|
|
htp.print('');
|
|
htp.print(' </g>');
|
|
htp.print('<g style="font-family: Verdana; font-size:12px;">');
|
|
htp.print('<text id="key1" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(0,55)">Million</text>');
|
|
htp.print('<text id="key2" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(0,70)">KWh</text>');
|
|
htp.print('<text id="scale0" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,105)">0</text> ');
|
|
htp.print('<text id="scale1" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,95)">100</text>');
|
|
htp.print('<text id="scale2" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,85)">200</text>');
|
|
htp.print('<text id="scale3" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,75)">300</text>');
|
|
htp.print('<text id="scale4" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,65)">400</text>');
|
|
htp.print('<text id="scale5" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,55)">500</text>');
|
|
htp.print('<text id="scale6" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,45)">600</text>');
|
|
htp.print('<text id="scale7" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,35)">700</text>');
|
|
htp.print('<text id="scale8" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,25)">800</text>');
|
|
htp.print('<text id="scale9" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,15)">900</text>');
|
|
htp.print('');
|
|
htp.print('');
|
|
htp.print('');
|
|
htp.print('<text id="date1" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(95,180) rotate(270)">01/06</text>');
|
|
htp.print('<text id="date2" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(110,180) rotate(270)">02/06</text>');
|
|
htp.print('<text id="date3" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(125,180) rotate(270)">03/06</text>');
|
|
htp.print('<text id="date4" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(140,180) rotate(270)">04/06</text>');
|
|
htp.print('<text id="date5" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(155,180) rotate(270)">05/06</text>');
|
|
htp.print('<text id="date6" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(170,180) rotate(270)">06/06</text>');
|
|
htp.print('<text id="date7" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(185,180) rotate(270)">07/06</text>');
|
|
htp.print('<text id="date8" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(200,180) rotate(270)">08/06</text>');
|
|
htp.print('<text id="date9" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(215,180) rotate(270)">09/06</text>');
|
|
htp.print('<text id="date10" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(230,180) rotate(270)">10/06</text>');
|
|
htp.print('<text id="date11" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(245,180) rotate(270)">11/06</text>');
|
|
htp.print('<text id="date12" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(260,180) rotate(270)">12/06</text>');
|
|
htp.print('<text id="date13" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(275,180) rotate(270)">13/06</text>');
|
|
htp.print('<text id="date14" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(290,180) rotate(270)">14/06</text>');
|
|
htp.print('<text id="date15" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(305,180) rotate(270)">15/06</text>');
|
|
htp.print('<text id="date16" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(320,180) rotate(270)">16/06</text>');
|
|
htp.print('<text id="date17" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(335,180) rotate(270)">17/06</text>');
|
|
htp.print('<text id="date18" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(350,180) rotate(270)">18/06</text>');
|
|
htp.print('<text id="date19" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(365,180) rotate(270)">19/06</text>');
|
|
htp.print('<text id="date20" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(380,180) rotate(270)">20/06</text>');
|
|
htp.print('<text id="date21" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(395,180) rotate(270)">21/06</text>');
|
|
htp.print('<text id="date22" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(410,180) rotate(270)">22/06</text>');
|
|
htp.print('<text id="date23" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(425,180) rotate(270)">23/06</text>');
|
|
htp.print('<text id="date24" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(440,180) rotate(270)">24/06</text>');
|
|
htp.print('<text id="date25" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(455,180) rotate(270)">25/06</text>');
|
|
htp.print('<text id="date26" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(470,180) rotate(270)">26/06</text>');
|
|
htp.print('<text id="date27" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(485,180) rotate(270)">27/06</text>');
|
|
htp.print('<text id="date28" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(500,180) rotate(270)">28/06</text>');
|
|
htp.print('<text id="date29" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(515,180) rotate(270)">29/06</text>');
|
|
htp.print('<text id="date30" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(530,180) rotate(270)">30/06</text>');
|
|
htp.print('<text id="date31" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(545,180) rotate(270)">01/07</text>');
|
|
htp.print('</g>');
|
|
htp.print('');
|
|
htp.print('</svg>');
|
|
htp.print('');
|
|
--
|
|
END barchart;
|
|
--
|
|
/* PROCEDURE barchart2 IS
|
|
--
|
|
-- l_tab_inv is table of:
|
|
-- l_date
|
|
-- l_inventory
|
|
-- l_max_cap
|
|
-- l_min_cap
|
|
--
|
|
l_tab_inv lihp_home_page.t_tab_inv;
|
|
--
|
|
-- Fudged the number just a little...
|
|
--
|
|
l_max_qty NUMBER := 900000000;
|
|
--
|
|
l_x_start NUMBER := 80;
|
|
l_width NUMBER := 18;
|
|
l_x_step NUMBER := 8;
|
|
--
|
|
l_y_start NUMBER := 9.1;
|
|
l_y_step NUMBER := 14;
|
|
l_height NUMBER := 138;
|
|
--
|
|
BEGIN
|
|
--
|
|
owa_util.mime_header('image/svg+xml', true, 'iso-8859-4');
|
|
--
|
|
htp.print('<?xml version="1.0" standalone="no"?>');
|
|
htp.print('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" ');
|
|
htp.print(' "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">');
|
|
htp.print('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">');
|
|
--
|
|
htp.print(' <style type="text/css">');
|
|
htp.print(' rect:hover {fill-opacity:0.9;}');
|
|
htp.print(' </style>');
|
|
--
|
|
htp.print(' <g style="fill-opacity:0.7;">');
|
|
htp.print('');
|
|
--
|
|
htp.print('<linearGradient id="bargradient" x1="0%" y1="0%" x2="0%" y2="100%">');
|
|
htp.print('<stop offset="0%" style="stop-color:#336699;"/>');
|
|
htp.print('<stop offset="100%" style="stop-color:rgb(255,255,255);"/>');
|
|
htp.print('</linearGradient>');
|
|
--
|
|
-- Get Data
|
|
--
|
|
l_tab_inv := lihp_home_page.inventory_details;
|
|
--
|
|
-- Print the boundary
|
|
--
|
|
htp.print('<rect x="0" y="0" width="'||TO_CHAR((l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step)+260)||'" height="'||TO_CHAR(l_height+50)||'" fill="none" stroke="black" stroke-width=".3" /> ');
|
|
--
|
|
-- Y axis lines
|
|
--
|
|
htp.print('<rect x="'||TO_CHAR(l_x_start)||'" y="'||l_y_start||'" width="'||TO_CHAR((l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step))||'" height="'||l_height||'" fill="none" stroke="blue" stroke-width=".2" /> ');
|
|
--
|
|
-- Print the lines
|
|
--
|
|
FOR i IN 1..9 LOOP
|
|
--
|
|
htp.print('<line x1="'||TO_CHAR(l_x_start-5)||'" y1="'||TO_CHAR((i*l_y_step)+l_y_start)||'" x2="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step))||'" y2="'||TO_CHAR((i*l_y_step)+l_y_start)||'" stroke-width=".2" stroke="blue" />');
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.print('');
|
|
htp.print('');
|
|
--
|
|
-- Data
|
|
--
|
|
FOR i IN 1..l_tab_inv.COUNT LOOP
|
|
--
|
|
htp.print('<rect x="'||TO_CHAR((l_x_start+l_x_step)+((l_width+l_x_step)*(i-1)))||'" y="'||TO_CHAR(l_height+l_y_start-((l_tab_inv(i).l_inventory/l_max_qty)*l_height))||'" width="'||l_width||'" height="'||TO_CHAR((l_tab_inv(i).l_inventory/l_max_qty)*l_height)||'" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.print('');
|
|
--
|
|
-- Max line
|
|
--
|
|
htp.p('<polyline fill="none" stroke="red" stroke-width="0.5" points="');
|
|
--
|
|
FOR i IN 1..l_tab_inv.COUNT LOOP
|
|
--
|
|
IF i > 1 AND l_tab_inv(i).l_max_cap <> l_tab_inv(i-1).l_max_cap THEN
|
|
--
|
|
htp.p(TO_CHAR(l_x_start+(l_x_step/2)+(((l_width+l_x_step)*(i-1))))||','||TO_CHAR(l_height+l_y_start-((l_tab_inv(i-1).l_max_cap/l_max_qty)*l_height)));
|
|
--
|
|
END IF;
|
|
--
|
|
IF i > 1 THEN
|
|
htp.p(TO_CHAR(l_x_start+(l_x_step/2)+(((l_width+l_x_step)*(i-1))))||','||TO_CHAR(l_height+l_y_start-((l_tab_inv(i).l_max_cap/l_max_qty)*l_height)));
|
|
ELSE
|
|
htp.p(TO_CHAR(l_x_start+(((l_width+l_x_step)*(i-1))))||','||TO_CHAR(l_height+l_y_start-((l_tab_inv(i).l_max_cap/l_max_qty)*l_height)));
|
|
END IF;
|
|
--
|
|
IF i = l_tab_inv.LAST THEN
|
|
--
|
|
htp.p(TO_CHAR(l_x_start+(((l_width+l_x_step)*(i-1)))+(l_x_step+l_width+l_x_step))||','||TO_CHAR(l_height+l_y_start-((l_tab_inv(i).l_max_cap/l_max_qty)*l_height)));
|
|
--
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.p('" />');
|
|
--
|
|
htp.print('<line x1="'||TO_CHAR(l_x_start)||'" y1="'||TO_CHAR(l_height+l_y_start-((l_tab_inv(1).l_min_cap/l_max_qty)*l_height))||'" x2="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step))||'" y2="'||TO_CHAR(l_height+l_y_start-((l_tab_inv(1).l_min_cap/l_max_qty)*l_height))||'" stroke-width="0.5" stroke="green" />');
|
|
htp.print('');
|
|
htp.print(' </g>');
|
|
--
|
|
-- Y axis labels
|
|
--
|
|
htp.print('<g style="font-family: Verdana; font-size:12px;">');
|
|
htp.print('<text id="key2" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(5,'||TO_CHAR((l_height/2)+5)||')">GWh</text>');
|
|
--
|
|
FOR i IN 0..9 LOOP
|
|
--
|
|
htp.print('<text id="scale'||TO_CHAR(i)||'" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,'||TO_CHAR((l_height + 5)-(l_y_step*i))||')">'||TO_CHAR((l_max_qty/9000000)*i)||'</text> ');
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.print('');
|
|
htp.print('');
|
|
htp.print('');
|
|
--
|
|
-- X axis labels
|
|
--
|
|
FOR i IN 1..l_tab_inv.COUNT LOOP
|
|
--
|
|
htp.print('<text id="date'||TO_CHAR(i)||'" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate('||TO_CHAR(l_x_start+(i*(l_x_step + l_width))-4)||','||TO_CHAR(l_height+40+l_y_start)||') rotate(270)">'||TO_CHAR(l_tab_inv(i).l_date, 'DD/MM')||'</text>');
|
|
--
|
|
END LOOP;
|
|
--
|
|
-- Legends
|
|
--
|
|
htp.print('<text x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))||'" y="'||TO_CHAR(10++l_y_start)||'" font-weight="bold">'||'Inventory Summary</text>');
|
|
htp.print('<rect x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))||'" y="'||TO_CHAR(20++l_y_start)||'" height="15" width="15" style="fill:url(#bargradient); stroke:black; stroke-width:0.5"/>');
|
|
htp.print('<text x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2)+20)||'" y="'||TO_CHAR(32++l_y_start)||'">'||'Inventory</text>');
|
|
htp.print('<rect x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))||'" y="'||TO_CHAR(40++l_y_start)||'" height="15" width="15" style="fill:white; stroke:black; stroke-width:0.5"/>');
|
|
htp.print('<line x1="'||TO_CHAR((l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))+2)||'" y1="'||TO_CHAR(47.5++l_y_start)||'" x2="'||TO_CHAR((l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2)+13))||'" y2="'||TO_CHAR(47.5++l_y_start)||'" stroke-width="0.75" stroke="red" />');
|
|
htp.print('<text x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2)+20)||'" y="'||TO_CHAR(52++l_y_start)||'">'||'Maximum Capacity</text>');
|
|
htp.print('<rect x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))||'" y="'||TO_CHAR(60++l_y_start)||'" height="15" width="15" style="fill:white; stroke:black; stroke-width:0.5"/>');
|
|
htp.print('<line x1="'||TO_CHAR((l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))+2)||'" y1="'||TO_CHAR(67.5++l_y_start)||'" x2="'||TO_CHAR((l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2)+13))||'" y2="'||TO_CHAR(67.5++l_y_start)||'" stroke-width="0.75" stroke="green" />');
|
|
htp.print('<text x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2)+20)||'" y="'||TO_CHAR(72++l_y_start)||'">'||'Minimum Inventory</text>');
|
|
|
|
--
|
|
htp.print('</g>');
|
|
htp.print('');
|
|
htp.print('</svg>');
|
|
htp.print('');
|
|
--
|
|
END barchart2;*/
|
|
--
|
|
--
|
|
--
|
|
PROCEDURE piechart2 ( p_pie_tab IN t_pie_tab ) IS
|
|
--
|
|
l_degrees NUMBER;
|
|
l_arcx NUMBER;
|
|
l_arcy NUMBER;
|
|
l_x_startdegrees NUMBER;
|
|
l_enddegrees NUMBER;
|
|
l_wedgesize NUMBER;
|
|
l_largearcflag INTEGER := 0;
|
|
l_svgtext VARCHAR2(4000);
|
|
--
|
|
l_x_origin NUMBER := 100;
|
|
l_y_origin NUMBER := 110;
|
|
l_radius NUMBER := 80;
|
|
--
|
|
BEGIN
|
|
--'Content-type: image/svg+xml'
|
|
owa_util.mime_header('image/svg+xml', true, 'iso-8859-4');
|
|
htp.print('<?xml version="1.0" standalone="no"?>');
|
|
htp.print('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">');
|
|
htp.print('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">');
|
|
htp.print(' <g style="fill-opacity:0.99; font-family: Verdana; font-size:11px;">');
|
|
--
|
|
-- Outer box
|
|
--
|
|
htp.print('<rect x="0" y="0" height="301" width="199" style="fill:#FFFFFF; stroke:black; stroke-width:0.5"/>');
|
|
--
|
|
-- Piechart Stuff
|
|
--
|
|
l_degrees := 270;
|
|
--
|
|
FOR i IN 2..p_pie_tab.COUNT LOOP
|
|
--
|
|
l_x_startdegrees := ROUND(l_degrees);
|
|
--
|
|
-- Figure out the angle (in degrees) of our current cheese
|
|
--
|
|
l_wedgesize := ( p_pie_tab(i).l_quantity / p_pie_tab(1).l_quantity ) * 360;
|
|
l_degrees := l_degrees + l_wedgesize;
|
|
l_enddegrees := ROUND(l_degrees);
|
|
--
|
|
-- If one of our cheeses is 180 or bigger we need to set the large arc flag
|
|
-- other with the arc (A) won't draw it correctly
|
|
--
|
|
IF l_wedgesize > 359 THEN
|
|
--
|
|
htp.print('<circle cx="'||TO_CHAR(l_x_origin)||'" cy="'||TO_CHAR(l_y_origin)||'" r="'||TO_CHAR(l_radius)||'" style="fill:#' ||
|
|
colour_palette(i-1) || '; stroke:black; stroke-width:1;"/>');
|
|
--
|
|
ELSE
|
|
--
|
|
IF l_wedgesize >= 180 THEN
|
|
--
|
|
l_largearcflag := 1;
|
|
--
|
|
ELSE
|
|
--
|
|
l_largearcflag := 0;
|
|
--
|
|
END IF;
|
|
--
|
|
l_svgtext :='<path d="';
|
|
--start at center of circle
|
|
l_svgtext := l_svgtext ||'M '||TO_CHAR(l_x_origin)||','||TO_CHAR(l_y_origin)||' ';
|
|
--draw out to circle edge
|
|
l_arcx := circle_pointx(l_x_startdegrees, l_radius*2);
|
|
l_arcy := circle_pointy(l_x_startdegrees, l_radius*2);
|
|
--
|
|
l_svgtext := l_svgtext || 'L' || FLOOR(l_x_origin + l_arcx) || ','||FLOOR(l_y_origin + l_arcy);
|
|
--draw arc
|
|
l_arcx := circle_pointx(l_enddegrees, l_radius*2); --get x point of the arc
|
|
l_arcy := circle_pointy(l_enddegrees, l_radius*2); --get y point of the arc
|
|
--
|
|
l_svgtext := l_svgtext||' A '||TO_CHAR(l_radius)||','||TO_CHAR(l_radius)||' 0 ' || l_largearcflag || ' 1 ' || FLOOR(l_x_origin + l_arcx) ||
|
|
',' || FLOOR(l_y_origin + l_arcy) || ' z" style="fill:#' ||
|
|
colour_palette(i-1) || '; fill-opacity: .99; stroke:black; stroke-width:1;" />';
|
|
--print out the svg path tag
|
|
htp.p(l_svgtext);
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
-- Print pie title
|
|
--
|
|
htp.print('<text x="100" y="15" text-anchor="middle" font-weight="bold">'||p_pie_tab(1).l_descr||'</text>');
|
|
--
|
|
-- Print Legend
|
|
--
|
|
FOR j IN 2..p_pie_tab.COUNT LOOP
|
|
--
|
|
htp.print('<rect x="4" y="'||TO_CHAR((l_y_origin+l_radius+30)+(25*(j-2)))||'" height="15" width="15" style="fill:#'||colour_palette(j-1)||'; stroke:black; stroke-width:0.5"/>');
|
|
htp.print('<text x="22" y="'||TO_CHAR((l_y_origin+l_radius+40)+(25*(j-2)))||'">'||p_pie_tab(j).l_descr||' ('||TO_CHAR(p_pie_tab(j).l_quantity)||'kWh)</text>');
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.print('</g>');
|
|
htp.print('</svg>');
|
|
--
|
|
END piechart2;
|
|
--
|
|
--
|
|
--
|
|
/*PROCEDURE barchart3(p_type IN VARCHAR2 DEFAULT 'A') IS
|
|
--
|
|
-- l_tab_inv is table of:
|
|
-- l_date
|
|
-- l_inventory
|
|
-- l_max_cap
|
|
-- l_min_cap
|
|
--
|
|
l_tab_inv lihp_home_page.t_tab_inv;
|
|
--
|
|
-- Fudged the number just a little...
|
|
--
|
|
l_max_qty NUMBER := 900000000;
|
|
--
|
|
l_x_start NUMBER := 80;
|
|
l_width NUMBER := 18;
|
|
l_x_step NUMBER := 8;
|
|
--
|
|
l_y_start NUMBER := 9.1;
|
|
l_y_step NUMBER := 14;
|
|
l_height NUMBER := 146;
|
|
--
|
|
l_idx NUMBER;
|
|
--
|
|
BEGIN
|
|
--
|
|
owa_util.mime_header('image/svg+xml', true, 'iso-8859-4');
|
|
--
|
|
htp.print('<?xml version="1.0" standalone="no"?>');
|
|
htp.print('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" ');
|
|
htp.print(' "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">');
|
|
htp.print('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">');
|
|
--
|
|
htp.print(' <style type="text/css">');
|
|
htp.print(' rect:hover {fill-opacity:0.9;}');
|
|
htp.print(' </style>');
|
|
--
|
|
htp.print(' <g style="fill-opacity:0.7;">');
|
|
htp.print('');
|
|
--
|
|
htp.print('<linearGradient id="bargradient" x1="0%" y1="0%" x2="0%" y2="100%">');
|
|
htp.print('<stop offset="0%" style="stop-color:#336699;"/>');
|
|
htp.print('<stop offset="100%" style="stop-color:rgb(255,255,255);"/>');
|
|
htp.print('</linearGradient>');
|
|
--
|
|
htp.print('<linearGradient id="currentgradient" x1="0%" y1="0%" x2="0%" y2="100%">');
|
|
htp.print('<stop offset="0%" style="stop-color:#cc0033;"/>');
|
|
htp.print('<stop offset="100%" style="stop-color:rgb(255,255,255);"/>');
|
|
htp.print('</linearGradient>');
|
|
--
|
|
-- Get Data
|
|
--
|
|
IF p_type = 'A' THEN
|
|
--
|
|
l_tab_inv := lihp_home_page.inventory_details;
|
|
--
|
|
ELSIF p_type = 'B' THEN
|
|
--
|
|
l_tab_inv := lihp_home_page.all_inventory_details;
|
|
--
|
|
l_max_qty := 1800000000;
|
|
--
|
|
ELSIF p_type = 'C' THEN
|
|
--
|
|
lihp_home_page.g_start_date := (TRUNC(SYSDATE) - 14) + (cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24);
|
|
lihp_home_page.g_end_date := (TRUNC(SYSDATE) + 14) + (cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24);
|
|
--
|
|
l_tab_inv := lihp_home_page.inventory_details;
|
|
--
|
|
l_width := 9;
|
|
l_x_step := 5;
|
|
--
|
|
END IF;
|
|
--
|
|
-- Print the boundary
|
|
--
|
|
htp.print('<rect x="0" y="0" width="'||TO_CHAR((l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step)+260)||'" height="'||TO_CHAR(l_height+50)||'" fill="none" stroke="black" stroke-width=".3" /> ');
|
|
--
|
|
-- Y axis lines
|
|
--
|
|
htp.print('<rect x="'||TO_CHAR(l_x_start)||'" y="'||l_y_start||'" width="'||TO_CHAR((l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step))||'" height="'||l_height||'" fill="none" stroke="blue" stroke-width=".2" /> ');
|
|
--
|
|
-- Print the lines
|
|
--
|
|
FOR i IN 1..9 LOOP
|
|
--
|
|
htp.print('<line x1="'||TO_CHAR(l_x_start-5)||'" y1="'||TO_CHAR((i*l_y_step)+l_y_start)||'" x2="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step))||'" y2="'||TO_CHAR((i*l_y_step)+l_y_start)||'" style="stroke: grey; stroke-width: 0.1;" />');
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.print('');
|
|
htp.print('');
|
|
--
|
|
-- Data
|
|
--
|
|
l_idx := l_tab_inv.FIRST;
|
|
--
|
|
FOR z IN 1..l_tab_inv.COUNT LOOP
|
|
--
|
|
IF TRUNC(l_tab_inv(l_idx).l_date) = TRUNC(SYSDATE) THEN
|
|
htp.print('<rect x="'||TO_CHAR((l_x_start+l_x_step)+((l_width+l_x_step)*(z-1)))||'" y="'||TO_CHAR(l_height+l_y_start-((l_tab_inv(l_idx).l_inventory/l_max_qty)*l_height))||'" width="'||l_width||'" height="'||TO_CHAR((l_tab_inv(l_idx).l_inventory/l_max_qty)*l_height)||'" fill="url(#currentgradient)" stroke="black" stroke-width=".2" /> ');
|
|
ELSE
|
|
htp.print('<rect x="'||TO_CHAR((l_x_start+l_x_step)+((l_width+l_x_step)*(z-1)))||'" y="'||TO_CHAR(l_height+l_y_start-((l_tab_inv(l_idx).l_inventory/l_max_qty)*l_height))||'" width="'||l_width||'" height="'||TO_CHAR((l_tab_inv(l_idx).l_inventory/l_max_qty)*l_height)||'" fill="url(#bargradient)" stroke="black" stroke-width=".2" /> ');
|
|
END IF;
|
|
--
|
|
l_idx := l_tab_inv.NEXT(l_idx);
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.print('');
|
|
--
|
|
-- Max line
|
|
--
|
|
htp.p('<polyline fill="none" stroke="red" stroke-width="1.5" points="');
|
|
--
|
|
l_idx := l_tab_inv.FIRST;
|
|
--
|
|
FOR z IN 1..l_tab_inv.COUNT LOOP
|
|
--
|
|
IF z > 1 AND l_tab_inv(l_idx).l_max_cap <> l_tab_inv(l_tab_inv.PRIOR(l_idx)).l_max_cap THEN
|
|
--
|
|
htp.p(TO_CHAR(l_x_start+(l_x_step/2)+(((l_width+l_x_step)*(z-1))))||','||TO_CHAR(l_height+l_y_start-((l_tab_inv(l_tab_inv.PRIOR(l_idx)).l_max_cap/l_max_qty)*l_height)));
|
|
--
|
|
END IF;
|
|
--
|
|
IF z > 1 THEN
|
|
htp.p(TO_CHAR(l_x_start+(l_x_step/2)+(((l_width+l_x_step)*(z-1))))||','||TO_CHAR(l_height+l_y_start-((l_tab_inv(l_idx).l_max_cap/l_max_qty)*l_height)));
|
|
ELSE
|
|
htp.p(TO_CHAR(l_x_start+(((l_width+l_x_step)*(z-1))))||','||TO_CHAR(l_height+l_y_start-((l_tab_inv(l_idx).l_max_cap/l_max_qty)*l_height)));
|
|
END IF;
|
|
--
|
|
IF l_idx = l_tab_inv.LAST THEN
|
|
--
|
|
htp.p(TO_CHAR(l_x_start+(((l_width+l_x_step)*(z-1)))+(l_x_step+l_width+l_x_step))||','||TO_CHAR(l_height+l_y_start-((l_tab_inv(l_idx).l_max_cap/l_max_qty)*l_height)));
|
|
--
|
|
END IF;
|
|
--
|
|
l_idx := l_tab_inv.NEXT(l_idx);
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.p('" />');
|
|
--
|
|
htp.print('<line x1="'||TO_CHAR(l_x_start)||'" y1="'||TO_CHAR(l_height+l_y_start-((l_tab_inv(l_tab_inv.FIRST).l_min_cap/l_max_qty)*l_height))||'" x2="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step))||'" y2="'||TO_CHAR(l_height+l_y_start-((l_tab_inv(l_tab_inv.FIRST).l_min_cap/l_max_qty)*l_height))||'" stroke-width="1.5" stroke="green" />');
|
|
htp.print('');
|
|
htp.print(' </g>');
|
|
--
|
|
-- Y axis labels
|
|
--
|
|
htp.print('<g style="font-family: Verdana; font-size:12px;">');
|
|
htp.print('<text id="key2" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(5,'||TO_CHAR((l_height/2)+5)||')">GWh</text>');
|
|
--
|
|
FOR i IN 0..9 LOOP
|
|
--
|
|
htp.print('<text id="scale'||TO_CHAR(i)||'" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate(45,'||TO_CHAR((l_height + 5)-(l_y_step*i))||')">'||TO_CHAR((l_max_qty/9000000)*i)||'</text> ');
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.print('');
|
|
htp.print('');
|
|
htp.print('');
|
|
--
|
|
-- X axis labels
|
|
--
|
|
l_idx := l_tab_inv.FIRST;
|
|
--
|
|
FOR i IN 1..l_tab_inv.COUNT LOOP
|
|
--
|
|
htp.print('<text id="date'||TO_CHAR(i)||'" style="0: 10; fill: rgb(80,80,80)" type="path" x="0" y="0" transform="translate('||TO_CHAR(l_x_start+(i*(l_x_step + l_width))-4)||','||TO_CHAR(l_height+40+l_y_start)||') rotate(270)">'||TO_CHAR(l_tab_inv(l_idx).l_date, 'DD/MM')||'</text>');
|
|
--
|
|
l_idx := l_tab_inv.NEXT(l_idx);
|
|
--
|
|
END LOOP;
|
|
--
|
|
-- Legends
|
|
--
|
|
--htp.print('<text x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))||'" y="'||TO_CHAR(10++l_y_start)||'" font-weight="bold">'||'Inventory Summary</text>');
|
|
htp.print('<rect x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))||'" y="'||TO_CHAR(20++l_y_start)||'" height="15" width="15" style="fill:url(#bargradient); stroke:black; stroke-width:0.5"/>');
|
|
htp.print('<text x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2)+20)||'" y="'||TO_CHAR(32++l_y_start)||'">'||'Inventory</text>');
|
|
htp.print('<rect x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))||'" y="'||TO_CHAR(40++l_y_start)||'" height="15" width="15" style="fill:white; stroke:black; stroke-width:0.5"/>');
|
|
htp.print('<line x1="'||TO_CHAR((l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))+2)||'" y1="'||TO_CHAR(47.5++l_y_start)||'" x2="'||TO_CHAR((l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2)+13))||'" y2="'||TO_CHAR(47.5++l_y_start)||'" stroke-width="1.5" stroke="red" />');
|
|
htp.print('<text x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2)+20)||'" y="'||TO_CHAR(52++l_y_start)||'">'||'Maximum Capacity</text>');
|
|
htp.print('<rect x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))||'" y="'||TO_CHAR(60++l_y_start)||'" height="15" width="15" style="fill:white; stroke:black; stroke-width:0.5"/>');
|
|
htp.print('<line x1="'||TO_CHAR((l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2))+2)||'" y1="'||TO_CHAR(67.5++l_y_start)||'" x2="'||TO_CHAR((l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2)+13))||'" y2="'||TO_CHAR(67.5++l_y_start)||'" stroke-width="1.5" stroke="green" />');
|
|
htp.print('<text x="'||TO_CHAR(l_x_start + (l_tab_inv.COUNT*(l_width+l_x_step) + l_x_step*2)+20)||'" y="'||TO_CHAR(72++l_y_start)||'">'||'Minimum Inventory</text>');
|
|
--
|
|
htp.print('</g>');
|
|
htp.print('');
|
|
htp.print('</svg>');
|
|
htp.print('');
|
|
--
|
|
END barchart3;*/
|
|
--
|
|
--
|
|
--
|
|
PROCEDURE piechart3 IS
|
|
--
|
|
l_degrees NUMBER;
|
|
l_arcx NUMBER;
|
|
l_arcy NUMBER;
|
|
l_x_startdegrees NUMBER;
|
|
l_enddegrees NUMBER;
|
|
l_wedgesize NUMBER;
|
|
l_largearcflag INTEGER := 0;
|
|
l_svgtext VARCHAR2(4000);
|
|
--
|
|
l_x_origin NUMBER := 100;
|
|
l_y_origin NUMBER := 70;
|
|
l_radius NUMBER := 50;
|
|
--
|
|
l_height NUMBER := 197;
|
|
l_width NUMBER := 199;
|
|
--
|
|
l_description VARCHAR2(200);
|
|
l_procedure VARCHAR2(200);
|
|
--
|
|
BEGIN
|
|
--
|
|
-- Determine procedure due to problems with 10g
|
|
--
|
|
BEGIN
|
|
SELECT hoev.element_value
|
|
,hoev.element_procedure
|
|
INTO l_description
|
|
,l_procedure
|
|
FROM user_homepage usho
|
|
,homepage_element hoel
|
|
,homepage_element_value hoev
|
|
WHERE hoel.hoel_id = usho.hoel_id
|
|
AND hoev.hoev_id = usho.hoev_id
|
|
AND hoev.hoel_id = usho.hoel_id
|
|
AND UPPER(hoel.element_name) = UPPER('Piechart')
|
|
AND usho.syus_id = caco_utilities.get_syus_id;
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
NULL;
|
|
END;
|
|
--
|
|
IF l_procedure IS NOT NULL THEN
|
|
--
|
|
execute immediate 'begin svg.g_pie_tab := '||l_procedure||'; end;';
|
|
--
|
|
END IF;
|
|
--
|
|
IF g_pie_tab.COUNT > 0 THEN
|
|
--'Content-type: image/svg+xml'
|
|
owa_util.mime_header('image/svg+xml', true, 'iso-8859-4');
|
|
htp.print('<?xml version="1.0" standalone="no"?>');
|
|
htp.print('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">');
|
|
htp.print('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">');
|
|
htp.print(' <g style="fill-opacity:0.99; font-family: Verdana; font-size:11px;">');
|
|
--
|
|
-- Outer box
|
|
--
|
|
htp.print('<rect x="0" y="0" height="'||TO_CHAR(l_height)||'" width="'||TO_CHAR(l_width)||'" style="fill:#FFFFFF; stroke:black; stroke-width:0.5"/>');
|
|
--
|
|
-- Piechart Stuff
|
|
--
|
|
l_degrees := 270;
|
|
--
|
|
FOR i IN 2..g_pie_tab.COUNT LOOP
|
|
--
|
|
l_x_startdegrees := ROUND(l_degrees);
|
|
--
|
|
-- Figure out the angle (in degrees) of our current cheese
|
|
--
|
|
l_wedgesize := ( g_pie_tab(i).l_quantity / g_pie_tab(1).l_quantity ) * 360;
|
|
l_degrees := l_degrees + l_wedgesize;
|
|
l_enddegrees := ROUND(l_degrees);
|
|
--
|
|
-- If one of our cheeses is 180 or bigger we need to set the large arc flag
|
|
-- other with the arc (A) won't draw it correctly
|
|
--
|
|
IF l_wedgesize > 359 THEN
|
|
--
|
|
htp.print('<circle cx="'||TO_CHAR(l_x_origin)||'" cy="'||TO_CHAR(l_y_origin)||'" r="'||TO_CHAR(l_radius)||'" style="fill:#' ||
|
|
colour_palette(i-1) || '; stroke:black; stroke-width:1;"/>');
|
|
--
|
|
ELSE
|
|
--
|
|
IF l_wedgesize >= 180 THEN
|
|
--
|
|
l_largearcflag := 1;
|
|
--
|
|
ELSE
|
|
--
|
|
l_largearcflag := 0;
|
|
--
|
|
END IF;
|
|
--
|
|
l_svgtext :='<path d="';
|
|
--start at center of circle
|
|
l_svgtext := l_svgtext ||'M '||TO_CHAR(l_x_origin)||','||TO_CHAR(l_y_origin)||' ';
|
|
--draw out to circle edge
|
|
l_arcx := circle_pointx(l_x_startdegrees, l_radius*2);
|
|
l_arcy := circle_pointy(l_x_startdegrees, l_radius*2);
|
|
--
|
|
l_svgtext := l_svgtext || 'L' || FLOOR(l_x_origin + l_arcx) || ','||FLOOR(l_y_origin + l_arcy);
|
|
--draw arc
|
|
l_arcx := circle_pointx(l_enddegrees, l_radius*2); --get x point of the arc
|
|
l_arcy := circle_pointy(l_enddegrees, l_radius*2); --get y point of the arc
|
|
--
|
|
l_svgtext := l_svgtext||' A '||TO_CHAR(l_radius)||','||TO_CHAR(l_radius)||' 0 ' || l_largearcflag || ' 1 ' || FLOOR(l_x_origin + l_arcx) ||
|
|
',' || FLOOR(l_y_origin + l_arcy) || ' z" style="fill:#' ||
|
|
colour_palette(i-1) || '; fill-opacity: .99; stroke:black; stroke-width:1;" />';
|
|
--print out the svg path tag
|
|
htp.p(l_svgtext);
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
-- Print pie title
|
|
--
|
|
htp.print('<text x="100" y="15" text-anchor="middle" fill="red">'||g_pie_tab(1).l_descr||'</text>');
|
|
--
|
|
-- Print Legend
|
|
--
|
|
FOR j IN 2..g_pie_tab.COUNT LOOP
|
|
--
|
|
htp.print('<rect x="4" y="'||TO_CHAR((l_y_origin+l_radius+5)+(25*(j-2)))||'" height="15" width="15" style="fill:#'||colour_palette(j-1)||'; stroke:black; stroke-width:0.5"/>');
|
|
htp.print('<text x="22" y="'||TO_CHAR((l_y_origin+l_radius+16)+(25*(j-2)))||'">'||g_pie_tab(j).l_descr||' ('||TO_CHAR(g_pie_tab(j).l_quantity, 'FM999G999G999G999G999G999G990')||' '||g_pie_tab(1).l_units||')</text>');
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.print('</g>');
|
|
htp.print('</svg>');
|
|
--
|
|
END IF;
|
|
--
|
|
END piechart3;
|
|
--
|
|
END svg;
|
|
/
|
|
|