At this moment I'm working with an Oracle Apex page which has a region using AnyChart library for showing the maps. The task is the following: I need to get for some record the SVG from the database and then make the arrays for the AnyChart functions, which are to create legend, fill the polygons with definite colour and get some information by the means of tooltips.
I understand how to get SVG file or to get the array with needed data (beginning with the function $.post and so on). The difficulty I have is that I'd like to get both the SVG and all the arrays generated from the database for one record in one step: to execute one JavaScript function, which executes one AJAX process for the exact record, and therefore get all the data I need.
The Apex version I work in is 4.2.6.00.03. The problem is that the PL/SQL procedure HTP.P used for callbacks seems to not be able to give away more than one array, and also I can't call all the JavaScript functions for getting each array at the same time.
Certainly, I can make one JavaScript function for one array and then to create a kind of chain of them, in which the next function would be called from the previous one, but I think that's too complicated. Also I don't think that making a super array consisting from the several "base" arrays is a good idea, especially because in my case every array needs to have very many elements.
// For example, this is how the initialization of a seat map in AnyChart looks like:
var chart = anychart.seatMap([
{id:'1', value: 'Area 1'},
{id:'2', value: 'Area 2'},
{id:'3', value: 'Area 3'}
]);
// And this is the PL/SQL code of pushing back the array for it.
// HTP.P('[{id:"1",value:"Area 1},{id:"2",value:"Area 2},{id:"3",value:"Area 3}]');
At this moment I use the "dumb" solution of my problem: I have separate JavaScript functions with AJAX callbacks for getting each array for drawing the map with the help of AnyChart. I won't be against of the solution with two separate functions (for getting SVG and getting all the arrays), but I'd like to have a relatively simple solution of my problem.
Getting data objects of different types by means of several functions is the best practice in this case. It allows change data objects on the fly. I mean getting another map and leave the data the same, and otherwise. So, all the options you mentioned will work but getting map/data/meta, etc in different function calls are the best approach in this case.