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:

activity

My chart:

myactivity

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:

axismaxvalue

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):

maxvalue

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

customxml

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

Please share
  • 2
  •  
  •  
  •  
  •  
  •  
  •  

Gokhan Atil is a database administrator who has hands-on experience with both RDBMS and noSQL databases, and strong background on software development. He is certified as Oracle Certified Professional (OCP) and is awarded as Oracle ACE (in 2011) and Oracle ACE Director (in 2016) for his continuous contributions to the Oracle users community.

2 Comments

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

Leave Comment

Your email address will not be published. Required fields are marked *

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