Oracle HTML DB includes built-in wizards for generating HTML and Scalable Vector Graphics (SVG) charts. Oracle HTML DB supports two types of graphical charts:
HTML
SVG
SVG is an XML-based language for Web graphics from the World Wide Web Consortium (W3C). SVG charts are defined using an embed tag. When evaluating whether or not a SVG chart is the appropriate chart type for your application remember that:
Some Web browsers do not support SVG charts.
Most Web browsers that support SVG charts require users download an SVG plug-in.
Topics:
The Adobe SVG plug-in can handle data encoded in UTF-8, UTF-16, ISO-8859-1, and US-ASCII. Encoding of an SVG chart is determined by the database access descriptor (DAD) database character set. If the DAD character set is not UTF8, AL32UTF8, AL16UTF16, WE8ISO8859P1, or US7ASCII, SVG charts may not render properly in the Adobe SVG plug-in.
You define a chart in Oracle HTML DB using a wizard. For most chart wizards, you select a chart type and provide a SQL query using the following syntax:
SELECT link, label, value FROM ...
Where:
link
is a URL.
label
is the text that displays in the bar.
value
is the numeric column that defines the bar size.
For example:
SELECT null, ename, sal FROM scott.emp WHERE deptno = :P101_DEPTNO
To create a dial chart, select a dial chart type and provide a SQL query using the following syntax:
SELECT value , maximum_value [ ,low_value [ ,high_value] ] FROM ...
Where:
value
is the starting point on the dial.
maximum_value
is the possible highest point on the dial.
low_value
and high_value
are the historical low and high values.
For example:
SELECT dbms_random.value(500, 1200), 1300, dbms_random.value(100, 200) FROM DUAL
Table 6-5 describes the chart types available in Oracle HTML DB.
Table 6-5 Available Chart Types
Chart Type | Description |
---|---|
Bar (HTML) |
Bar chart showing one data series with each data point represented by a bar. HTML-based. Does not require a plug-in. |
Bar, Horizontal |
Single series-based bar chart oriented horizontally with each data point in the series represented by a bar. SVG-based. Requires a SVG plug-in. |
Bar, Vertical |
Single series-based bar chart oriented vertically with each data point in series represented by a bar. SVG-based. Requires a SVG plug-in. |
Cluster Bar, Horizontal |
Multiple series-based bar chart oriented horizontally and clustered by a common variable with each data point in the series represented by a bar (for example, Department sales total clustered by month of year). SVG-based. Requires a SVG plug-in. |
Cluster Bar, Vertical |
Multiple series-based bar chart oriented vertically clustered by a common variable with each data point in series represented by a bar (for example, Department sales total clustered by month of year). SVG-based. Requires a SVG plug-in. |
Dial - Sweep |
Also known as an angular gauge; this chart shows either percentage of maximum value or absolute value compared to a maximum value represented as a solid area. SVG-based. Requires a SVG plug-in. |
Dial |
Also known as angular gauge; this chart shows either percentage of maximum value or absolute value compared to maximum value represented as a line. SVG-based. Requires a SVG plug-in. |
Line |
Multiple series-based line chart oriented with each line representing all data points in the series. SVG-based. Requires a SVG plug-in. |
Pie |
Single series-based pie chart with each slice representing a data point in the series. SVG-based. Requires a SVG plug-in. |
Stacked Bar, Horizontal |
Multiple series-based bar chart oriented horizontally with each data point being an absolute value in the series representing a segment of a single bar. SVG-based. Requires a SVG plug-in. |
Stacked Bar, Vertical |
Multiple series-based bar chart oriented vertically with each data point being an absolute value in the series representing a segment of a single bar. SVG-based. Requires a SVG plug-in. |
Stacked Percentage Bar, Horizontal |
Multiple series-based bar chart oriented horizontally with each data point being an percentage of 100% of the series represented by a segment of a single bar. SVG-based. Requires a SVG plug-in. |
Stacked Percentage Bar, Vertical |
Multiple series-based bar chart oriented vertically with each data point being an percentage of 100% of the series represented by a segment of a single bar SVG-based. Requires a SVG plug-in. |
Note: Do not change the type of an existing chart. Instead, delete the existing chart and then re-create it. |
How you create a chart depends upon whether you are adding the chart to an existing page, or adding a chart on a new page.
To add a chart to an existing page:
Navigate to the Page Definition:
Navigate to the Workspace home page.
Click the Application Builder icon.
Select an application.
Select a page.
The Page Definition appears.
Under Regions, click the Create icon.
The Create Region Wizard appears.
Select Chart.
Select the type of chart you want to create. See Table 6-5.
Follow the on-screen instructions.
To create a chart on a new page:
Navigate to the Workspace home page.
Click the Application Builder icon.
Select an application.
Click Create Page.
Select Chart.
Select the type of chart you want to create. See Table 6-5.
Follow the on-screen instructions.
Once you have created a chart, you can alter its display by editing chart attributes on the Chart Attributes page.
To access the Chart Attributes page:
Navigate to the Page Definition:
Navigate to the Workspace home page.
Click the Application Builder icon.
Select an application.
Select a page.
The Page Definition appears.
Under Regions, click Chart next to the name of the chart region you want to edit.
The Chart Attributes page appears.
Note that removing the chart title (that is, the Chart Title attribute) may negatively impact the location and display of the chart legend.
When you create a new chart, Oracle HTML DB renders it based on cascading style sheet (CSS) classes associated with the current theme. You can change the appearance of a chart by referencing another CSS or by overriding individual classes in the CSS section of the Edit Attributes page
The following sample contains the CSS classes for the dial chart in Sample Application. This example contains all the available CSS classes. Class names appear in boldface.
text{font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;fill:#000000;} tspan{font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;fill:#000000;} text.title{font-weight:bold;font-size:14;fill:#000000;} text.moredatafound{font-size:12;} rect.legend{fill:#EEEEEE;stroke:#000000;stroke-width:1;} text.legend{font-size:10;} #background{fill:#FFFFFF;stroke:none;} rect.chartholderbackground{fill:#ffffff;stroke:#000000;stroke-width:1;} #timestamp{text-anchor:start;font-size:9;} text.tic{stroke:none;fill:#000000;font-size:12} line.tic{stroke:#000000;stroke-width:1px;fill:none;} #dial{stroke:#336699;stroke-width:2px;fill:#336699;fill-opacity:.5;} #dial.alert{fill:#FF0000;fill-opacity:.5;} #dialbackground{stroke:#000000;stroke-width:none;fill:none;filter:url(#MyFilter);} #dialcenter{stroke:none;fill:#111111;filter:url(#MyFilter);} #dialbackground-border{stroke:#DDDDDD;stroke-width:2px;fill:none;filter:url (#MyFilter);}#low{stroke-width:3;stroke:#336699;} #high{stroke-width:3;stroke:#FF0000;} #XAxisTitle{letter-spacing:2;kerning:auto;font-size:14;fill:#000000;text-anchor:middle;} #YAxisTitle{letter-spacing:2;kerning:auto;font-size:14;fill:#000000;text-anchor:middle;writing-mode:tb;} .XAxisValue{font-size:8;fill:#000000;} .YAxisValue{font-size:8;fill:#000000;text-anchor:end;} .nodatafound{stroke:#000000;stroke-width:1;font-size:12;} .AxisLine{stroke:#000000;stroke-width:2;fill:#FFFFFF;} .GridLine{stroke:#000000;stroke-width:0.3;stroke-dasharray:2,4;fill:none;} g.dataholder rect{stroke:#000000;stroke-width:0.5;} .legenditem rect{stroke:#000000;stroke-width:0.5;}
Table 6-6 describes all supported CSS classes. Note that certain classes only apply to specific chart types.
Table 6-6 Available Chart CSS Classes
Class | Description |
---|---|
|
Defines the appearance of text that displays in a chart. |
|
Defines the appearance of text that displays in a chart. |
|
Overrides the default chart text. Use this class for title text. |
|
Defines the appearance of more datafound text. |
|
Creates the rectangular box that holds the chart legend. To a remove the legend border, change rect.legend{fill:#CCCC99;stroke:none;} |
|
Defines the text that appears in the chart legend. |
|
Creates the entire background for the SVG plug-in. For a solid white background with no border, change #background{fill:#FFFFFF;stroke:#FFFFFF;stroke-width:2;} |
|
Not applicable to pie and dial charts. Creates the background of the rectangle that holds the chart data. For a clear background, change rect.chartholderbackground(display:none;) |
|
Only applicable if the Asynchronous Update chart attribute is set to Yes. Controls the appearance of the update timestamp test. To disable the display of the timestamp, use defines "#timestamp{display:none;}" See Also: "Enabling Asynchronous Updates" |
|
Dial charts only. Defines the numbers on a dial chart. |
|
Dial charts only. Defines the graduation mark that displays directly beneath the number on a dial chart. |
|
Dial charts only. Defines the value that displays on the dial chart. |
|
Dial charts only. Defines a value (called an alert value) that renders on in a dial chart using a different display. |
|
Dial charts only. Creates the background of a dial chart. |
|
Dial charts only. Creates the center of the dial on a dial chart. |
|
Dial charts only. Works in conjunction with |
|
Dial charts only. Defines a historical low watermark of the data being displayed on a chart. |
|
Dial charts only. Defines historical high watermark of the data being displayed on a chart. |
|
Defines the title that appears on the x-axis |
|
Defines the title that appears on the y-axis. |
|
Defines the value that appears on the x-axis. |
|
Defines the value that appears on the y-axis. |
|
Similar to the axis value. |
|
Defines the text element that displays if no information is available. |
|
Indicates zero on charts that have negative values. |
. |
Creates the horizontal and vertical lines on the chart. |
|
Applies a blanket style to all data that displays in the chart. |
|
Applies a blanket style to all rectangular items in the legend. |
You can reference a custom cascading style sheet for a chart using the CSS section of the Chart Attributes page. When you reference an external CSS, you can reference it entirely or simply override specific styles.
To reference a custom chart CSS:
Upload the CSS to Oracle HTML DB. See "Uploading Cascading Style Sheets".
Create a chart. See "Creating a New Chart".
Navigate to the Page Definition:
Navigate to the Workspace home page.
Click the Application Builder icon.
Select an application.
Select a page.
The Page Definition appears.
Under Regions, click Chart next to the region name.
The Chart Attributes page appears.
Scroll down to the CSS section.
From Use Custom CSS, select Yes.
To reference an external CSS exclusively:
In Custom CSS, Link, enter a link to a custom CSS. For example:
#IMAGE_PREFIX#themes/theme_4/svg.css
Specify that the CSS should be used exclusively. In Custom CSS, Inline enter the following:
/**/
To reference a custom CSS and override specific styles:
In Custom CSS, Link, enter a link to a custom style sheet. For example:
#IMAGE_PREFIX#themes/theme_4/svg.css
In Custom CSS, Inline, enter the custom CSS styles you want to override.
You can override specific styles within the default CSS, using the Custom CSS, Inline attribute on the Chart Attributes page.
To override specific styles within the default CSS:
Create a chart. See "Creating a New Chart".
Navigate to the Page Definition:
Navigate to the Workspace home page.
Click the Application Builder icon.
Select an application.
Select a page.
The Page Definition appears.
Under Regions, click Chart next to the region name.
The Chart Attributes page appears.
Scroll down to CSS.
From Use Custom CSS, select Yes.
In Custom CSS, Inline, enter the custom CSS styles you want to override.
You can create charts that monitor information by enabling the Asynchronous Update attribute on the Chart attributes page. Enabling this attribute updates the chart to reflect changes in the underlying data within a specified time interval.
To enable asynchronous updates:
Create a chart. See Creating a New Chart.
Navigate to the Page Definition:
Navigate to the Workspace home page.
Click the Application Builder icon.
Select an application.
Select a page.
The Page Definition appears.
Under Regions, click Chart next to the region name.
The Chart Attributes page appears.
Scroll down to Refresh.
From Asynchronous Update, select Yes.
In Update Interval (Seconds), enter the interval in seconds between chart updates. For optimal performance, select an interval that is greater than 2 seconds.
When Asynchronous Update is enabled, a timestamp displays on the chart indicating that last update.
To disable the Asynchronous Update timestamp:
Navigate to the Chart Attributes page.
Locate the CSS section.
From Use Custom CSS, select Yes.
In Custom CSS, Inline edit #timestamp
as follows:
#timestamp{display:none;}
To display a chart in another language, you edit the text
and tspan
classes to reflect the correct language.
To display a chart in another language:
Navigate to the Chart Attributes page. See "Editing Chart Attributes".
Scroll down to CSS.
From Use Custom CSS, select Yes.
In Custom CSS, Inline, edit the text
and tspan
classes to reflect the correct language. The following example demonstrates how to change a chart to Korean:
text{font-family:Batang;fill:#000000;} tspan{font-family:Batang;fill:#000000;}