Customize Map Zoom Level

Hello Helical Team,

I am using Helical Insight 4.0. In the map, I want to automatically open the map with zoom at a specific location of latitude and longitude. I am trying to use the following script:
var map =‘map’).setView([51.505, -0.09], 13);

However, the above is not working when put in the JS Editor. Can you give a script to implement above?

Thank You,

Hello Netta,

. In order to work with external JS scripts, you need to implement using any of the chart lifecycle methods like preExecution, postExecution, preFetch or postFetch scripts.

Below script is an example of how you can adjust the zoom factor and setView to a specific lat and longitude for the openstreemaps which are integrated.

var viz_Options = c.get("viz_Options");
viz_Options.chartOptions["setViewLat"] = 26.746282;
viz_Options.chartOptions["setViewLong"] = 82.70905;
viz_Options.chartOptions["mapZoomLevel"] = 5;


Thank You,
Helical Insight.


In the created map based report if you put the below code in the JSEditor it will automatically zoom in to the very first record
Please note that in the below code highlighted in bold & red is the name of latitude and longitude columns which we have. For example if your latitude and longitude column name is dist_lat and dist_long then replace latitude and longitude with dist_lat and dist_long in the below code and then add it in JSEditor.
mapZoomLevel property also you can customize as per the amount of zoom you would like to have when it opens default.

var viz_Options = c.get("viz_Options");
var responseData = c.get("responseData");
viz_Options.chartOptions["setViewLat"] =[0].latitude;
viz_Options.chartOptions["setViewLong"] =[0].longitude;
viz_Options.chartOptions["mapZoomLevel"] = 9;