oracle-apexoracle-apex-19.1oracle-apex-19.2

Oracle Apex AnyChart... if then statement in the XML? Is it possible


I am trying to get decimals to show for certain chart data, but not for others. The user can choose a measure to chart from a select list. For example, a dollar amount would not need two decimals. But if they pick a percentage, it needs to have two decimals. In the attached screen shot, you can see that decimals are not necessary.

dollars

However, in the next screen shot, you can see how I need decimal places:

percentages

Since this is a legacy AnyChart, I'm looking at the XML code window to see if I can maybe do an if... then statement of some kind? Possibly in this section:

<format><![CDATA[{%Name}{enabled:False} - {%Value}{numDecimals:2,decimalSeparator:.,thousandsSeparator:\,}]]></format>

But I may be doing this the hard way. I tried to make my chart a multi-series chart but only one series would show at a time. I had to make it a Legacy AnyChart to get more than one series to show. So, this is two parter: Can I do an if...then... statement in XML? Or, how do I get more than one series to show at a time in a "multi-series" chart? I need it to look like the first picture above. Thank you!


Solution

  • I'd go with two charts (or more, if necessary): one would display dollars, another one percentage.

    Initially, when you enter the page, select list item won't have any value so none of chart region will be displayed. Then, as you select something and submit the page, server-side condition for one of regions will be satisfied and that region will be displayed. If you select something else, another region will be displayed and other(s) won't.