Reputation: 1
I want to perform some simple formatting for a bar graph in Oracle Apex. In a numerical graph, given a value, I want to draw a horizontal line across the y axis at that value and any bars that contain values below that line should be coloured red and otherwise green. For example, if this is my [Bar Graph] and the value inputted is 33, only one bar should be green and the others red
I am not sure what to try, my graph source is an SQL Query and I know there may be some solutions that use the CASE query in connection with some CSS, but I am unsure about how to go about this. I appreciate any solution.
Upvotes: 0
Views: 47
Reputation: 291
To do that, you would need a query like the following where your case expression evaluates the column quantity
similar to your use case:
select
case
when b.quantity > 50 then 'gold'
when b.quantity <= 30 then 'red'
when b.quantity > 30 then 'green'
else 'blue'
end colors
from eba_demo_chart_orders b
Regarding the CSS you mentioned, you can use exact HEX codes like #fff
instead of gold
.
For more information, see the dropdown: Bar Chart (Series Colors) Information from the sample app https://apex.oracle.com/pls/apex/r/apex_pm/sample-charts/bar
Also note that the sample apps cover a wide variety of features that you can install, reverse engineer and learn from.
Upvotes: 0