Skip to main content

Posts

Showing posts from June, 2021

SVG Pattern fill for Gantt Charts

In one of the previous applications I have developed, there was a requirement to show several types of entries in the Gantt chart and I must use visually distinct colors so it would be easy for users to understand which task bar is referring to which task type. Even though there are lot of different colors available technically, distinguishing nearby colors, without keeping them side by side is not easy. Users can recognize basic colors, beyond that it gets tricky. In such cases, we need something beyond colors to fill our charts. SVG Patterns SVG Patterns are somewhat similar to HTML5 templates. HTML5  template  tag can contain some HTML, but it will not be rendered when page is loaded. Later, we can use the  template  using JavaScript. In similar fashion, SVG Patterns holds graphic object, but it will not be rendered. However, the pattern can be used for other elements by referencing the pattern in the fill and/or stroke attributes. You can have quick look  here  to understand more a

Oracle APEX Tree Search

Implementing search feature for the tree region is little tricky. Consider we have tree region created on the employee table EMP  as below. If we search for employee JAMES and we want to show JAMES node, then we must show everyone up in the hierarchy till the root node, i.e. KING > BLAKE > JAMES. Luckily, we can easily get hierarchy (traverse path) using sys_connect_by_path .  For e.g. consider below query select ename, empno, mgr, sys_connect_by_path(empno, ':' )|| ':' as emp_path from emp start with mgr is null connect by prior empno = mgr order siblings by ename This query gives all employee rows from EMP table, along with path data, from the root node to current node. Now, we can use this path data to filter rows that are required to show any node. For e.g. we can use below query to get all the required nodes to show JAMES node. with emp_tree as ( select ename, empno, mgr, sys_connect_by