MicroStrategy ONE
Use Local Files as External Libraries
JavaScript library files that are hosted on external Web servers can be used within a custom visualization. The drawback in using this method is that the visualization cannot be rendered until the JavaScript dependencies have fully loaded, which may take a significant amount of time, and some browsers may not allow external resources to be loaded as part of a web page.
As an alternative, you can store these external library files within a local plug-in on the Web server. They can then be referred to using a relative URL pointing to the specific resource within the plug-in. This method may reduce loading time if any functionality is dependent on these libraries, and may also address issues with browsers potentially preventing external resources from loading due to tightened security settings or other factors.
Always follow the best practices for locally storing resources with a plug-in.
Add External Libraries Manually
Follow the procedure below to use a local file as an external library.
- Copy the library file and paste it in the plug-in folder for the visualization on the mobile or Web server or the Workstation installation. The recommended locations for each product are shown below. Your library file must be located in javascript/mojo/js/source for the relative paths mentioned in step 2 to work. Do not put the library file directly in the javascript folder.
MicroStrategy Mobile:
Copy<mobile server>/plugins/<plug-in name>/javascript/mojo/js/source/<library file name>.js
MicroStrategy Web:
Copy<web server>/plugins/<plug-in name>/javascript/mojo/js/source/<library file name>.js
MicroStrategy Workstation:
CopyWorkstation/code/plugins/<plug-in name>/javascript/mojo/js/source/<library file name>.js
-
Open the JavaScript file that defines the visualization and add an entry to externalLibraries that defines the relative path to the local library file. When you use the relative path below, the visualization will work on all platforms—including MicroStrategy Web, Desktop, Workstation, and Mobile.
CopyexternalLibraries:[{url: (mstrApp.getPluginsRoot && mstrApp.getPluginsRoot() || "../plugins/")+"<plugin name>/javascript/mojo/js/source/<library file name>.js"}]
Using this relative path allows you to maintain only one version of the plug-in for all platforms and ensures backwards compatibility.
- Save your changes.