Oracle JET and Oracle APEX are best friends💕

Oracle JET and Oracle APEX are best friends  💕  

While Oracle JET is commonly associated with charts in Oracle APEX, it’s capable of much more. Oracle JET offers various tools and components for building modern web applications. The Oracle JET library required by APEX is included as part of the Oracle APEX, so there’s no need for additional installation. However, only the specific Oracle JET components used by APEX are built in, and advanced use cases require separately incorporating other parts of the full Oracle JET library. So if developers require additional JET components not bundled with APEX they should manually incorporate components into their APEX applications.

 What is Oracle JET?

Oracle JET (JavaScript Extension Toolkit) is a free, open-source toolkit for building modern, responsive, and accessible web applications. It leverages advanced JavaScript, HTML5, and CSS3 and incorporates popular libraries like jQuery, RequireJS, and Knockout.js technologies to provide a rich set of UI components. Oracle JET is a powerful tool for creating highly customizable and dynamic user interfaces.

Oracle JET is integrated into Oracle APEX, providing APEX developers access to its powerful visualization and UI components. Oracle JET libraries can be sourced directly from a CDN such as jsDelivr for standalone usage or custom implementations.

Relevant links for Oracle Jet:

https://cdn.jsdelivr.net/npm/@oracle/oraclejet@14.1.0/dist/js/libs/oj/min/

https://www.jsdelivr.com/ 

https://www.oracle.com/webfolder/technetwork/jet/index.html 

Where Oracle JET is Used in Oracle APEX

In APEX natively The Chart region is powered by Oracle JET and also The Text Field with Autocomplete item leverages Oracle JET to provide dynamic suggestions as users type.

1. Chart Regions

As I mentioned Oracle APEX uses Oracle JET to create charts. Let's take a look at a chart example and what we can do with Oracle Jet.
In your APEX application and one page create a chart and follow the below pictures.



            

SELECT DEPTNO AS label, SUM(sal) AS value FROM emp GROUP BY DEPTNO;


In the Chart Attributes, you can adjust Labels, Colors, Tooltip formatting, and Legends actually this way you are using the interactive JET chart in Oracle APEX.


But in some scenarios, built-in charts don’t meet your needs, you can create custom JET visualizations. For this purpose, you have two choices: 

1)The Initialization JavaScript Function in charts of Oracle APEX is a powerful feature that allows you to customize how an Oracle JET chart looks and behaves. You can write JavaScript to modify the Oracle JET chart's options.

you can check the below link and you will see what you can change in your chart. Attributes,Definition,...




function configureChart(options) {
    options.type = "line";

    options.styleDefaults = {
    colors: ["#1f77b4", "#ff7f0e", "#2ca02c"] };

    options.selectionMode = "multiple";
    options.drilling = "on";  // Enable drilling

    options.xAxis = {
        title: "Categories",

        labelStyle: {
            fontSize: "12px", 

            color: "#333"
        }

    };
    options.yAxis = {

        title: "Sales Amount", 
        labelStyle: {

            fontSize: "12px", 
            color: "#333"

        }
    };

    return options;
} 

2)  Create a region with static content type

 


put this code in HTML or set a staticID for your region
<div id="myChart" style="width: 100%; height: 400px;"></div>

then create a Dynamic Action for rendering 





    require(['ojs/ojchart', 'jquery'], function (ojChart, $) {
     var chartData = {
        series: [
            { name: 'Dept A', items: [10] },
            { name: 'Dept B', items: [20] },
            { name: 'Dept C', items: [30] }
        ],
        categories: ['Salery Amount']
    };


    $('#myChart').ojChart({
        type: 'bar',
        series: chartData.series,
        groups: chartData.categories,
        orientation: 'vertical'
    });   
});

 ...............................................

 require(['ojs/ojchart', 'jquery'], function (ojChart, $) {
    var chartData = {
        series: [
            { name: 'Category A', items: [42] },
            { name: 'Category B', items: [34] },
            { name: 'Category C', items: [24] }
        ]
    };

    $('#myChart').ojChart({ 

      type: 'pie',
        series: chartData.series
    });

 });

 ...............................................

    var chartType = $v('P2_CHART_TYPE');
    var chartData = {
        series: [
            { name: 'Category A', items: [42] },
            { name: 'Category B', items: [34] },
            { name: 'Category C', items: [24] }  ]
    };
    $('#myChart2').ojChart({
        type: chartType,
        series: chartData.series

    });


TIPS: explain the code 
 
  • require([...], function (...) {...}):
This function is part of RequireJS, a JavaScript module loader. It dynamically loads the specified modules (ojs/ojchart and jquery) and executes the code inside the callback function after the modules are loaded https://requirejs.org/ but APEX provides several libraries and modules (like ojcore, jquery, ojchart, etc.) that you can use directly within your pages.so you do not need require(['ojs/ojchart', 'jquery'], function (ojChart, $)  part of code in oracle apex for creating chart.
  • ojs/ojchart:
This is the Oracle JET Chart module used to create and customize charts. It includes various chart types like bar, pie, and line charts.
  • jquery:
The jQuery library is used for DOM manipulation and event handling.
  • Callback function (function (ojChart, $) {...}):
The loaded modules (ojChart and $) are passed as parameters to this function for use within the callback.

Comments

Popular posts from this blog

JavaScript In Oracle APEX (Client Side)

Installation of Oracle Database 23ai and APEX 24.2 and ORDS 24.4 on Windows Step-by-Step

Building a Fully Local AI-Powered Assistant with Oracle APEX and Vector Search #APEXCONN2025 #orclAPEX

Configuration of ORDS: Standalone, Tomcat, and WebLogic on Windows Step-by-Step

✔ RTL Map Region Labels APEX 24.2 & 🌍GeoCoding

Building an AI-Powered Resume Matching System Using Oracle APEX and 23ai Vector Search😎

Vector Tiles in Oracle Spatial 23

What is SYS.ODCI (SYS.ODCINumberList or SYS.ODCIVarchar2List) and How Can Use it in APEX ?

My Experience at Oracle CloudWorld Tour in Frankfurt – April 10, 2025