How to Set Axis Max Value of AnyChart in APEX Dynamically

I just created a one-page APEX application to show performance chart of our main production server based on Active Session History data. We publish it on a big monitor so we can see the performance chart during the day. It’s not a big deal but it’s really useful. I used 2D stacked column chart and make the chart simple (contains only 3 colors: green for CPU, blue for user IO and orange for all other waits) like the ones you see on EM12c database home pages. Original chart:


My chart:


The original chart looks surely better, but the real problem I encountered was about scaling the chart according to the data. APEX uses AnyChart and it lets you set a static value as axis max value:


It’s possible to set a very high value according to our load but in this case, bars will look too small. If I set an average value, then the bars will be cut to the max value and will not reflect the real values. If I do not set a max value and leave it empty, then the chart will be scaled to data but in this case, you see bars are too high even for low values. To solve this problem, I defined a hidden parameter (P1_MAX) in the page, create a computation which will set it to a value of returning from my query (whenever the page is loaded):


Then I set my chart to use custom XML and inset the value as “&P1_MAX.”:


So the chart started to scale according to the data it shows.

Please share

AWS Big Data Specialist. Oracle Certified Professional (OCP) for EBS R12, Oracle 10g and 11g. Co-author of "Expert Oracle Enterprise Manager 12c" book published by Apress. Awarded as Oracle ACE (in 2011) and Oracle ACE Director (in 2016) for the continuous contributions to the Oracle users community. Founding member, and vice president of Turkish Oracle User Group (TROUG). Presented at various international conferences including Oracle Open World.


  1. Pingback: And we’re Off | Oracle Business Intelligence

Leave a Reply to Koloo Enock Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.